aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/host/r.lux
diff options
context:
space:
mode:
Diffstat (limited to 'new-luxc/source/luxc/lang/host/r.lux')
-rw-r--r--new-luxc/source/luxc/lang/host/r.lux72
1 files changed, 36 insertions, 36 deletions
diff --git a/new-luxc/source/luxc/lang/host/r.lux b/new-luxc/source/luxc/lang/host/r.lux
index 960063a11..6667d531f 100644
--- a/new-luxc/source/luxc/lang/host/r.lux
+++ b/new-luxc/source/luxc/lang/host/r.lux
@@ -16,10 +16,10 @@
Text
- (def: name (All [k] (-> (Var k) Text)) (|>> @representation))
+ (def: name (All [k] (-> (Var k) Text)) (|>> :representation))
- (def: #export var (-> Text (Var Single)) (|>> @abstraction))
- (def: #export var-args (Var Poly) (@abstraction "..."))
+ (def: #export var (-> Text (Var Single)) (|>> :abstraction))
+ (def: #export var-args (Var Poly) (:abstraction "..."))
)
(type: #export SVar (Var Single))
@@ -30,13 +30,13 @@
Text
- (def: #export expression (-> Expression Text) (|>> @representation))
+ (def: #export expression (-> Expression Text) (|>> :representation))
- (def: #export code (-> Text Expression) (|>> @abstraction))
+ (def: #export code (-> Text Expression) (|>> :abstraction))
(def: (self-contained code)
(-> Text Expression)
- (@abstraction
+ (:abstraction
(format "(" code ")")))
(def: nest
@@ -50,8 +50,8 @@
(def: #export (block expression)
(-> Expression Expression)
- (@abstraction
- (format "{" (@representation expression) "}")))
+ (:abstraction
+ (format "{" (:representation expression) "}")))
(def: #export null
Expression
@@ -107,7 +107,7 @@
(def: #export named-list
(-> (List [Text Expression]) Expression)
(composite-literal "list(" ")" (.function (_ [key value])
- (format key "=" (@representation value)))))
+ (format key "=" (:representation value)))))
(do-template [<name> <function>]
[(def: #export <name>
@@ -121,24 +121,24 @@
(def: #export (slice from to list)
(-> Expression Expression Expression Expression)
(self-contained
- (format (@representation list)
- "[" (@representation from) ":" (@representation to) "]")))
+ (format (:representation list)
+ "[" (:representation from) ":" (:representation to) "]")))
(def: #export (slice-from from list)
(-> Expression Expression Expression)
(self-contained
- (format (@representation list)
- "[-1" ":-" (@representation from) "]")))
+ (format (:representation list)
+ "[-1" ":-" (:representation from) "]")))
(def: #export (apply args func)
(-> (List Expression) Expression Expression)
(self-contained
- (format (@representation func) "(" (text.join-with "," (list/map expression args)) ")")))
+ (format (:representation func) "(" (text.join-with "," (list/map expression args)) ")")))
(def: #export (apply-kw args kw-args func)
(-> (List Expression) (List [Text Expression]) Expression Expression)
(self-contained
- (format (@representation func)
+ (format (:representation func)
(format "("
(text.join-with "," (list/map expression args)) ","
(text.join-with "," (list/map (.function (_ [key val])
@@ -149,20 +149,20 @@
(def: #export (nth idx list)
(-> Expression Expression Expression)
(self-contained
- (format (@representation list) "[[" (@representation idx) "]]")))
+ (format (:representation list) "[[" (:representation idx) "]]")))
(def: #export (if test then else)
(-> Expression Expression Expression Expression)
(self-contained
- (format "if(" (@representation test) ")"
- " " (.._block (@representation then))
- " else " (.._block (@representation else)))))
+ (format "if(" (:representation test) ")"
+ " " (.._block (:representation then))
+ " else " (.._block (:representation else)))))
(def: #export (when test then)
(-> Expression Expression Expression)
(self-contained
- (format "if(" (@representation test) ") {"
- (.._block (@representation then))
+ (format "if(" (:representation test) ") {"
+ (.._block (:representation then))
"\n" "}")))
(def: #export (cond clauses else)
@@ -176,9 +176,9 @@
[(def: #export (<name> param subject)
(-> Expression Expression Expression)
(self-contained
- (format (@representation subject)
+ (format (:representation subject)
" " <op> " "
- (@representation param))))]
+ (:representation param))))]
[= "=="]
[< "<"]
@@ -222,7 +222,7 @@
(do-template [<name> <op>]
[(def: #export <name>
(-> Expression Expression)
- (|>> @representation (format <op>) self-contained))]
+ (|>> :representation (format <op>) self-contained))]
[not "!"]
[negate "-"]
@@ -235,25 +235,25 @@
(def: #export (range from to)
(-> Expression Expression Expression)
(self-contained
- (format (@representation from) ":" (@representation to))))
+ (format (:representation from) ":" (:representation to))))
(def: #export (function inputs body)
(-> (List (Ex [k] (Var k))) Expression Expression)
(let [args (|> inputs (list/map ..name) (text.join-with ", "))]
(self-contained
(format "function(" args ") "
- (.._block (@representation body))))))
+ (.._block (:representation body))))))
(def: #export (try body warning error finally)
(-> Expression (Maybe Expression) (Maybe Expression) (Maybe Expression) Expression)
(let [optional (: (-> Text (Maybe Expression) (-> Text Text) Text)
(.function (_ parameter value preparation)
(|> value
- (maybe/map (|>> @representation preparation (format ", " parameter " = ")))
+ (maybe/map (|>> :representation preparation (format ", " parameter " = ")))
(maybe.default ""))))]
(self-contained
(format "tryCatch("
- (.._block (@representation body))
+ (.._block (:representation body))
(optional "warning" warning id)
(optional "error" error id)
(optional "finally" finally .._block)
@@ -262,14 +262,14 @@
(def: #export (while test body)
(-> Expression Expression Expression)
(self-contained
- (format "while (" (@representation test) ") "
- (.._block (@representation body)))))
+ (format "while (" (:representation test) ") "
+ (.._block (:representation body)))))
(def: #export (for-in var inputs body)
(-> SVar Expression Expression Expression)
(self-contained
(format "for (" (..name var) " in " (..expression inputs) ")"
- (.._block (@representation body)))))
+ (.._block (:representation body)))))
(do-template [<name> <keyword>]
[(def: #export (<name> message)
@@ -283,17 +283,17 @@
(def: #export (set! var value)
(-> (Var Single) Expression Expression)
(self-contained
- (format (..name var) " <- " (@representation value))))
+ (format (..name var) " <- " (:representation value))))
(def: #export (set-nth! idx value list)
(-> Expression Expression SVar Expression)
(self-contained
- (format (..name list) "[[" (@representation idx) "]] <- " (@representation value))))
+ (format (..name list) "[[" (:representation idx) "]] <- " (:representation value))))
(def: #export (then pre post)
(-> Expression Expression Expression)
- (@abstraction
- (format (@representation pre)
+ (:abstraction
+ (format (:representation pre)
"\n"
- (@representation post))))
+ (:representation post))))
)