aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source
diff options
context:
space:
mode:
Diffstat (limited to 'new-luxc/source')
-rw-r--r--new-luxc/source/luxc/lang/host/common-lisp.lux40
-rw-r--r--new-luxc/source/luxc/lang/host/php.lux100
-rw-r--r--new-luxc/source/luxc/lang/host/python.lux100
-rw-r--r--new-luxc/source/luxc/lang/host/r.lux72
4 files changed, 156 insertions, 156 deletions
diff --git a/new-luxc/source/luxc/lang/host/common-lisp.lux b/new-luxc/source/luxc/lang/host/common-lisp.lux
index 3ba69314d..108f69e27 100644
--- a/new-luxc/source/luxc/lang/host/common-lisp.lux
+++ b/new-luxc/source/luxc/lang/host/common-lisp.lux
@@ -16,18 +16,18 @@
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 (-> Text (Var Single)) (|>> :abstraction))
(def: #export (poly vars)
(-> (List (Var Single)) (Var Poly))
- (@abstraction
+ (:abstraction
(format "(" (|> vars (list/map ..name) (text.join-with " ")) ")")))
(def: #export (poly+ vars rest)
(-> (List (Var Single)) (Var Single) (Var Poly))
- (@abstraction
+ (:abstraction
(format "(" (|> vars (list/map ..name) (text.join-with " "))
" &rest " (..name rest)
")")))
@@ -42,24 +42,24 @@
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))
(type: #export Lambda [PVar Expression])
(def: #export nil
Expression
- (@abstraction "()"))
+ (:abstraction "()"))
(def: #export bool
(-> Bool Expression)
- (|>> (case> true (@abstraction "t")
+ (|>> (case> true (:abstraction "t")
false ..nil)))
(def: #export int
(-> Int Expression)
- (|>> %i @abstraction))
+ (|>> %i :abstraction))
(def: #export float
(-> Frac Expression)
@@ -74,11 +74,11 @@
## else
[%f])
- @abstraction))
+ :abstraction))
(def: #export (double value)
(-> Frac Expression)
- (@abstraction
+ (:abstraction
(.cond (f/= number.positive-infinity value)
"(/ 1.0d0 0.0d0)"
@@ -100,24 +100,24 @@
(def: #export string
(-> Text Expression)
- (|>> %t @abstraction))
+ (|>> %t :abstraction))
(do-template [<name> <prefix>]
[(def: #export <name>
(-> Text Expression)
- (|>> (format <prefix>) @abstraction))]
+ (|>> (format <prefix>) :abstraction))]
[symbol "'"]
[keyword ":"])
(def: #export (form elements)
(-> (List Expression) Expression)
- (@abstraction
+ (:abstraction
(format "(" (|> elements (list/map expression) (text.join-with " ")) ")")))
(def: #export @@
(All [k] (-> (Var k) Expression))
- (|>> ..name @abstraction))
+ (|>> ..name :abstraction))
(def: #export global
(-> Text Expression)
@@ -350,15 +350,15 @@
expression
(#.Cons single #.Nil)
- (@abstraction
- (format <prefix> single " " (@representation expression)))
+ (:abstraction
+ (format <prefix> single " " (:representation expression)))
_
- (@abstraction
+ (:abstraction
(format <prefix> (|> conditions (list/map ..symbol)
(.list& (..symbol "or")) ..form
- @representation)
- " " (@representation expression)))))]
+ :representation)
+ " " (:representation expression)))))]
[conditional+ "#+"]
[conditional- "#-"])
diff --git a/new-luxc/source/luxc/lang/host/php.lux b/new-luxc/source/luxc/lang/host/php.lux
index 603888d3e..50d618f85 100644
--- a/new-luxc/source/luxc/lang/host/php.lux
+++ b/new-luxc/source/luxc/lang/host/php.lux
@@ -28,7 +28,7 @@
(type: #export Computation (Code' (Expression' Computation')))
(type: #export Statement (Code' Statement'))
- (def: #export code (-> Code Text) (|>> @representation))
+ (def: #export code (-> Code Text) (|>> :representation))
(def: nest
(-> Text Text)
@@ -41,18 +41,18 @@
(def: computation
(-> Text Computation)
- (|>> (text.enclose ["(" ")"]) @abstraction))
+ (|>> (text.enclose ["(" ")"]) :abstraction))
(def: (statement code)
(-> Text Statement)
- (@abstraction (format code ";")))
+ (:abstraction (format code ";")))
(def: parameters
(-> (List Argument) Text)
(|>> (list/map (.function (_ [reference? var])
(if reference?
- (format "&" (@representation var))
- (@representation var))))
+ (format "&" (:representation var))
+ (:representation var))))
(text.join-with ", ")
(text.enclose ["(" ")"])))
@@ -71,23 +71,23 @@
(def: #export var
(-> Text Var)
- (|>> (format "$") @abstraction))
+ (|>> (format "$") :abstraction))
(def: #export global
(-> Text Global)
- (|>> @abstraction))
+ (|>> :abstraction))
(def: #export null
Computation
- (@abstraction "NULL"))
+ (:abstraction "NULL"))
(def: #export bool
(-> Bool Computation)
- (|>> %b @abstraction))
+ (|>> %b :abstraction))
(def: #export int
(-> Int Computation)
- (|>> %i @abstraction))
+ (|>> %i :abstraction))
(def: #export float
(-> Frac Computation)
@@ -101,16 +101,16 @@
[(new> "NAN" computation)]
## else
- [%f @abstraction])))
+ [%f :abstraction])))
(def: #export string
(-> Text Computation)
- (|>> %t @abstraction))
+ (|>> %t :abstraction))
(def: #export (apply args func)
(-> (List Expression) Expression Computation)
- (@abstraction
- (format (@representation func) (..arguments args))))
+ (:abstraction
+ (format (:representation func) (..arguments args))))
(def: #export (function arguments uses body)
(-> (List Argument) (List Argument) Statement Computation)
@@ -123,7 +123,7 @@
(computation
(format "function " (..parameters arguments)
" " uses " "
- (block (@representation body))))))
+ (block (:representation body))))))
(do-template [<name> <function>]
[(def: #export <name>
@@ -156,7 +156,7 @@
(format "array("
(|> kvs
(list/map (.function (_ [key value])
- (format (@representation key) " => " (@representation value))))
+ (format (:representation key) " => " (:representation value))))
(text.join-with ", "))
")")))
@@ -192,30 +192,30 @@
(def: #export (new constructor inputs)
(-> Global (List Expression) Computation)
(computation
- (format "new " (@representation constructor) (arguments inputs))))
+ (format "new " (:representation constructor) (arguments inputs))))
(def: #export (send method inputs object)
(-> Text (List Expression) Expression Computation)
(computation
- (format (@representation object) "->" method (arguments inputs))))
+ (format (:representation object) "->" method (arguments inputs))))
(def: #export (nth idx array)
(-> Expression Expression Computation)
(computation
- (format (@representation array) "[" (@representation idx) "]")))
+ (format (:representation array) "[" (:representation idx) "]")))
(def: #export (? test then else)
(-> Expression Expression Expression Computation)
(computation
- (format (@representation test) " ? "
- (@representation then) " : "
- (@representation else))))
+ (format (:representation test) " ? "
+ (:representation then) " : "
+ (:representation else))))
(do-template [<name> <op>]
[(def: #export (<name> param subject)
(-> Expression Expression Computation)
(computation
- (format (@representation subject) " " <op> " " (@representation param))))]
+ (format (:representation subject) " " <op> " " (:representation param))))]
[or "||"]
[and "&&"]
@@ -240,12 +240,12 @@
(def: #export not
(-> Computation Computation)
- (|>> @representation (format "!") @abstraction))
+ (|>> :representation (format "!") :abstraction))
(do-template [<name> <type> <constructor>]
[(def: #export (<name> var value)
(-> Var Expression <type>)
- (<constructor> (format (@representation var) " = " (@representation value))))]
+ (<constructor> (format (:representation var) " = " (:representation value))))]
[set! Statement ..statement]
[set!' Computation ..computation]
@@ -254,11 +254,11 @@
(def: #export (set-nth! idx value array)
(-> Expression Expression Expression Statement)
(..statement
- (format (@representation array) "[" (@representation idx) "] = " (@representation value))))
+ (format (:representation array) "[" (:representation idx) "] = " (:representation value))))
(def: #export global!
(-> Var Statement)
- (|>> @representation (format "global ") ..statement))
+ (|>> :representation (format "global ") ..statement))
(def: #export (set-global! name value)
(-> Text Expression Statement)
@@ -266,34 +266,34 @@
(def: #export (if! test then! else!)
(-> Expression Statement Statement Statement)
- (@abstraction
- (format "if (" (@representation test) ")"
- (block (@representation then!))
+ (:abstraction
+ (format "if (" (:representation test) ")"
+ (block (:representation then!))
" else "
- (block (@representation else!)))))
+ (block (:representation else!)))))
(def: #export (when! test then!)
(-> Expression Statement Statement)
- (@abstraction
- (format "if (" (@representation test) ") "
- (block (@representation then!)))))
+ (:abstraction
+ (format "if (" (:representation test) ") "
+ (block (:representation then!)))))
(def: #export (then! post! pre!)
(-> Statement Statement Statement)
- (@abstraction
- (format (@representation pre!)
+ (:abstraction
+ (format (:representation pre!)
"\n"
- (@representation post!))))
+ (:representation post!))))
## (def: #export (while! test body!)
## (-> Computation Statement Statement)
- ## (@abstraction
+ ## (:abstraction
## (format "while " (expression test) ":"
## (nest body!))))
## (def: #export (for-in! variable inputs body!)
## (-> SVariable Computation Statement Statement)
- ## (@abstraction
+ ## (:abstraction
## (format "for " (..name variable) " in " (expression inputs) ":"
## (nest body!))))
@@ -304,21 +304,21 @@
(def: (catch! except)
(-> Except Text)
- (let [declaration (format "(" (@representation (get@ #class except))
- " " (@representation (get@ #exception except)) ")")]
+ (let [declaration (format "(" (:representation (get@ #class except))
+ " " (:representation (get@ #exception except)) ")")]
(format "catch" declaration " "
- (block (@representation (get@ #handler except))))))
+ (block (:representation (get@ #handler except))))))
(def: #export (try! body! excepts)
(-> Statement (List Except) Statement)
- (@abstraction
- (format "try " (block (@representation body!)) "\n"
+ (:abstraction
+ (format "try " (block (:representation body!)) "\n"
(|> excepts (list/map catch!) (text.join-with "\n")))))
(do-template [<name> <keyword>]
[(def: #export (<name> message)
(-> Expression Statement)
- (statement (format <keyword> " " (@representation message))))]
+ (statement (format <keyword> " " (:representation message))))]
[throw! "throw"]
[return! "return"]
@@ -327,17 +327,17 @@
(def: #export do!
(-> Expression Statement)
- (|>> @representation statement))
+ (|>> :representation statement))
(def: #export (define! name value)
(-> Global Expression Statement)
- (do! (..apply (list (|> name @representation ..string)
+ (do! (..apply (list (|> name :representation ..string)
value)
(..global "define"))))
(def: #export (function! name args body)
(-> Global (List Argument) Statement Statement)
- (@abstraction
- (format "function " (@representation name) (..parameters args)
- " " (block (@representation body)))))
+ (:abstraction
+ (format "function " (:representation name) (..parameters args)
+ " " (block (:representation body)))))
)
diff --git a/new-luxc/source/luxc/lang/host/python.lux b/new-luxc/source/luxc/lang/host/python.lux
index b2b639cb2..c9835aa5d 100644
--- a/new-luxc/source/luxc/lang/host/python.lux
+++ b/new-luxc/source/luxc/lang/host/python.lux
@@ -16,14 +16,14 @@
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 (-> Text (Var Single)) (|>> :abstraction))
(do-template [<name> <kind> <prefix>]
[(def: #export <name>
(-> (Var Single) (Var <kind>))
- (|>> @representation (format <prefix>) @abstraction))]
+ (|>> :representation (format <prefix>) :abstraction))]
[poly Poly "*"]
[keyword Keyword "**"]
@@ -39,23 +39,23 @@
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: #export none
Expression
- (@abstraction "None"))
+ (:abstraction "None"))
(def: #export bool
(-> Bool Expression)
(|>> (case> true "True"
false "False")
- @abstraction))
+ :abstraction))
(def: #export int
(-> Int Expression)
- (|>> %i @abstraction))
+ (|>> %i :abstraction))
(def: #export float
(-> Frac Expression)
@@ -70,17 +70,17 @@
## else
[%f])
- @abstraction))
+ :abstraction))
(def: #export string
(-> Text Expression)
- (|>> %t @abstraction))
+ (|>> %t :abstraction))
(def: (composite-literal left-delimiter right-delimiter entry-serializer)
(All [a] (-> Text Text (-> a Text)
(-> (List a) Expression)))
(function (_ entries)
- (@abstraction (format "(" left-delimiter
+ (:abstraction (format "(" left-delimiter
(|> entries (list/map entry-serializer) (text.join-with ","))
right-delimiter ")"))))
@@ -95,30 +95,30 @@
(def: #export (slice from to list)
(-> Expression Expression Expression Expression)
- (@abstraction (format "(" (@representation list)
- "[" (@representation from) ":" (@representation to) "]"
+ (:abstraction (format "(" (:representation list)
+ "[" (:representation from) ":" (:representation to) "]"
")")))
(def: #export (slice-from from list)
(-> Expression Expression Expression)
- (@abstraction (format "(" (@representation list)
- "[" (@representation from) ":]"
+ (:abstraction (format "(" (:representation list)
+ "[" (:representation from) ":]"
")")))
(def: #export dict
(-> (List [Expression Expression]) Expression)
- (composite-literal "{" "}" (.function (_ [k v]) (format (@representation k) " : " (@representation v)))))
+ (composite-literal "{" "}" (.function (_ [k v]) (format (:representation k) " : " (:representation v)))))
(def: #export (apply args func)
(-> (List Expression) Expression Expression)
- (@abstraction (format "(" (@representation func)
+ (:abstraction (format "(" (:representation func)
"(" (text.join-with "," (list/map expression args)) ")"
")")))
(do-template [<name> <kind> <prefix>]
[(def: (<name> var)
(-> Expression Text)
- (format <prefix> (@representation var)))]
+ (format <prefix> (:representation var)))]
[splat-poly Poly "*"]
[splat-keyword Keyword "**"]
@@ -127,9 +127,9 @@
(do-template [<name> <splat>]
[(def: #export (<name> args extra func)
(-> (List Expression) Expression Expression Expression)
- (@abstraction (format "(" (@representation func)
+ (:abstraction (format "(" (:representation func)
(format "(" (|> args
- (list/map (function (_ arg) (format (@representation arg) ", ")))
+ (list/map (function (_ arg) (format (:representation arg) ", ")))
(text.join-with ""))
(<splat> extra) ")")
")")))]
@@ -140,7 +140,7 @@
(def: #export (field name object)
(-> Text Expression Expression)
- (@abstraction (format "(" (@representation object) "." name ")")))
+ (:abstraction (format "(" (:representation object) "." name ")")))
(def: #export (send args method object)
(-> (List Expression) Text Expression Expression)
@@ -158,21 +158,21 @@
(def: #export (nth idx array)
(-> Expression Expression Expression)
- (@abstraction (format "(" (@representation array) "[" (@representation idx) "])")))
+ (:abstraction (format "(" (:representation array) "[" (:representation idx) "])")))
(def: #export (if test then else)
(-> Expression Expression Expression Expression)
- (@abstraction (format "(" (@representation then)
- " if " (@representation test)
- " else " (@representation else)
+ (:abstraction (format "(" (:representation then)
+ " if " (:representation test)
+ " else " (:representation else)
")")))
(do-template [<name> <op>]
[(def: #export (<name> param subject)
(-> Expression Expression Expression)
- (@abstraction (format "(" (@representation subject)
+ (:abstraction (format "(" (:representation subject)
" " <op> " "
- (@representation param) ")")))]
+ (:representation param) ")")))]
[is "is"]
[= "=="]
@@ -196,9 +196,9 @@
(do-template [<name> <op>]
[(def: #export (<name> param subject)
(-> Expression Expression Expression)
- (@abstraction (format "(" (@representation param)
+ (:abstraction (format "(" (:representation param)
" " <op> " "
- (@representation subject) ")")))]
+ (:representation subject) ")")))]
[or "or"]
[and "and"]
@@ -206,16 +206,16 @@
(def: #export (not subject)
(-> Expression Expression)
- (@abstraction (format "(not " (@representation subject) ")")))
+ (:abstraction (format "(not " (:representation subject) ")")))
(def: #export (@@ var)
(All [k] (-> (Var k) Expression))
- (@abstraction (format "(" (..name var) ")")))
+ (:abstraction (format "(" (..name var) ")")))
(def: #export (lambda arguments body)
(-> (List (Ex [k] (Var k))) Expression Expression)
- (@abstraction (format "(" "lambda " (|> arguments (list/map ..name) (text.join-with ", ")) ": "
- (@representation body) ")")))
+ (:abstraction (format "(" "lambda " (|> arguments (list/map ..name) (text.join-with ", ")) ": "
+ (:representation body) ")")))
(def: #export global
(-> Text Expression)
@@ -231,28 +231,28 @@
Text
- (def: #export statement (-> Statement Text) (|>> @representation))
+ (def: #export statement (-> Statement Text) (|>> :representation))
(def: nest
(-> Statement Text)
- (|>> @representation
+ (|>> :representation
(format "\n")
(text.replace-all "\n" "\n ")))
(def: #export (set-nth! idx value array)
(-> Expression Expression Expression Statement)
- (@abstraction (format (expression array) "[" (expression idx) "] = " (expression value))))
+ (:abstraction (format (expression array) "[" (expression idx) "] = " (expression value))))
(def: #export (set! vars value)
(-> (List (Var Single)) Expression Statement)
- (@abstraction
+ (:abstraction
(format (|> vars (list/map ..name) (text.join-with ", "))
" = "
(expression value))))
(def: #export (if! test then! else!)
(-> Expression Statement Statement Statement)
- (@abstraction
+ (:abstraction
(format "if " (expression test) ":"
(nest then!)
"\n" "else:"
@@ -260,7 +260,7 @@
(def: #export (when! test then!)
(-> Expression Statement Statement)
- (@abstraction
+ (:abstraction
(format "if " (expression test) ":"
(nest then!))))
@@ -273,31 +273,31 @@
(def: #export (then! pre! post!)
(-> Statement Statement Statement)
- (@abstraction
- (format (@representation pre!)
+ (:abstraction
+ (format (:representation pre!)
"\n"
- (@representation post!))))
+ (:representation post!))))
(def: #export (while! test body!)
(-> Expression Statement Statement)
- (@abstraction
+ (:abstraction
(format "while " (expression test) ":"
(nest body!))))
(def: #export (for-in! var inputs body!)
(-> SVar Expression Statement Statement)
- (@abstraction
+ (:abstraction
(format "for " (..name var) " in " (expression inputs) ":"
(nest body!))))
(def: #export (do! expression)
(-> Expression Statement)
- (@abstraction
+ (:abstraction
(format (..expression expression) ";")))
(def: #export no-op!
Statement
- (@abstraction "\n"))
+ (:abstraction "\n"))
(type: #export Except
{#classes (List Text)
@@ -306,7 +306,7 @@
(def: #export (try! body! excepts)
(-> Statement (List Except) Statement)
- (@abstraction
+ (:abstraction
(format "try:"
(nest body!)
(|> excepts
@@ -319,7 +319,7 @@
(do-template [<name> <keyword>]
[(def: #export (<name> message)
(-> Expression Statement)
- (@abstraction
+ (:abstraction
(format <keyword> " " (expression message))))]
[raise! "raise"]
@@ -329,12 +329,12 @@
(def: #export (def! name args body)
(-> (Var Single) (List (Ex [k] (Var k))) Statement Statement)
- (@abstraction
+ (:abstraction
(format "def " (..name name)
"(" (|> args (list/map ..name) (text.join-with ",")) "):"
(nest body))))
(def: #export (import! module-name)
(-> Text Statement)
- (@abstraction (format "import " module-name)))
+ (:abstraction (format "import " module-name)))
)
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))))
)