diff options
author | Eduardo Julian | 2017-04-10 23:09:48 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-04-10 23:09:48 -0400 |
commit | 6066515f7a9736210a04652636a634179939d185 (patch) | |
tree | c01c525654e68afd248c1d18f45bac248108a67d | |
parent | 693466dec80764358acea002f0ccfd5f0de17300 (diff) |
- Renamed _lux_lambda to _lux_function.
Diffstat (limited to '')
-rw-r--r-- | luxc/src/lux/analyser.clj | 4 | ||||
-rw-r--r-- | luxc/src/lux/analyser/base.clj | 16 | ||||
-rw-r--r-- | luxc/src/lux/analyser/function.clj (renamed from luxc/src/lux/analyser/lambda.clj) | 4 | ||||
-rw-r--r-- | luxc/src/lux/analyser/lux.clj | 36 | ||||
-rw-r--r-- | luxc/src/lux/analyser/proc/jvm.clj | 1 | ||||
-rw-r--r-- | luxc/src/lux/compiler/jvm.clj | 4 | ||||
-rw-r--r-- | luxc/src/lux/compiler/jvm/function.clj (renamed from luxc/src/lux/compiler/jvm/lambda.clj) | 48 | ||||
-rw-r--r-- | luxc/src/lux/compiler/jvm/lux.clj | 4 | ||||
-rw-r--r-- | luxc/src/lux/optimizer.clj | 4 | ||||
-rw-r--r-- | stdlib/source/lux.lux | 144 | ||||
-rw-r--r-- | stdlib/source/lux/io.lux | 2 |
11 files changed, 133 insertions, 134 deletions
diff --git a/luxc/src/lux/analyser.clj b/luxc/src/lux/analyser.clj index 4090cfea8..c47eaddfa 100644 --- a/luxc/src/lux/analyser.clj +++ b/luxc/src/lux/analyser.clj @@ -119,13 +119,13 @@ (&/with-analysis-meta cursor exo-type (&&lux/analyse-case analyse exo-type ?value ?branches))) - "_lux_lambda" + "_lux_function" (|let [(&/$Cons [_ (&/$SymbolS "" ?self)] (&/$Cons [_ (&/$SymbolS "" ?arg)] (&/$Cons ?body (&/$Nil)))) parameters] (&/with-analysis-meta cursor exo-type - (&&lux/analyse-lambda analyse exo-type ?self ?arg ?body))) + (&&lux/analyse-function analyse exo-type ?self ?arg ?body))) "_lux_proc" (|let [(&/$Cons [_ (&/$TupleS (&/$Cons [_ (&/$TextS ?category)] diff --git a/luxc/src/lux/analyser/base.clj b/luxc/src/lux/analyser/base.clj index f4718a67e..46eafa051 100644 --- a/luxc/src/lux/analyser/base.clj +++ b/luxc/src/lux/analyser/base.clj @@ -17,7 +17,7 @@ ("tuple" 1) ("apply" 2) ("case" 2) - ("lambda" 4) + ("function" 4) ("ann" 2) ("var" 1) ("captured" 1) @@ -104,13 +104,13 @@ (&/T [_pattern (de-meta _body)]))) branches)) - ($lambda _register-offset scope captured body) - ($lambda _register-offset scope - (&/|map (fn [branch] - (|let [[_name _captured] branch] - (&/T [_name (de-meta _captured)]))) - captured) - (de-meta body)) + ($function _register-offset scope captured body) + ($function _register-offset scope + (&/|map (fn [branch] + (|let [[_name _captured] branch] + (&/T [_name (de-meta _captured)]))) + captured) + (de-meta body)) ($ann value-expr type-expr) (de-meta value-expr) diff --git a/luxc/src/lux/analyser/lambda.clj b/luxc/src/lux/analyser/function.clj index fdea7521a..aaaaed9f9 100644 --- a/luxc/src/lux/analyser/lambda.clj +++ b/luxc/src/lux/analyser/function.clj @@ -1,4 +1,4 @@ -(ns lux.analyser.lambda +(ns lux.analyser.function (:require clojure.core.match clojure.core.match.array (lux [base :as & :refer [|let |do return |case]] @@ -7,7 +7,7 @@ [env :as &env]))) ;; [Resource] -(defn with-lambda [self self-type arg arg-type body] +(defn with-function [self self-type arg arg-type body] (&/with-closure (|do [scope-name &/get-scope-name] (&env/with-local self self-type diff --git a/luxc/src/lux/analyser/lux.clj b/luxc/src/lux/analyser/lux.clj index 989ccb591..04ef66683 100644 --- a/luxc/src/lux/analyser/lux.clj +++ b/luxc/src/lux/analyser/lux.clj @@ -8,7 +8,7 @@ [type :as &type] [host :as &host]) (lux.analyser [base :as &&] - [lambda :as &&lambda] + [function :as &&function] [case :as &&case] [env :as &&env] [module :as &&module] @@ -302,7 +302,7 @@ (|let [scopes (&/|map #(&/get$ &/$name %) (&/|reverse inner)) [=local inner*] (&/fold2 (fn [register+new-inner frame in-scope] (|let [[register new-inner] register+new-inner - [register* frame*] (&&lambda/close-over in-scope name register frame)] + [register* frame*] (&&function/close-over in-scope name register frame)] (&/T [register* (&/$Cons frame* new-inner)]))) (&/T [(or (->> bottom-outer (&/get$ &/$locals) (&/get$ &/$mappings) (&/|get name)) (->> bottom-outer (&/get$ &/$closure) (&/get$ &/$mappings) (&/|get name))) @@ -464,25 +464,25 @@ =func** (&type/clean $output =func*)] (return =func**)))) -(defn analyse-lambda* [analyse exo-type ?self ?arg ?body] +(defn analyse-function* [analyse exo-type ?self ?arg ?body] (|case exo-type (&/$VarT id) (|do [? (&type/bound? id)] (if ? (|do [exo-type* (&type/deref id)] - (analyse-lambda* analyse exo-type* ?self ?arg ?body)) + (analyse-function* analyse exo-type* ?self ?arg ?body)) ;; Inference (&type/with-var (fn [$input] (&type/with-var (fn [$output] - (|do [[[lambda-type lambda-cursor] lambda-analysis] (analyse-lambda* analyse (&/$LambdaT $input $output) ?self ?arg ?body) + (|do [[[function-type function-cursor] function-analysis] (analyse-function* analyse (&/$LambdaT $input $output) ?self ?arg ?body) =input (&type/resolve-type $input) =output (&type/resolve-type $output) inferred-type (clean-func-inference $input $output =input (embed-inferred-input =input =output)) _ (&type/check exo-type inferred-type)] - (return (&&/|meta inferred-type lambda-cursor - lambda-analysis))) + (return (&&/|meta inferred-type function-cursor + function-analysis))) )))))) _ @@ -494,23 +494,23 @@ :let [(&/$ExT $var-id) $var] exo-type** (&type/apply-type exo-type* $var)] (&/with-scope-type-var $var-id - (analyse-lambda* analyse exo-type** ?self ?arg ?body))) + (analyse-function* analyse exo-type** ?self ?arg ?body))) (&/$ExQ _) (&type/with-var (fn [$var] (|do [exo-type** (&type/apply-type exo-type* $var) - =expr (analyse-lambda* analyse exo-type** ?self ?arg ?body)] + =expr (analyse-function* analyse exo-type** ?self ?arg ?body)] (&&/clean-analysis $var =expr)))) (&/$LambdaT ?arg-t ?return-t) - (|do [[=scope =captured =body] (&&lambda/with-lambda ?self exo-type* + (|do [[=scope =captured =body] (&&function/with-function ?self exo-type* ?arg ?arg-t (&&/analyse-1 analyse ?return-t ?body)) _cursor &/cursor register-offset &&env/next-local-idx] (return (&&/|meta exo-type* _cursor - (&&/$lambda register-offset =scope =captured =body)))) + (&&/$function register-offset =scope =captured =body)))) _ (&/fail ""))) @@ -518,14 +518,14 @@ (&/fail-with-loc (str err "\n" "[Analyser Error] Functions require function types: " (&type/show-type exo-type))))) )) -(defn analyse-lambda** [analyse exo-type ?self ?arg ?body] +(defn analyse-function** [analyse exo-type ?self ?arg ?body] (|case exo-type (&/$UnivQ _) (|do [$var &type/existential :let [(&/$ExT $var-id) $var] exo-type* (&type/apply-type exo-type $var) [_ _expr] (&/with-scope-type-var $var-id - (analyse-lambda** analyse exo-type* ?self ?arg ?body)) + (analyse-function** analyse exo-type* ?self ?arg ?body)) _cursor &/cursor] (return (&&/|meta exo-type _cursor _expr))) @@ -533,17 +533,17 @@ (|do [? (&type/bound? id)] (if ? (|do [exo-type* (&type/actual-type exo-type)] - (analyse-lambda* analyse exo-type* ?self ?arg ?body)) + (analyse-function* analyse exo-type* ?self ?arg ?body)) ;; Inference - (analyse-lambda* analyse exo-type ?self ?arg ?body))) + (analyse-function* analyse exo-type ?self ?arg ?body))) _ (|do [exo-type* (&type/actual-type exo-type)] - (analyse-lambda* analyse exo-type* ?self ?arg ?body)) + (analyse-function* analyse exo-type* ?self ?arg ?body)) )) -(defn analyse-lambda [analyse exo-type ?self ?arg ?body] - (|do [output (analyse-lambda** analyse exo-type ?self ?arg ?body)] +(defn analyse-function [analyse exo-type ?self ?arg ?body] + (|do [output (analyse-function** analyse exo-type ?self ?arg ?body)] (return (&/|list output)))) (defn analyse-def [analyse optimize eval! compile-def ?name ?value ?meta] diff --git a/luxc/src/lux/analyser/proc/jvm.clj b/luxc/src/lux/analyser/proc/jvm.clj index ec14aabb0..3fc3e2e8c 100644 --- a/luxc/src/lux/analyser/proc/jvm.clj +++ b/luxc/src/lux/analyser/proc/jvm.clj @@ -12,7 +12,6 @@ [lux.type.host :as &host-type] [lux.host.generics :as &host-generics] (lux.analyser [base :as &&] - [lambda :as &&lambda] [env :as &&env] [parser :as &&a-parser]) [lux.compiler.jvm.base :as &c!base]) diff --git a/luxc/src/lux/compiler/jvm.clj b/luxc/src/lux/compiler/jvm.clj index 150ec54f4..b612c9f35 100644 --- a/luxc/src/lux/compiler/jvm.clj +++ b/luxc/src/lux/compiler/jvm.clj @@ -24,7 +24,7 @@ (lux.compiler.jvm [base :as &&] [lux :as &&lux] [case :as &&case] - [lambda :as &&lambda] + [function :as &&function] [rt :as &&rt] [cache :as &&jvm-cache]) (lux.compiler.jvm.proc [common :as &&proc-common] @@ -105,7 +105,7 @@ (&&lux/compile-if (partial compile-expression $begin) _test _then _else) (&o/$function _register-offset ?arity ?scope ?env ?body) - (&&lambda/compile-function compile-expression &/$None ?arity ?scope ?env ?body) + (&&function/compile-function compile-expression &/$None ?arity ?scope ?env ?body) (&o/$ann ?value-ex ?type-ex) (compile-expression $begin ?value-ex) diff --git a/luxc/src/lux/compiler/jvm/lambda.clj b/luxc/src/lux/compiler/jvm/function.clj index 87d977012..83c1fb95c 100644 --- a/luxc/src/lux/compiler/jvm/lambda.clj +++ b/luxc/src/lux/compiler/jvm/function.clj @@ -1,4 +1,4 @@ -(ns lux.compiler.jvm.lambda +(ns lux.compiler.jvm.function (:require (clojure [string :as string] [set :as set] [template :refer [do-template]]) @@ -21,7 +21,7 @@ ;; [Utils] (def ^:private field-sig (&host-generics/->type-signature "java.lang.Object")) -(def ^:private lambda-return-sig (&host-generics/->type-signature "java.lang.Object")) +(def ^:private function-return-sig (&host-generics/->type-signature "java.lang.Object")) (def ^:private <init>-return "V") (defn ^:private ^String reset-signature [function-class] @@ -67,10 +67,10 @@ (-> (consecutive-applys (+ start &&/num-apply-variants) (- amount &&/num-apply-variants)) (->> (when (> amount &&/num-apply-variants))))))) -(defn ^:private lambda-impl-signature [arity] - (str "(" (&/fold str "" (&/|repeat arity field-sig)) ")" lambda-return-sig)) +(defn ^:private function-impl-signature [arity] + (str "(" (&/fold str "" (&/|repeat arity field-sig)) ")" function-return-sig)) -(defn ^:private lambda-<init>-signature [env arity] +(defn ^:private function-<init>-signature [env arity] (if (> arity 1) (str "(" (&/fold str "" (&/|repeat (&/|length env) field-sig)) "I" (&/fold str "" (&/|repeat (dec arity) field-sig)) ")" <init>-return) @@ -86,9 +86,9 @@ (.visitVarInsn Opcodes/ILOAD (inc closure-length)) (.visitMethodInsn Opcodes/INVOKESPECIAL &&/function-class "<init>" "(I)V")))) -(defn ^:private add-lambda-<init> [^ClassWriter class class-name arity env] +(defn ^:private add-function-<init> [^ClassWriter class class-name arity env] (let [closure-length (&/|length env)] - (doto (.visitMethod class Opcodes/ACC_PUBLIC "<init>" (lambda-<init>-signature env arity) nil nil) + (doto (.visitMethod class Opcodes/ACC_PUBLIC "<init>" (function-<init>-signature env arity) nil nil) (.visitCode) ;; Do normal object initialization (.visitVarInsn Opcodes/ALOAD 0) @@ -107,9 +107,9 @@ (.visitEnd)))) (let [impl-flags (+ Opcodes/ACC_PUBLIC Opcodes/ACC_FINAL)] - (defn ^:private add-lambda-impl [^ClassWriter class class-name compile arity impl-body] + (defn ^:private add-function-impl [^ClassWriter class class-name compile arity impl-body] (let [$begin (new Label)] - (&/with-writer (doto (.visitMethod class impl-flags "impl" (lambda-impl-signature arity) nil nil) + (&/with-writer (doto (.visitMethod class impl-flags "impl" (function-impl-signature arity) nil nil) (.visitCode) (.visitLabel $begin)) (|do [^MethodVisitor *writer* &/get-writer @@ -120,10 +120,10 @@ (.visitEnd))]] (return ret)))))) -(defn ^:private instance-closure [compile lambda-class arity closed-over] +(defn ^:private instance-closure [compile function-class arity closed-over] (|do [^MethodVisitor *writer* &/get-writer :let [_ (doto *writer* - (.visitTypeInsn Opcodes/NEW lambda-class) + (.visitTypeInsn Opcodes/NEW function-class) (.visitInsn Opcodes/DUP))] _ (&/map% (fn [?name+?captured] (|case ?name+?captured @@ -134,10 +134,10 @@ (doto *writer* (.visitLdcInsn (int 0)) (fill-nulls! (dec arity))))] - :let [_ (.visitMethodInsn *writer* Opcodes/INVOKESPECIAL lambda-class "<init>" (lambda-<init>-signature closed-over arity))]] + :let [_ (.visitMethodInsn *writer* Opcodes/INVOKESPECIAL function-class "<init>" (function-<init>-signature closed-over arity))]] (return nil))) -(defn ^:private add-lambda-reset [^ClassWriter class-writer class-name arity env] +(defn ^:private add-function-reset [^ClassWriter class-writer class-name arity env] (if (> arity 1) (doto (.visitMethod class-writer Opcodes/ACC_PUBLIC "reset" (reset-signature class-name) nil nil) (.visitCode) @@ -147,7 +147,7 @@ (->> (dotimes [cidx (&/|length env)]))) (.visitLdcInsn (int 0)) (fill-nulls! (dec arity)) - (.visitMethodInsn Opcodes/INVOKESPECIAL class-name "<init>" (lambda-<init>-signature env arity)) + (.visitMethodInsn Opcodes/INVOKESPECIAL class-name "<init>" (function-<init>-signature env arity)) (.visitInsn Opcodes/ARETURN) (.visitMaxs 0 0) (.visitEnd)) @@ -158,7 +158,7 @@ (.visitMaxs 0 0) (.visitEnd)))) -(defn ^:private add-lambda-apply-n [^ClassWriter class-writer +degree+ class-name arity env compile impl-body] +(defn ^:private add-function-apply-n [^ClassWriter class-writer +degree+ class-name arity env compile impl-body] (if (> arity 1) (let [num-partials (dec arity) $default (new Label) @@ -185,7 +185,7 @@ (->> (dotimes [idx stage]))) (consecutive-args 1 +degree+) (fill-nulls! (- (- num-partials +degree+) stage)) - (.visitMethodInsn Opcodes/INVOKESPECIAL class-name "<init>" (lambda-<init>-signature env arity)) + (.visitMethodInsn Opcodes/INVOKESPECIAL class-name "<init>" (function-<init>-signature env arity)) (.visitJumpInsn Opcodes/GOTO $end)) (->> (cond (= stage arity-over-extent) (doto method-writer @@ -196,7 +196,7 @@ (-> (get-field! class-name (str &&/partial-prefix idx)) (->> (dotimes [idx stage]))) (consecutive-args 1 +degree+) - (.visitMethodInsn Opcodes/INVOKEVIRTUAL class-name "impl" (lambda-impl-signature arity)) + (.visitMethodInsn Opcodes/INVOKEVIRTUAL class-name "impl" (function-impl-signature arity)) (.visitJumpInsn Opcodes/GOTO $end)) (> stage arity-over-extent) @@ -209,7 +209,7 @@ (-> (get-field! class-name (str &&/partial-prefix idx)) (->> (dotimes [idx stage]))) (consecutive-args 1 args-to-completion) - (.visitMethodInsn Opcodes/INVOKEVIRTUAL class-name "impl" (lambda-impl-signature arity)) + (.visitMethodInsn Opcodes/INVOKEVIRTUAL class-name "impl" (function-impl-signature arity)) (consecutive-applys (+ 1 args-to-completion) args-left) (.visitJumpInsn Opcodes/GOTO $end))) @@ -234,7 +234,7 @@ )) ;; [Exports] -(let [lambda-flags (+ Opcodes/ACC_PUBLIC Opcodes/ACC_FINAL Opcodes/ACC_SUPER) +(let [function-flags (+ Opcodes/ACC_PUBLIC Opcodes/ACC_FINAL Opcodes/ACC_SUPER) datum-flags (+ Opcodes/ACC_PRIVATE Opcodes/ACC_FINAL)] (defn compile-function [compile ?prev-writer arity ?scope ?env ?body] (|do [[file-name _ _] &/cursor @@ -247,7 +247,7 @@ (&/$None) (&/T [(doto (new ClassWriter ClassWriter/COMPUTE_MAXS) - (.visit &host/bytecode-version lambda-flags + (.visit &host/bytecode-version function-flags class-name nil &&/function-class (into-array String []))) true])) _ (doto =class @@ -264,13 +264,13 @@ (->> (dotimes [idx (dec arity)]))) (-> (.visitSource file-name nil) (when save?)) - (add-lambda-<init> class-name arity ?env) - (add-lambda-reset class-name arity ?env) + (add-function-<init> class-name arity ?env) + (add-function-reset class-name arity ?env) )] _ (if (> arity 1) - (add-lambda-impl =class class-name compile arity ?body) + (add-function-impl =class class-name compile arity ?body) (return nil)) - _ (&/map% #(add-lambda-apply-n =class % class-name arity ?env compile ?body) + _ (&/map% #(add-function-apply-n =class % class-name arity ?env compile ?body) (&/|range* 1 (min arity &&/num-apply-variants))) :let [_ (.visitEnd =class)] _ (if save? diff --git a/luxc/src/lux/compiler/jvm/lux.clj b/luxc/src/lux/compiler/jvm/lux.clj index e14615946..882c9b74c 100644 --- a/luxc/src/lux/compiler/jvm/lux.clj +++ b/luxc/src/lux/compiler/jvm/lux.clj @@ -16,7 +16,7 @@ [module :as &a-module] [meta :as &a-meta]) (lux.compiler.jvm [base :as &&] - [lambda :as &&lambda])) + [function :as &&function])) (:import (org.objectweb.asm Opcodes Label ClassWriter @@ -286,7 +286,7 @@ (-> (.visitField field-flags &/value-field datum-sig nil nil) (doto (.visitEnd))) (.visitSource file-name nil))] - instancer (&&lambda/compile-function compile (&/$Some =class) _arity _scope _captured ?body+) + instancer (&&function/compile-function compile (&/$Some =class) _arity _scope _captured ?body+) _ (&/with-writer (.visitMethod =class Opcodes/ACC_STATIC "<clinit>" "()V" nil nil) (|do [^MethodVisitor **writer** &/get-writer :let [_ (.visitCode **writer**)] diff --git a/luxc/src/lux/optimizer.clj b/luxc/src/lux/optimizer.clj index 9fc50646e..36caf3362 100644 --- a/luxc/src/lux/optimizer.clj +++ b/luxc/src/lux/optimizer.clj @@ -1142,9 +1142,9 @@ _ (normal-case-optim))) - (&a/$lambda _register-offset scope captured body) + (&a/$function _register-offset scope captured body) (|let [inner-func? (|case body - [_ (&a/$lambda _ _ _ _)] + [_ (&a/$function _ _ _ _)] true _ diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index 4d5885393..bb66813cc 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -676,8 +676,8 @@ (_lux_: (#LambdaT (#AppT AST' (#AppT Meta Cursor)) AST) - (_lux_lambda _ data - [_cursor data])) + (_lux_function _ data + [_cursor data])) #Nil) (_lux_def return @@ -687,9 +687,9 @@ (#AppT (#AppT Either Text) (#ProdT Compiler (#BoundT +1)))))) - (_lux_lambda _ val - (_lux_lambda _ state - (#Right state val)))) + (_lux_function _ val + (_lux_function _ state + (#Right state val)))) #Nil) (_lux_def fail @@ -699,69 +699,69 @@ (#AppT (#AppT Either Text) (#ProdT Compiler (#BoundT +1)))))) - (_lux_lambda _ msg - (_lux_lambda _ state - (#Left msg)))) + (_lux_function _ msg + (_lux_function _ state + (#Left msg)))) #Nil) (_lux_def bool$ (_lux_: (#LambdaT Bool AST) - (_lux_lambda _ value (_meta (#BoolS value)))) + (_lux_function _ value (_meta (#BoolS value)))) #Nil) (_lux_def nat$ (_lux_: (#LambdaT Nat AST) - (_lux_lambda _ value (_meta (#NatS value)))) + (_lux_function _ value (_meta (#NatS value)))) #Nil) (_lux_def int$ (_lux_: (#LambdaT Int AST) - (_lux_lambda _ value (_meta (#IntS value)))) + (_lux_function _ value (_meta (#IntS value)))) #Nil) (_lux_def deg$ (_lux_: (#LambdaT Deg AST) - (_lux_lambda _ value (_meta (#DegS value)))) + (_lux_function _ value (_meta (#DegS value)))) #Nil) (_lux_def real$ (_lux_: (#LambdaT Real AST) - (_lux_lambda _ value (_meta (#RealS value)))) + (_lux_function _ value (_meta (#RealS value)))) #Nil) (_lux_def char$ (_lux_: (#LambdaT Char AST) - (_lux_lambda _ value (_meta (#CharS value)))) + (_lux_function _ value (_meta (#CharS value)))) #Nil) (_lux_def text$ (_lux_: (#LambdaT Text AST) - (_lux_lambda _ text (_meta (#TextS text)))) + (_lux_function _ text (_meta (#TextS text)))) #Nil) (_lux_def symbol$ (_lux_: (#LambdaT Ident AST) - (_lux_lambda _ ident (_meta (#SymbolS ident)))) + (_lux_function _ ident (_meta (#SymbolS ident)))) #Nil) (_lux_def tag$ (_lux_: (#LambdaT Ident AST) - (_lux_lambda _ ident (_meta (#TagS ident)))) + (_lux_function _ ident (_meta (#TagS ident)))) #Nil) (_lux_def form$ (_lux_: (#LambdaT (#AppT List AST) AST) - (_lux_lambda _ tokens (_meta (#FormS tokens)))) + (_lux_function _ tokens (_meta (#FormS tokens)))) #Nil) (_lux_def tuple$ (_lux_: (#LambdaT (#AppT List AST) AST) - (_lux_lambda _ tokens (_meta (#TupleS tokens)))) + (_lux_function _ tokens (_meta (#TupleS tokens)))) #Nil) (_lux_def record$ (_lux_: (#LambdaT (#AppT List (#ProdT AST AST)) AST) - (_lux_lambda _ tokens (_meta (#RecordS tokens)))) + (_lux_function _ tokens (_meta (#RecordS tokens)))) #Nil) (_lux_def default-macro-meta @@ -772,53 +772,53 @@ (_lux_def let'' (_lux_: Macro - (_lux_lambda _ tokens - (_lux_case tokens - (#Cons lhs (#Cons rhs (#Cons body #Nil))) - (return (#Cons (form$ (#Cons (symbol$ ["" "_lux_case"]) - (#Cons rhs (#Cons lhs (#Cons body #Nil))))) - #Nil)) + (_lux_function _ tokens + (_lux_case tokens + (#Cons lhs (#Cons rhs (#Cons body #Nil))) + (return (#Cons (form$ (#Cons (symbol$ ["" "_lux_case"]) + (#Cons rhs (#Cons lhs (#Cons body #Nil))))) + #Nil)) - _ - (fail "Wrong syntax for let''")))) + _ + (fail "Wrong syntax for let''")))) default-macro-meta) (_lux_def function'' (_lux_: Macro - (_lux_lambda _ tokens - (_lux_case tokens - (#Cons [_ (#TupleS (#Cons arg args'))] (#Cons body #Nil)) - (return (#Cons (_meta (#FormS (#Cons (_meta (#SymbolS "" "_lux_lambda")) - (#Cons (_meta (#SymbolS "" "")) - (#Cons arg - (#Cons (_lux_case args' - #Nil - body - - _ - (_meta (#FormS (#Cons (_meta (#SymbolS "lux" "function''")) - (#Cons (_meta (#TupleS args')) - (#Cons body #Nil)))))) - #Nil)))))) - #Nil)) - - (#Cons [_ (#SymbolS "" self)] (#Cons [_ (#TupleS (#Cons arg args'))] (#Cons body #Nil))) - (return (#Cons (_meta (#FormS (#Cons (_meta (#SymbolS "" "_lux_lambda")) - (#Cons (_meta (#SymbolS "" self)) - (#Cons arg - (#Cons (_lux_case args' - #Nil - body - - _ - (_meta (#FormS (#Cons (_meta (#SymbolS "lux" "function''")) - (#Cons (_meta (#TupleS args')) - (#Cons body #Nil)))))) - #Nil)))))) - #Nil)) - - _ - (fail "Wrong syntax for function''")))) + (_lux_function _ tokens + (_lux_case tokens + (#Cons [_ (#TupleS (#Cons arg args'))] (#Cons body #Nil)) + (return (#Cons (_meta (#FormS (#Cons (_meta (#SymbolS "" "_lux_function")) + (#Cons (_meta (#SymbolS "" "")) + (#Cons arg + (#Cons (_lux_case args' + #Nil + body + + _ + (_meta (#FormS (#Cons (_meta (#SymbolS "lux" "function''")) + (#Cons (_meta (#TupleS args')) + (#Cons body #Nil)))))) + #Nil)))))) + #Nil)) + + (#Cons [_ (#SymbolS "" self)] (#Cons [_ (#TupleS (#Cons arg args'))] (#Cons body #Nil))) + (return (#Cons (_meta (#FormS (#Cons (_meta (#SymbolS "" "_lux_function")) + (#Cons (_meta (#SymbolS "" self)) + (#Cons arg + (#Cons (_lux_case args' + #Nil + body + + _ + (_meta (#FormS (#Cons (_meta (#SymbolS "lux" "function''")) + (#Cons (_meta (#TupleS args')) + (#Cons body #Nil)))))) + #Nil)))))) + #Nil)) + + _ + (fail "Wrong syntax for function''")))) default-macro-meta) (_lux_def export?-meta @@ -1338,11 +1338,11 @@ (fail "function' requires a non-empty arguments tuple.") (#Cons [harg targs]) - (return (list (form$ (list (symbol$ ["" "_lux_lambda"]) + (return (list (form$ (list (symbol$ ["" "_lux_function"]) (symbol$ ["" name]) harg (fold (function'' [arg body'] - (form$ (list (symbol$ ["" "_lux_lambda"]) + (form$ (list (symbol$ ["" "_lux_function"]) (symbol$ ["" ""]) arg body'))) @@ -1584,7 +1584,7 @@ _ (form$ (list g!bind - (form$ (list (symbol$ ["" "_lux_lambda"]) (symbol$ ["" ""]) var body')) + (form$ (list (symbol$ ["" "_lux_function"]) (symbol$ ["" ""]) var body')) value)))))) body (reverse (as-pairs bindings)))] @@ -1876,7 +1876,7 @@ (list [["lux" "doc"] (#TextA "## Hygienic quasi-quotation as a macro. Unquote (~) and unquote-splice (~@) must also be used as forms. ## All unprefixed macros will receive their parent module's prefix if imported; otherwise will receive the prefix of the module on which the quasi-quote is being used. (` (def: (~ name) - (lambda [(~@ args)] + (function [(~@ args)] (~ body))))")]) (_lux_case tokens (#Cons template #Nil) @@ -1891,7 +1891,7 @@ (macro:' #export (`' tokens) (list [["lux" "doc"] (#TextA "## Unhygienic quasi-quotation as a macro. Unquote (~) and unquote-splice (~@) must also be used as forms. (`' (def: (~ name) - (lambda [(~@ args)] + (function [(~@ args)] (~ body))))")]) (_lux_case tokens (#Cons template #Nil) @@ -2912,14 +2912,14 @@ body+ (fold (: (-> AST AST AST) (function' [arg body'] (if (symbol? arg) - (` (;_lux_lambda (~ g!blank) (~ arg) (~ body'))) - (` (;_lux_lambda (~ g!blank) (~ g!blank) - (case (~ g!blank) (~ arg) (~ body'))))))) + (` (;_lux_function (~ g!blank) (~ arg) (~ body'))) + (` (;_lux_function (~ g!blank) (~ g!blank) + (case (~ g!blank) (~ arg) (~ body'))))))) body (reverse tail))] (return (list (if (symbol? head) - (` (;_lux_lambda (~ g!name) (~ head) (~ body+))) - (` (;_lux_lambda (~ g!name) (~ g!blank) (case (~ g!blank) (~ head) (~ body+)))))))) + (` (;_lux_function (~ g!name) (~ head) (~ body+))) + (` (;_lux_function (~ g!name) (~ g!blank) (case (~ g!blank) (~ head) (~ body+)))))))) #None (fail "Wrong syntax for function"))) diff --git a/stdlib/source/lux/io.lux b/stdlib/source/lux/io.lux index 8a9e6bb9e..4fcb2a506 100644 --- a/stdlib/source/lux/io.lux +++ b/stdlib/source/lux/io.lux @@ -20,7 +20,7 @@ (case tokens (^ (list value)) (let [blank (: AST [["" +0 +0] (#;SymbolS ["" ""])])] - (#;Right [state (list (` (;_lux_lambda (~ blank) (~ blank) (~ value))))])) + (#;Right [state (list (` (;_lux_function (~ blank) (~ blank) (~ value))))])) _ (#;Left "Wrong syntax for io"))) |