aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/target/python.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/library/lux/target/python.lux')
-rw-r--r--stdlib/source/library/lux/target/python.lux110
1 files changed, 56 insertions, 54 deletions
diff --git a/stdlib/source/library/lux/target/python.lux b/stdlib/source/library/lux/target/python.lux
index d507ba886..55d0eecea 100644
--- a/stdlib/source/library/lux/target/python.lux
+++ b/stdlib/source/library/lux/target/python.lux
@@ -47,33 +47,35 @@
(|>> (format text.new_line)
(text.replace_all text.new_line nested_new_line)))))
-(abstract: #export (Code brand)
+(abstract: .public (Code brand)
+ {}
+
Text
- (implementation: #export equivalence
+ (implementation: .public equivalence
(All [brand] (Equivalence (Code brand)))
(def: (= reference subject)
(\ text.equivalence = (:representation reference) (:representation subject))))
- (implementation: #export hash
+ (implementation: .public hash
(All [brand] (Hash (Code brand)))
(def: &equivalence ..equivalence)
(def: hash (|>> :representation (\ text.hash hash))))
- (def: #export manual
+ (def: .public manual
(-> Text Code)
(|>> :abstraction))
- (def: #export code
+ (def: .public code
(-> (Code Any) Text)
(|>> :representation))
(template [<type> <super>]
[(with_expansions [<brand> (template.identifier [<type> "'"])]
- (`` (abstract: #export (<brand> brand) Any))
- (`` (type: #export (<type> brand)
+ (`` (abstract: .public (<brand> brand) {} Any))
+ (`` (type: .public (<type> brand)
(<super> (<brand> brand)))))]
[Expression Code]
@@ -85,8 +87,8 @@
(template [<type> <super>]
[(with_expansions [<brand> (template.identifier [<type> "'"])]
- (`` (abstract: #export <brand> Any))
- (`` (type: #export <type> (<super> <brand>))))]
+ (`` (abstract: .public <brand> {} Any))
+ (`` (type: .public <type> (<super> <brand>))))]
[Literal Computation]
[Access Location]
@@ -95,21 +97,21 @@
)
(template [<var> <brand>]
- [(abstract: #export <brand> Any)
+ [(abstract: .public <brand> {} Any)
- (type: #export <var> (Var <brand>))]
+ (type: .public <var> (Var <brand>))]
[SVar Single]
[PVar Poly]
[KVar Keyword]
)
- (def: #export var
+ (def: .public var
(-> Text SVar)
(|>> :abstraction))
(template [<name> <brand> <prefix>]
- [(def: #export <name>
+ [(def: .public <name>
(-> SVar (Var <brand>))
(|>> :representation (format <prefix>) :abstraction))]
@@ -117,25 +119,25 @@
[keyword Keyword "**"]
)
- (def: #export none
+ (def: .public none
Literal
(:abstraction "None"))
- (def: #export bool
+ (def: .public bool
(-> Bit Literal)
(|>> (case> #0 "False"
#1 "True")
:abstraction))
- (def: #export int
+ (def: .public int
(-> Int Literal)
(|>> %.int :abstraction))
- (def: #export (long value)
+ (def: .public (long value)
(-> Int Literal)
(:abstraction (format (%.int value) "L")))
- (def: #export float
+ (def: .public float
(-> Frac Literal)
(`` (|>> (cond> (~~ (template [<test> <python>]
[[<test>]
@@ -167,13 +169,13 @@
))
)))
- (def: #export string
+ (def: .public string
(-> Text Literal)
(|>> ..safe
(text.enclosed [text.double_quote text.double_quote])
:abstraction))
- (def: #export unicode
+ (def: .public unicode
(-> Text Literal)
(|>> ..string
:representation
@@ -194,7 +196,7 @@
right_delimiter))))
(template [<name> <pre> <post>]
- [(def: #export <name>
+ [(def: .public <name>
(-> (List (Expression Any)) Literal)
(composite_literal <pre> <post> ..code))]
@@ -202,23 +204,23 @@
[list "[" "]"]
)
- (def: #export (slice from to list)
+ (def: .public (slice from to list)
(-> (Expression Any) (Expression Any) (Expression Any) Access)
(<| :abstraction
## ..expression
(format (:representation list) "[" (:representation from) ":" (:representation to) "]")))
- (def: #export (slice_from from list)
+ (def: .public (slice_from from list)
(-> (Expression Any) (Expression Any) Access)
(<| :abstraction
## ..expression
(format (:representation list) "[" (:representation from) ":]")))
- (def: #export dict
+ (def: .public dict
(-> (List [(Expression Any) (Expression Any)]) (Computation Any))
(composite_literal "{" "}" (.function (_ [k v]) (format (:representation k) " : " (:representation v)))))
- (def: #export (apply/* func args)
+ (def: .public (apply/* func args)
(-> (Expression Any) (List (Expression Any)) (Computation Any))
(<| :abstraction
## ..expression
@@ -234,7 +236,7 @@
)
(template [<name> <splat>]
- [(def: #export (<name> args extra func)
+ [(def: .public (<name> args extra func)
(-> (List (Expression Any)) (Expression Any) (Expression Any) (Computation Any))
(<| :abstraction
## ..expression
@@ -248,16 +250,16 @@
[apply_keyword splat_keyword]
)
- (def: #export (the name object)
+ (def: .public (the name object)
(-> Text (Expression Any) (Computation Any))
(:abstraction (format (:representation object) "." name)))
- (def: #export (do method args object)
+ (def: .public (do method args object)
(-> Text (List (Expression Any)) (Expression Any) (Computation Any))
(..apply/* (..the method object) args))
(template [<name> <apply>]
- [(def: #export (<name> args extra method)
+ [(def: .public (<name> args extra method)
(-> (List (Expression Any)) (Expression Any) Text
(-> (Expression Any) (Computation Any)))
(|>> (..the method) (<apply> args extra)))]
@@ -266,18 +268,18 @@
[do_keyword apply_keyword]
)
- (def: #export (nth idx array)
+ (def: .public (nth idx array)
(-> (Expression Any) (Expression Any) Location)
(:abstraction (format (:representation array) "[" (:representation idx) "]")))
- (def: #export (? test then else)
+ (def: .public (? test then else)
(-> (Expression Any) (Expression Any) (Expression Any) (Computation Any))
(<| :abstraction
..expression
(format (:representation then) " if " (:representation test) " else " (:representation else))))
(template [<name> <op>]
- [(def: #export (<name> param subject)
+ [(def: .public (<name> param subject)
(-> (Expression Any) (Expression Any) (Computation Any))
(<| :abstraction
..expression
@@ -307,7 +309,7 @@
)
(template [<name> <unary>]
- [(def: #export (<name> subject)
+ [(def: .public (<name> subject)
(-> (Expression Any) (Computation Any))
(<| :abstraction
## ..expression
@@ -317,25 +319,25 @@
[opposite "-"]
)
- (def: #export (lambda arguments body)
+ (def: .public (lambda arguments body)
(-> (List (Var Any)) (Expression Any) (Computation Any))
(<| :abstraction
..expression
(format "lambda " (|> arguments (list\map ..code) (text.join_with ", ")) ": "
(:representation body))))
- (def: #export (set vars value)
+ (def: .public (set vars value)
(-> (List (Location Any)) (Expression Any) (Statement Any))
(:abstraction
(format (|> vars (list\map ..code) (text.join_with ", "))
" = "
(:representation value))))
- (def: #export (delete where)
+ (def: .public (delete where)
(-> (Location Any) (Statement Any))
(:abstraction (format "del " (:representation where))))
- (def: #export (if test then! else!)
+ (def: .public (if test then! else!)
(-> (Expression Any) (Statement Any) (Statement Any) (Statement Any))
(:abstraction
(format "if " (:representation test) ":"
@@ -343,13 +345,13 @@
text.new_line "else:"
(..nested (:representation else!)))))
- (def: #export (when test then!)
+ (def: .public (when test then!)
(-> (Expression Any) (Statement Any) (Statement Any))
(:abstraction
(format "if " (:representation test) ":"
(..nested (:representation then!)))))
- (def: #export (then pre! post!)
+ (def: .public (then pre! post!)
(-> (Statement Any) (Statement Any) (Statement Any))
(:abstraction
(format (:representation pre!)
@@ -357,7 +359,7 @@
(:representation post!))))
(template [<keyword> <0>]
- [(def: #export <0>
+ [(def: .public <0>
(Statement Any)
(:abstraction <keyword>))]
@@ -365,7 +367,7 @@
["continue" continue]
)
- (def: #export (while test body! else!)
+ (def: .public (while test body! else!)
(-> (Expression Any) (Statement Any) (Maybe (Statement Any)) Loop)
(:abstraction
(format "while " (:representation test) ":"
@@ -378,26 +380,26 @@
#.None
""))))
- (def: #export (for_in var inputs body!)
+ (def: .public (for_in var inputs body!)
(-> SVar (Expression Any) (Statement Any) Loop)
(:abstraction
(format "for " (:representation var) " in " (:representation inputs) ":"
(..nested (:representation body!)))))
- (def: #export statement
+ (def: .public statement
(-> (Expression Any) (Statement Any))
(|>> :transmutation))
- (def: #export pass
+ (def: .public pass
(Statement Any)
(:abstraction "pass"))
- (type: #export Except
+ (type: .public Except
{#classes (List SVar)
#exception SVar
#handler (Statement Any)})
- (def: #export (try body! excepts)
+ (def: .public (try body! excepts)
(-> (Statement Any) (List Except) (Statement Any))
(:abstraction
(format "try:"
@@ -410,7 +412,7 @@
(text.join_with "")))))
(template [<name> <keyword> <pre>]
- [(def: #export (<name> value)
+ [(def: .public (<name> value)
(-> (Expression Any) (Statement Any))
(:abstraction
(format <keyword> (<pre> (:representation value)))))]
@@ -420,7 +422,7 @@
[print "print" ..expression]
)
- (def: #export (exec code globals)
+ (def: .public (exec code globals)
(-> (Expression Any) (Maybe (Expression Any)) (Statement Any))
(let [extra (case globals
(#.Some globals)
@@ -431,24 +433,24 @@
(:abstraction
(format "exec" (:representation (..tuple (list& code extra)))))))
- (def: #export (def name args body)
+ (def: .public (def name args body)
(-> SVar (List (Ex [k] (Var k))) (Statement Any) (Statement Any))
(:abstraction
(format "def " (:representation name)
"(" (|> args (list\map ..code) (text.join_with ", ")) "):"
(..nested (:representation body)))))
- (def: #export (import module_name)
+ (def: .public (import module_name)
(-> Text (Statement Any))
(:abstraction (format "import " module_name)))
- (def: #export (comment commentary on)
+ (def: .public (comment commentary on)
(All [brand] (-> Text (Code brand) (Code brand)))
(:abstraction (format "# " (..safe commentary) text.new_line
(:representation on))))
)
-(def: #export (cond clauses else!)
+(def: .public (cond clauses else!)
(-> (List [(Expression Any) (Statement Any)]) (Statement Any) (Statement Any))
(list\fold (.function (_ [test then!] next!)
(..if test then! next!))
@@ -470,12 +472,12 @@
<inputs> (arity_inputs <arity>)
<types> (arity_types <arity>)
<definitions> (template.spliced <function>+)]
- (def: #export (<apply> function <inputs>)
+ (def: .public (<apply> function <inputs>)
(-> (Expression Any) <types> (Computation Any))
(..apply/* function (.list <inputs>)))
(template [<function>]
- [(`` (def: #export (~~ (template.identifier [<function> "/" <arity>]))
+ [(`` (def: .public (~~ (template.identifier [<function> "/" <arity>]))
(<apply> (..var <function>))))]
<definitions>))]