From aac5a7796939cd705d955acb616cbff38474606d Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Tue, 3 Jul 2018 19:49:04 -0400 Subject: - Re-named "@abstraction" to ":abstraction" and "@representation" to ":representation". --- new-luxc/source/luxc/lang/host/python.lux | 100 +++++++++++++++--------------- 1 file changed, 50 insertions(+), 50 deletions(-) (limited to 'new-luxc/source/luxc/lang/host/python.lux') 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 [ ] [(def: #export (-> (Var Single) (Var )) - (|>> @representation (format ) @abstraction))] + (|>> :representation (format ) :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 [ ] [(def: ( var) (-> Expression Text) - (format (@representation var)))] + (format (:representation var)))] [splat-poly Poly "*"] [splat-keyword Keyword "**"] @@ -127,9 +127,9 @@ (do-template [ ] [(def: #export ( 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 "")) ( 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 [ ] [(def: #export ( param subject) (-> Expression Expression Expression) - (@abstraction (format "(" (@representation subject) + (:abstraction (format "(" (:representation subject) " " " " - (@representation param) ")")))] + (:representation param) ")")))] [is "is"] [= "=="] @@ -196,9 +196,9 @@ (do-template [ ] [(def: #export ( param subject) (-> Expression Expression Expression) - (@abstraction (format "(" (@representation param) + (:abstraction (format "(" (:representation param) " " " " - (@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 [ ] [(def: #export ( message) (-> Expression Statement) - (@abstraction + (:abstraction (format " " (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))) ) -- cgit v1.2.3