diff options
author | Eduardo Julian | 2016-12-12 23:07:50 -0400 |
---|---|---|
committer | Eduardo Julian | 2016-12-12 23:07:50 -0400 |
commit | d8b1363f087ae15d2ed63ab1f86a14a83c43f1e3 (patch) | |
tree | c738a17938f3b6eb3a488942cb4ac61f67d558b2 | |
parent | 02f78b1ff29982bea8c93fe6252593ba3942f38b (diff) |
- No longer using record syntax in certain macros.
27 files changed, 120 insertions, 120 deletions
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index 168afa397..de985db95 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -5216,7 +5216,7 @@ (def: (case-level^ level) (-> AST (Lux [AST AST])) (case level - (^ [_ (#;RecordS (list [expr binding]))]) + (^ [_ (#;TupleS (list expr binding))]) (return [expr binding]) _ diff --git a/stdlib/source/lux/cli.lux b/stdlib/source/lux/cli.lux index 459d6926f..73c78a7a6 100644 --- a/stdlib/source/lux/cli.lux +++ b/stdlib/source/lux/cli.lux @@ -227,7 +227,7 @@ (wrap [name (` any)])) (s;record (s;seq s;local-symbol s;any))))))) -(syntax: #export (program: {args program-args^} body) +(syntax: #export (program: [args program-args^] body) {#;doc (doc "Defines the entry-point to a program (similar to the \"main\" function/method in other programming languages)." "Can take a list of all the input parameters to the program, or can destructure them using CLI-option combinators from the lux/cli module." (program: all-args diff --git a/stdlib/source/lux/codata/struct/stream.lux b/stdlib/source/lux/codata/struct/stream.lux index b76db0f39..6eb0ed4a9 100644 --- a/stdlib/source/lux/codata/struct/stream.lux +++ b/stdlib/source/lux/codata/struct/stream.lux @@ -121,7 +121,7 @@ (@lazy [wa (split tail)])))) ## [Pattern-matching] -(syntax: #export (^stream& {patterns (s;form (s;many s;any))} body {branches (s;some s;any)}) +(syntax: #export (^stream& [patterns (s;form (s;many s;any))] body [branches (s;some s;any)]) {#;doc (doc "Allows destructuring of streams in pattern-matching expressions." "Caveat emptor: Only use it for destructuring, and not for testing values within the streams." (let [(^stream& x y z _tail) (some-stream-func 1 2 3)] diff --git a/stdlib/source/lux/concurrency/actor.lux b/stdlib/source/lux/concurrency/actor.lux index a10691b66..cea170b2c 100644 --- a/stdlib/source/lux/concurrency/actor.lux +++ b/stdlib/source/lux/concurrency/actor.lux @@ -188,11 +188,11 @@ (list decl type))) -(syntax: #export (actor: {_ex-lev common;export-level} - {(^@ decl [_vars _name _args]) actor-decl^} +(syntax: #export (actor: [_ex-lev common;export-level] + [(^@ decl [_vars _name _args]) actor-decl^] state-type - {methods (s;many method^)} - {?stop (s;opt stop^)}) + [methods (s;many method^)] + [?stop (s;opt stop^)]) {#;doc (doc "Allows defining an actor, with a set of methods that can be called on it." "The methods can return promisehronous outputs." "The methods can access the actor's state through the *state* variable." diff --git a/stdlib/source/lux/concurrency/frp.lux b/stdlib/source/lux/concurrency/frp.lux index 70f5c38e1..3a8e62fbb 100644 --- a/stdlib/source/lux/concurrency/frp.lux +++ b/stdlib/source/lux/concurrency/frp.lux @@ -22,7 +22,7 @@ (&;Promise (Maybe [a (Chan a)]))) ## [Syntax] -(syntax: #export (chan {?type (s;opt s;any)}) +(syntax: #export (chan [?type (s;opt s;any)]) {#;doc (doc "Makes an uninitialized Chan (in this case, of Unit)." (chan Unit))} (case ?type diff --git a/stdlib/source/lux/concurrency/promise.lux b/stdlib/source/lux/concurrency/promise.lux index 2e0c12a15..5eb95d0bb 100644 --- a/stdlib/source/lux/concurrency/promise.lux +++ b/stdlib/source/lux/concurrency/promise.lux @@ -72,7 +72,7 @@ (atom {#value ?value #observers (list)})) -(syntax: #export (promise {?type (s;opt s;any)}) +(syntax: #export (promise [?type (s;opt s;any)]) {#;doc (doc "Makes an uninitialized Promise (in this example, of Unit)." (promise Unit))} (case ?type diff --git a/stdlib/source/lux/control/effect.lux b/stdlib/source/lux/control/effect.lux index 29db302da..16605e1c7 100644 --- a/stdlib/source/lux/control/effect.lux +++ b/stdlib/source/lux/control/effect.lux @@ -292,16 +292,16 @@ output compiler;expected-type] (case [input output] (^=> [(#;AppT eff0 _) (#;AppT stackT0 recT0)] - {(type;apply-type stackT0 recT0) (#;Some unfoldT0)} - {stackT0 (^ (#;AppT (#;NamedT (ident-for ;;Eff) _) - stackT1))} - {(type;apply-type stackT1 recT0) (#;Some unfoldT1)} - {(list;find (lambda [[idx effect]] + [(type;apply-type stackT0 recT0) (#;Some unfoldT0)] + [stackT0 (^ (#;AppT (#;NamedT (ident-for ;;Eff) _) + stackT1))] + [(type;apply-type stackT1 recT0) (#;Some unfoldT1)] + [(list;find (lambda [[idx effect]] (if (tc;checks? (clean-effect effect) eff0) (#;Some idx) #;None)) (|> unfoldT1 type;flatten-sum (List/map un-apply) list;enumerate)) - (#;Some idx)}) + (#;Some idx)]) (wrap (list (` (#;;Effect (:: (~ g!functor) (~' map) (~' wrap) ((~ (ast;int (nat-to-int idx))) (~ (ast;symbol var)))))))) diff --git a/stdlib/source/lux/data/error/exception.lux b/stdlib/source/lux/data/error/exception.lux index e476357ca..7c6fb5ab6 100644 --- a/stdlib/source/lux/data/error/exception.lux +++ b/stdlib/source/lux/data/error/exception.lux @@ -53,7 +53,7 @@ (All [a] (-> Exception Text (Error a))) (#;Left (exception message))) -(syntax: #export (exception: {_ex-lev common;export-level} {name s;local-symbol}) +(syntax: #export (exception: [_ex-lev common;export-level] [name s;local-symbol]) (do @ [current-module compiler;current-module-name #let [g!message (ast;symbol ["" "message"])]] diff --git a/stdlib/source/lux/data/format/json.lux b/stdlib/source/lux/data/format/json.lux index aa469beb5..280aab24b 100644 --- a/stdlib/source/lux/data/format/json.lux +++ b/stdlib/source/lux/data/format/json.lux @@ -676,7 +676,7 @@ (syntax;alt (syntax;tuple (syntax;some syntax;any)) (syntax;record (syntax;some (syntax;seq syntax;text syntax;any))))) -(syntax: #export (shape^ {shape _shape^}) +(syntax: #export (shape^ [shape _shape^]) (case shape (#ArrayShape parts) (let [array-size (list;size parts) @@ -694,7 +694,7 @@ (wrap (list (` ($_ seq (~@ parsers)))))) )) -(syntax: #export (shape!^ {shape _shape^}) +(syntax: #export (shape!^ [shape _shape^]) (case shape (#ArrayShape parts) (let [array-size (list;size parts) diff --git a/stdlib/source/lux/data/struct/tree.lux b/stdlib/source/lux/data/struct/tree.lux index 7b7828d73..8603f5677 100644 --- a/stdlib/source/lux/data/struct/tree.lux +++ b/stdlib/source/lux/data/struct/tree.lux @@ -41,7 +41,7 @@ (-> Unit (Syntax Tree-AST)) (s;record (s;seq s;any (s;tuple (s;some (lambda [state] ((tree^ []) state))))))) -(syntax: #export (tree type {root (tree^ [])}) +(syntax: #export (tree type [root (tree^ [])]) (wrap (list (` (: (Tree (~ type)) (~ (loop [[value children] root] (` {#value (~ value) diff --git a/stdlib/source/lux/data/struct/vector.lux b/stdlib/source/lux/data/struct/vector.lux index 7e00a00b7..4e4922d0c 100644 --- a/stdlib/source/lux/data/struct/vector.lux +++ b/stdlib/source/lux/data/struct/vector.lux @@ -348,7 +348,7 @@ (|>. (get@ #size) (n.= +0))) ## [Syntax] -(syntax: #export (vector {elems (s;some s;any)}) +(syntax: #export (vector [elems (s;some s;any)]) (wrap (list (` (from-list (list (~@ elems))))))) ## [Structures] diff --git a/stdlib/source/lux/data/text/format.lux b/stdlib/source/lux/data/text/format.lux index f30e7de42..743502d11 100644 --- a/stdlib/source/lux/data/text/format.lux +++ b/stdlib/source/lux/data/text/format.lux @@ -22,7 +22,7 @@ (-> Text Text Text) (:: text;Monoid<Text> append)) -(syntax: #export (format {fragments (s;many s;any)}) +(syntax: #export (format [fragments (s;many s;any)]) {#;doc (doc "Text interpolation as a macro." (format "Static part " (%t static) " doesn't match URI: " uri))} (wrap (list (` ($_ _append_ (~@ fragments)))))) diff --git a/stdlib/source/lux/host.lux b/stdlib/source/lux/host.lux index 92ff61d92..22bd0f292 100644 --- a/stdlib/source/lux/host.lux +++ b/stdlib/source/lux/host.lux @@ -296,11 +296,11 @@ AST) (case [name+params mode in-array?] (^=> [[prim #;Nil] #ManualPrM false] - {(manual-primitive-to-type prim) (#;Some output)}) + [(manual-primitive-to-type prim) (#;Some output)]) output (^=> [[prim #;Nil] #AutoPrM false] - {(auto-primitive-to-type prim) (#;Some output)}) + [(auto-primitive-to-type prim) (#;Some output)]) output [[name params] _ _] @@ -869,8 +869,8 @@ (def: (arg-decl^ imports type-vars) (-> ClassImports (List TypeParam) (Syntax ArgDecl)) - (s;record (s;seq s;local-symbol - (generic-type^ imports type-vars)))) + (s;tuple (s;seq s;local-symbol + (generic-type^ imports type-vars)))) (def: (arg-decls^ imports type-vars) (-> ClassImports (List TypeParam) (Syntax (List ArgDecl))) @@ -1320,20 +1320,20 @@ {#super-class-name "java.lang.Object" #super-class-params (list)}) -(syntax: #export (class: {#let [imports (class-imports *compiler*)]} - {im inheritance-modifier^} - {class-decl (class-decl^ imports)} - {#let [full-class-name (product;left class-decl) +(syntax: #export (class: [#let [imports (class-imports *compiler*)]] + [im inheritance-modifier^] + [class-decl (class-decl^ imports)] + [#let [full-class-name (product;left class-decl) imports (add-import [(short-class-name full-class-name) full-class-name] - (class-imports *compiler*))]} - {#let [class-vars (product;right class-decl)]} - {super (s;default object-super-class - (super-class-decl^ imports class-vars))} - {interfaces (s;default (list) - (s;tuple (s;some (super-class-decl^ imports class-vars))))} - {annotations (annotations^ imports)} - {fields (s;some (field-decl^ imports class-vars))} - {methods (s;some (method-def^ imports class-vars))}) + (class-imports *compiler*))]] + [#let [class-vars (product;right class-decl)]] + [super (s;default object-super-class + (super-class-decl^ imports class-vars))] + [interfaces (s;default (list) + (s;tuple (s;some (super-class-decl^ imports class-vars))))] + [annotations (annotations^ imports)] + [fields (s;some (field-decl^ imports class-vars))] + [methods (s;some (method-def^ imports class-vars))]) {#;doc (doc "Allows defining JVM classes in Lux code." "For example:" (class: #final (JvmPromise A) [] @@ -1405,16 +1405,16 @@ (with-brackets (spaced (map (method-def$ replacer super) methods))))))]] (wrap (list (` (;_lux_proc ["jvm" (~ (ast;text def-code))] [])))))) -(syntax: #export (interface: {#let [imports (class-imports *compiler*)]} - {class-decl (class-decl^ imports)} - {#let [full-class-name (product;left class-decl) +(syntax: #export (interface: [#let [imports (class-imports *compiler*)]] + [class-decl (class-decl^ imports)] + [#let [full-class-name (product;left class-decl) imports (add-import [(short-class-name full-class-name) full-class-name] - (class-imports *compiler*))]} - {#let [class-vars (product;right class-decl)]} - {supers (s;default (list) - (s;tuple (s;some (super-class-decl^ imports class-vars))))} - {annotations (annotations^ imports)} - {members (s;some (method-decl^ imports class-vars))}) + (class-imports *compiler*))]] + [#let [class-vars (product;right class-decl)]] + [supers (s;default (list) + (s;tuple (s;some (super-class-decl^ imports class-vars))))] + [annotations (annotations^ imports)] + [members (s;some (method-decl^ imports class-vars))]) (let [def-code (format "interface:" (spaced (list (class-decl$ class-decl) (with-brackets (spaced (map super-class-decl$ supers))) @@ -1423,14 +1423,14 @@ (wrap (list (` (;_lux_proc ["jvm" (~ (ast;text def-code))] [])))) )) -(syntax: #export (object {#let [imports (class-imports *compiler*)]} - {#let [class-vars (list)]} - {super (s;default object-super-class - (super-class-decl^ imports class-vars))} - {interfaces (s;default (list) - (s;tuple (s;some (super-class-decl^ imports class-vars))))} - {constructor-args (constructor-args^ imports class-vars)} - {methods (s;some (overriden-method-def^ imports))}) +(syntax: #export (object [#let [imports (class-imports *compiler*)]] + [#let [class-vars (list)]] + [super (s;default object-super-class + (super-class-decl^ imports class-vars))] + [interfaces (s;default (list) + (s;tuple (s;some (super-class-decl^ imports class-vars))))] + [constructor-args (constructor-args^ imports class-vars)] + [methods (s;some (overriden-method-def^ imports))]) {#;doc (doc "Allows defining anonymous classes." "The 1st vector corresponds to parent interfaces." "The 2nd vector corresponds to arguments to the super class constructor." @@ -1505,9 +1505,9 @@ [(#;Right (~ expr)) ;;throwable->text]))))) -(syntax: #export (instance? {#let [imports (class-imports *compiler*)]} - {class (generic-type^ imports (list))} - {obj (s;opt s;any)}) +(syntax: #export (instance? [#let [imports (class-imports *compiler*)]] + [class (generic-type^ imports (list))] + [obj (s;opt s;any)]) {#;doc (doc "Checks whether an object is an instance of a particular class." "Caveat emptor: Can't check for polymorphism, so avoid using parameterized classes." (instance? String "YOLO"))} @@ -1531,7 +1531,7 @@ (finish-the-computation ...))))} (wrap (list (` (;_lux_proc ["jvm" "synchronized"] [(~ lock) (~ body)]))))) -(syntax: #export (do-to obj {methods (s;some partial-call^)}) +(syntax: #export (do-to obj [methods (s;some partial-call^)]) {#;doc (doc "Call a variety of methods on an object; then return the object." (do-to vreq (HttpServerRequest.setExpectMultipart [true]) @@ -1942,13 +1942,13 @@ (#;Left _) (compiler;fail (format "Unknown class: " class-name)))) -(syntax: #export (jvm-import {#let [imports (class-imports *compiler*)]} - {long-name? (s;tag? ["" "long"])} - {class-decl (class-decl^ imports)} - {#let [full-class-name (product;left class-decl) +(syntax: #export (jvm-import [#let [imports (class-imports *compiler*)]] + [long-name? (s;tag? ["" "long"])] + [class-decl (class-decl^ imports)] + [#let [full-class-name (product;left class-decl) imports (add-import [(short-class-name full-class-name) full-class-name] - (class-imports *compiler*))]} - {members (s;some (import-member-decl^ imports (product;right class-decl)))}) + (class-imports *compiler*))]] + [members (s;some (import-member-decl^ imports (product;right class-decl)))]) {#;doc (doc "Allows importing JVM classes, and using them as types." "Their methods, fields and enum options can also be imported." "Also, classes which get imported into a module can also be referred-to with their short names in other macros that require JVM classes." @@ -2000,8 +2000,8 @@ =members (mapM @ (member-import$ (product;right class-decl) long-name? kind class-decl) members)] (wrap (list& (class-import$ long-name? class-decl) (List/join =members))))) -(syntax: #export (array {#let [imports (class-imports *compiler*)]} - {type (generic-type^ imports (list))} +(syntax: #export (array [#let [imports (class-imports *compiler*)]] + [type (generic-type^ imports (list))] size) {#;doc (doc "Create an array of the given type, with the given size." (array Object +10))} @@ -2112,7 +2112,7 @@ (Syntax (List [Text AST])) (s;tuple (s;some (s;seq s;local-symbol s;any)))) -(syntax: #export (with-open {bindings simple-bindings^} body) +(syntax: #export (with-open [bindings simple-bindings^] body) {#;doc (doc "Creates a local-binding with the desired resources, and runs the body (assumed to be in the IO type)." "Afterwards, closes all resources (assumed to be subclasses of java.io.Closeable), and returns the value resulting from running the body." (with-open [my-res1 (res1-constructor ...) @@ -2135,8 +2135,8 @@ (~' #let) [(~ g!_) (exec (~@ (reverse closes)) [])]] ((~' wrap) (~ g!output))))))))) -(syntax: #export (class-for {#let [imports (class-imports *compiler*)]} - {type (generic-type^ imports (list))}) +(syntax: #export (class-for [#let [imports (class-imports *compiler*)]] + [type (generic-type^ imports (list))]) {#;doc (doc "Loads the class a a Class object." (class-for java.lang.String))} (wrap (list (` (;_lux_proc ["jvm" "load-class"] [(~ (ast;text (simple-class$ (list) type)))]))))) diff --git a/stdlib/source/lux/macro.lux b/stdlib/source/lux/macro.lux index 7c192cb2b..b7d93bd86 100644 --- a/stdlib/source/lux/macro.lux +++ b/stdlib/source/lux/macro.lux @@ -16,7 +16,7 @@ (s;tag? ["" "omit"])) (do-template [<macro> <func>] - [(syntax: #export (<macro> {? omit^} token) + [(syntax: #export (<macro> [? omit^] token) (do @ [output (<func> token) #let [_ (List/map (. log! %ast) diff --git a/stdlib/source/lux/macro/poly.lux b/stdlib/source/lux/macro/poly.lux index a2a7dd7d6..0973eece6 100644 --- a/stdlib/source/lux/macro/poly.lux +++ b/stdlib/source/lux/macro/poly.lux @@ -202,7 +202,7 @@ (lambda [:type:] (case (type;un-name :type:) (^=> (#;AppT :quant: :arg:) - {(type;un-alias :quant:) (#;NamedT ["lux" <name>] _)}) + [(type;un-alias :quant:) (#;NamedT ["lux" <name>] _)]) (:: compiler;Monad<Lux> wrap :arg:) _ @@ -257,8 +257,8 @@ (wrap []) (^=> (#;Cons (#;BoundT idx) :parts:') - {(adjusted-idx env idx) - idx'} + [(adjusted-idx env idx) + idx'] (n.= base idx')) (recur (n.inc base) :parts:') @@ -281,17 +281,17 @@ (extend-env (` (#;AppT (~ type-func) (~ tvar))) type-vars') )))) -(syntax: #export (poly: {_ex-lev common;export-level} - {[name env inputs] (s;form ($_ s;seq +(syntax: #export (poly: [_ex-lev common;export-level] + [[name env inputs] (s;form ($_ s;seq s;local-symbol s;local-symbol - (s;many s;local-symbol)))} + (s;many s;local-symbol)))] body) (with-gensyms [g!body] (let [g!inputs (List/map (|>. [""] ast;symbol) inputs) g!name (ast;symbol ["" name]) g!env (ast;symbol ["" env])] - (wrap (;list (` (syntax: (~@ (common;gen-export-level _ex-lev)) ((~ g!name) (~@ (List/map (lambda [g!input] (` {(~ g!input) s;symbol})) + (wrap (;list (` (syntax: (~@ (common;gen-export-level _ex-lev)) ((~ g!name) (~@ (List/map (lambda [g!input] (` [(~ g!input) s;symbol])) g!inputs))) (do Monad<Lux> [(~@ (List/join (List/map (lambda [g!input] (;list g!input (` (compiler;find-type-def (~ g!input))))) @@ -315,10 +315,10 @@ (#;Some (List/fold (text;replace-once "?") poly args)) #;None)) -(syntax: #export (derived: {_ex-lev common;export-level} - {?name (s;opt s;local-symbol)} - {[poly-func poly-args] (s;form (s;seq s;symbol (s;many s;symbol)))} - {?custom-impl (s;opt s;any)}) +(syntax: #export (derived: [_ex-lev common;export-level] + [?name (s;opt s;local-symbol)] + [[poly-func poly-args] (s;form (s;seq s;symbol (s;many s;symbol)))] + [?custom-impl (s;opt s;any)]) (do @ [poly-args (mapM @ compiler;normalize poly-args) name (case ?name @@ -326,8 +326,8 @@ (wrap name) (^=> #;None - {(derivation-name (product;right poly-func) (List/map product;right poly-args)) - (#;Some derived-name)}) + [(derivation-name (product;right poly-func) (List/map product;right poly-args)) + (#;Some derived-name)]) (wrap derived-name) _ diff --git a/stdlib/source/lux/macro/syntax.lux b/stdlib/source/lux/macro/syntax.lux index e2689aeb5..00a2ba96e 100644 --- a/stdlib/source/lux/macro/syntax.lux +++ b/stdlib/source/lux/macro/syntax.lux @@ -439,7 +439,7 @@ (: (-> AST (Lux [AST AST])) (lambda [arg] (case arg - (^ [_ (#;RecordS (list [var parser]))]) + (^ [_ (#;TupleS (list var parser))]) (wrap [var parser]) [_ (#;SymbolS var-name)] diff --git a/stdlib/source/lux/macro/syntax/common.lux b/stdlib/source/lux/macro/syntax/common.lux index 6cec7f713..9d1887b87 100644 --- a/stdlib/source/lux/macro/syntax/common.lux +++ b/stdlib/source/lux/macro/syntax/common.lux @@ -108,10 +108,10 @@ (default (list) (case (list;find (|>. product;left (Ident/= ["lux" "func-args"])) meta-data) (^=> (#;Some [_ value]) - {(s;run (list value) list-meta^) - (#;Right [_ args])} - {(s;run args (s;some text-meta^)) - (#;Right [_ args])}) + [(s;run (list value) list-meta^) + (#;Right [_ args])] + [(s;run args (s;some text-meta^)) + (#;Right [_ args])]) (#;Some args) _ @@ -158,7 +158,7 @@ (def: #export typed-arg (Syntax [Text AST]) - (s;record (s;seq s;local-symbol s;any))) + (s;tuple (s;seq s;local-symbol s;any))) (def: #export type-params (Syntax (List Text)) diff --git a/stdlib/source/lux/macro/template.lux b/stdlib/source/lux/macro/template.lux index 0288f05cf..fe533cae8 100644 --- a/stdlib/source/lux/macro/template.lux +++ b/stdlib/source/lux/macro/template.lux @@ -23,7 +23,7 @@ (-> (Dict Text AST) AST AST) (case template (^=> [_ (#;SymbolS "" name)] - {(dict;get name bindings) (#;Some found)}) + [(dict;get name bindings) (#;Some found)]) found (^template [<tag>] @@ -43,7 +43,7 @@ template )) -(syntax: #export (template: {_ex-lev common;export-level} {[name args] decl^} template) +(syntax: #export (template: [_ex-lev common;export-level] [[name args] decl^] template) (let [bindings (fold (lambda [arg bindings] (dict;put arg (` ((~' ~) (~ (ast;symbol ["" arg])))) bindings)) (: (Dict Text AST) (dict;new text;Hash<Text>)) diff --git a/stdlib/source/lux/math.lux b/stdlib/source/lux/math.lux index 543b2bd0b..110561901 100644 --- a/stdlib/source/lux/math.lux +++ b/stdlib/source/lux/math.lux @@ -152,5 +152,5 @@ (` ((~ op) (~ (infix-to-prefix right)) (~ (infix-to-prefix left)))) )) -(syntax: #export (infix {expr (infix^ [])}) +(syntax: #export (infix [expr (infix^ [])]) (wrap (list (infix-to-prefix expr)))) diff --git a/stdlib/source/lux/math/complex.lux b/stdlib/source/lux/math/complex.lux index 9a2c7c164..abfcd9e0a 100644 --- a/stdlib/source/lux/math/complex.lux +++ b/stdlib/source/lux/math/complex.lux @@ -28,7 +28,7 @@ {#real Real #imaginary Real}) -(syntax: #export (complex real {?imaginary (s;opt s;any)}) +(syntax: #export (complex real [?imaginary (s;opt s;any)]) (wrap (list (` {#;;real (~ real) #;;imaginary (~ (default (` 0.0) ?imaginary))})))) diff --git a/stdlib/source/lux/math/simple.lux b/stdlib/source/lux/math/simple.lux index bb66e1160..31a8bb3ca 100644 --- a/stdlib/source/lux/math/simple.lux +++ b/stdlib/source/lux/math/simple.lux @@ -47,12 +47,12 @@ (wrap raw-type)))) (do-template [<name> <rec> <nat-op> <int-op> <real-op> <frac-op>] - [(syntax: #export (<name> {args ($_ s;alt + [(syntax: #export (<name> [args ($_ s;alt (s;seq s;symbol s;symbol) (s;seq s;any s;any) s;symbol s;any - s;end)}) + s;end)]) (case args (+0 [x y]) (do @ @@ -136,12 +136,12 @@ ) (do-template [<name> <rec> <nat-op> <int-op> <real-op> <frac-op>] - [(syntax: #export (<name> {args ($_ s;alt + [(syntax: #export (<name> [args ($_ s;alt (s;seq s;symbol s;symbol) (s;seq s;any s;any) s;symbol s;any - s;end)}) + s;end)]) (case args (+0 [x y]) (do @ @@ -225,12 +225,12 @@ ) (do-template [<name> <rec> <nat-op> <int-op>] - [(syntax: #export (<name> {args ($_ s;alt + [(syntax: #export (<name> [args ($_ s;alt (s;seq s;symbol s;symbol) (s;seq s;any s;any) s;symbol s;any - s;end)}) + s;end)]) (case args (+0 [x y]) (do @ @@ -291,10 +291,10 @@ ) (do-template [<name> <rec> <nat-op> <int-op>] - [(syntax: #export (<name> {args ($_ s;alt + [(syntax: #export (<name> [args ($_ s;alt s;symbol s;any - s;end)}) + s;end)]) (case args (+0 x) (do @ @@ -332,10 +332,10 @@ ) (do-template [<name> <rec> <nat-op> <int-op>] - [(syntax: #export (<name> {args ($_ s;alt + [(syntax: #export (<name> [args ($_ s;alt s;symbol s;any - s;end)}) + s;end)]) (case args (+0 x) (do @ diff --git a/stdlib/source/lux/pipe.lux b/stdlib/source/lux/pipe.lux index 0d07f5a62..95167f7f2 100644 --- a/stdlib/source/lux/pipe.lux +++ b/stdlib/source/lux/pipe.lux @@ -18,7 +18,7 @@ (Syntax (List AST)) (s;tuple (s;many s;any))) -(syntax: #export (_> {tokens (s;at-least +2 s;any)}) +(syntax: #export (_> [tokens (s;at-least +2 s;any)]) {#;doc (doc "Ignores the piped argument, and begins a new pipe." (|> 20 (i.* 3) @@ -31,7 +31,7 @@ _ (undefined))) -(syntax: #export (@> {body body^} +(syntax: #export (@> [body body^] prev) {#;doc (doc "Gives the name '@' to the piped-argument, within the given expression." (|> 5 @@ -42,8 +42,8 @@ prev body)))) -(syntax: #export (?> {branches (s;many (s;seq body^ body^))} - {?else (s;opt body^)} +(syntax: #export (?> [branches (s;many (s;seq body^ body^))] + [?else (s;opt body^)] prev) {#;doc (doc "Branching for pipes." "Both the tests and the bodies are piped-code, and must be given inside a tuple." @@ -65,7 +65,7 @@ _ g!temp))))))))) -(syntax: #export (!> {test body^} {then body^} prev) +(syntax: #export (!> [test body^] [then body^] prev) {#;doc (doc "Loops for pipes." "Both the testing and calculating steps are pipes and must be given inside tuples." @@ -78,7 +78,7 @@ ((~' recur) (|> (~ g!temp) (~@ then))) (~ g!temp)))))))) -(syntax: #export (%> monad {steps (s;some body^)} prev) +(syntax: #export (%> monad [steps (s;some body^)] prev) {#;doc (doc "Monadic pipes." "Each steps in the monadic computation is a pipe and must be given inside a tuple." (|> 5 @@ -100,7 +100,7 @@ _ (wrap (list prev))))) -(syntax: #export (~> {body body^} prev) +(syntax: #export (~> [body body^] prev) {#;doc (doc "Non-updating pipes." "Will generate piped computations, but their results won't be used in the larger scope." (|> 5 @@ -112,7 +112,7 @@ (exec (|> (~ g!temp) (~@ body)) (~ g!temp)))))))) -(syntax: #export (&> {paths (s;many body^)} prev) +(syntax: #export (&> [paths (s;many body^)] prev) {#;doc (doc "Parallel branching for pipes." "Allows to run multiple pipelines for a value and gives you a tuple of the outputs." (|> 5 @@ -126,7 +126,7 @@ [(~@ (List/map (lambda [body] (` (|> (~ g!temp) (~@ body)))) paths))])))))) -(syntax: #export (case> {branches (s;many (s;seq s;any s;any))} prev) +(syntax: #export (case> [branches (s;many (s;seq s;any s;any))] prev) {#;doc (doc "Pattern-matching for pipes." "The bodies of each branch are NOT pipes; just regular values." (|> 5 diff --git a/stdlib/source/lux/regex.lux b/stdlib/source/lux/regex.lux index 3bcf95106..95599852c 100644 --- a/stdlib/source/lux/regex.lux +++ b/stdlib/source/lux/regex.lux @@ -420,7 +420,7 @@ (:: Monad<Lexer> map product;right (re-alternative^ true re-scoped^ current-module))) ## [Syntax] -(syntax: #export (regex {pattern syntax;text}) +(syntax: #export (regex [pattern syntax;text]) (do @ [current-module compiler;current-module-name] (case (&;run (&;&_ (regex^ current-module) &;end) pattern) diff --git a/stdlib/source/lux/test.lux b/stdlib/source/lux/test.lux index 0d3deb7b9..bb5fe1aad 100644 --- a/stdlib/source/lux/test.lux +++ b/stdlib/source/lux/test.lux @@ -135,7 +135,7 @@ (All [a] (-> [a a] (List a))) (list x y)) -(syntax: #export (test: description {body test^}) +(syntax: #export (test: description [body test^]) {#;doc (doc "Macro for definint tests." (test: "lux/pipe exports" (all (match 1 (|> 20 diff --git a/stdlib/test/test/lux/concurrency/actor.lux b/stdlib/test/test/lux/concurrency/actor.lux index 7940cb22d..c2872796c 100644 --- a/stdlib/test/test/lux/concurrency/actor.lux +++ b/stdlib/test/test/lux/concurrency/actor.lux @@ -18,7 +18,7 @@ (actor: Adder Int - (method: (add! {offset Int}) + (method: (add! [offset Int]) [Int Int] (let [*state*' (i.+ offset *state*)] (wrap (#;Right [*state*' [*state* *state*']])))) diff --git a/stdlib/test/test/lux/data/text.lux b/stdlib/test/test/lux/data/text.lux index e10f23735..f79d730f4 100644 --- a/stdlib/test/test/lux/data/text.lux +++ b/stdlib/test/test/lux/data/text.lux @@ -36,13 +36,13 @@ (assert "" (|> sample (&;at idx) (case> (^=> (#;Some char) - {(char;as-text char) char'} - {[(&;index-of char' sample) + [(char;as-text char) char'] + [[(&;index-of char' sample) (&;last-index-of char' sample) (&;index-of' char' idx sample) (&;last-index-of' char' idx sample)] [(#;Some io) (#;Some lio) - (#;Some io') (#;Some lio')]}) + (#;Some io') (#;Some lio')]]) (and (n.<= idx io) (n.>= idx lio) diff --git a/stdlib/test/test/lux/host.lux b/stdlib/test/test/lux/host.lux index 9cb9dac23..f15963e1d 100644 --- a/stdlib/test/test/lux/host.lux +++ b/stdlib/test/test/lux/host.lux @@ -36,7 +36,7 @@ (#private bar A) (#private baz java.lang.Object) ## Methods - (#public [] (new {value A}) [] + (#public [] (new [value A]) [] (exec (:= .foo true) (:= .bar value) (:= .baz "") |