diff options
author | Eduardo Julian | 2021-05-30 10:57:38 -0400 |
---|---|---|
committer | Eduardo Julian | 2021-05-30 10:57:38 -0400 |
commit | 0415afc6a1cac2cbcb5525d4102021a598bb39cf (patch) | |
tree | 5101861071ad04114e4fdc5d1ef7af342763cc5b /stdlib/source/lux/tool | |
parent | 6e0eb104c7682ea11692ecb66a186898ae6e706f (diff) |
Getting the name of a path is no longer a fundamental File operation.
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/tool/compiler/language/lux/phase/generation/common_lisp/primitive.lux | 6 | ||||
-rw-r--r-- | stdlib/source/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux | 69 |
2 files changed, 37 insertions, 38 deletions
diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/common_lisp/primitive.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/common_lisp/primitive.lux index 7840ccccc..9357156f2 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/common_lisp/primitive.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/common_lisp/primitive.lux @@ -1,11 +1,7 @@ (.module: [lux (#- i64) - [control - [pipe (#+ cond> new>)]] [target - ["_" common_lisp (#+ Expression)]]] - ["." // #_ - ["#." runtime]]) + ["_" common_lisp (#+ Expression)]]]) (def: #export bit (-> Bit (Expression Any)) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux index 73f885ebd..cc50cc49f 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux @@ -13,7 +13,7 @@ ["%" format (#+ format)] ["." encoding]] [collection - ["." list ("#\." functor)] + ["." list ("#\." functor monoid)] ["." row]]] ["." macro [syntax (#+ syntax:)] @@ -157,8 +157,9 @@ ..none)])))) (def: runtime//lux - (_.progn (list @lux//try - @lux//program_args))) + (List (Expression Any)) + (list @lux//try + @lux//program_args)) (def: last_index (|>> _.length/1 [(_.int +1)] _.-/2)) @@ -194,37 +195,35 @@ ## does a linear search, and is thus expensive. (runtime: (sum//get sum wantsLast wantedTag) (with_vars [sum_tag sum_flag] - (let [@exit (_.label "exit") - return! (_.return-from @exit) - no_match! (return! sum) + (let [no_match! (_.return sum) sum_value (_.nth/2 [(_.int +2) sum]) test_recursion! (_.if sum_flag ## Must iterate. (_.progn (list (_.setq wantedTag (_.-/2 [sum_tag wantedTag])) (_.setq sum sum_value))) no_match!)] - (_.progn (list (_.setq sum_tag (_.nth/2 [(_.int +0) sum])) - (_.setq sum_flag (_.nth/2 [(_.int +1) sum])) - (_.block @exit - (list (_.while (_.bool true) - (_.cond (list [(_.=/2 [sum_tag wantedTag]) - (_.if (_.equal/2 [wantsLast sum_flag]) - (return! sum_value) - test_recursion!)] + (_.while (_.bool true) + (_.let (list [sum_tag (_.nth/2 [(_.int +0) sum])] + [sum_flag (_.nth/2 [(_.int +1) sum])]) + (list (_.cond (list [(_.=/2 [sum_tag wantedTag]) + (_.if (_.equal/2 [wantsLast sum_flag]) + (_.return sum_value) + test_recursion!)] - [(_.>/2 [sum_tag wantedTag]) - test_recursion!] + [(_.>/2 [sum_tag wantedTag]) + test_recursion!] - [(_.and (_.</2 [sum_tag wantedTag]) - wantsLast) - (return! (variant' (_.-/2 [wantedTag sum_tag]) sum_flag sum_value))]) + [(_.and (_.</2 [sum_tag wantedTag]) + wantsLast) + (_.return (variant' (_.-/2 [wantedTag sum_tag]) sum_flag sum_value))]) - no_match!))))))))) + no_match!))))))) (def: runtime//adt - (_.progn (list @tuple//left - @tuple//right - @sum//get))) + (List (Expression Any)) + (list @tuple//left + @tuple//right + @sum//get)) (runtime: (i64//right_shift shift input) (_.if (_.=/2 [(_.int +0) shift]) @@ -238,7 +237,8 @@ [mask] _.logand/2)))) (def: runtime//i64 - @i64//right_shift) + (List (Expression Any)) + (list @i64//right_shift)) (runtime: (text//clip offset length text) (_.subseq/3 [text offset (_.+/2 [offset length])])) @@ -251,8 +251,9 @@ ..none))))) (def: runtime//text - (_.progn (list @text//index - @text//clip))) + (List (Expression Any)) + (list @text//index + @text//clip)) (runtime: (io//exit code) (_.progn (list (_.conditional+ (list "sbcl") @@ -270,15 +271,17 @@ (_.get-universal-time/0 [])])) (def: runtime//io - (_.progn (list @io//exit - @io//current_time))) + (List (Expression Any)) + (list @io//exit + @io//current_time)) (def: runtime - (_.progn (list runtime//adt - runtime//lux - runtime//i64 - runtime//text - runtime//io))) + (_.progn ($_ list\compose + runtime//adt + runtime//lux + runtime//i64 + runtime//text + runtime//io))) (def: #export generate (Operation [Registry Output]) |