Skip to content

Commit

Permalink
Can now use nested directories as compilation targets.
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoejp committed Oct 28, 2023
1 parent c223894 commit 9f32a08
Show file tree
Hide file tree
Showing 29 changed files with 533 additions and 287 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ aedifex.jar
/lux-lein/RELEASE
/lux-lein/target

/stdlib/target_*
/stdlib/target/*

/lux-jvm/RELEASE
/lux-jvm/target
Expand Down
4 changes: 4 additions & 0 deletions documentation/bookmark/crime.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Reference

0. [How Counterfeit Money Actually Works | How Crime Works | Insider](https://www.youtube.com/watch?v=FGAVpJfG1yQ)

4 changes: 4 additions & 0 deletions documentation/bookmark/database/pagination.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Reference

0. [Pagination with Relative Cursors](https://shopify.engineering/pagination-relative-cursors)

1 change: 1 addition & 0 deletions documentation/bookmark/math/probability.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Reference

0. [How to Learn Probability Distributions](https://www.youtube.com/watch?v=mBCiKUzwdMs)
0. [Probability theory does not extend logic](https://metarationality.com/probability-and-logic)

4 changes: 4 additions & 0 deletions documentation/bookmark/play/game/grid/hexagonal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Reference

0. [Hexagonal Grids](https://www.redblobgames.com/grids/hexagons/)

4 changes: 4 additions & 0 deletions documentation/bookmark/tool/version_control/git.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Reference

0. [Retcon: Read-write history](https://retcon.app/)

8 changes: 6 additions & 2 deletions lux-js/commands.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# Develop
```
cd ~/lux/lux-js/ \
&& lux clean \
&& lux with js clean \
&& lux with js auto build
cd ~/lux/lux-js/ \
&& lux clean \
&& lux with stable clean \
&& lux with stable auto build
cd ~/lux/lux-js/ \
&& lux with jvm clean \
&& lux with jvm auto build
```

Expand Down
3 changes: 3 additions & 0 deletions lux-js/project.lux
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
"js"
["lux" ["com.github.luxlang" "lux-js" "0.9.0-SNAPSHOT" "js"]]

"stable"
["lux" ["com.github.luxlang" "lux-js" "0.8.0" "js"]]

"jvm"
["lux" ["com.github.luxlang" "lux-jvm" "0.9.0-SNAPSHOT" "jar"]
"dependencies" [["com.github.luxlang" "lux-jvm-function" "0.6.5" "jar"]
Expand Down
2 changes: 1 addition & 1 deletion lux-ruby/source/program.lux
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@
custom)
@global (_.global global)]
(do try.monad
[.let [definition (_.set (list @global) input)]
[.let [definition (_.statement (_.set (list @global) input))]
value (value definition)]
(in [global value definition]))))

Expand Down
8 changes: 7 additions & 1 deletion stdlib/project.lux
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@
... The following are alternative profiles to use in various situations.
"jvm"
[... "lux" specifies the dependency to fetch and use as the compiler.
"lux" ["com.github.luxlang" "lux-jvm" "0.8.0" "jar"]
"lux" ["com.github.luxlang" "lux-jvm" "0.9.0-SNAPSHOT" "jar"]
"dependencies" [["com.github.luxlang" "lux-jvm-function" "0.6.5" "jar"]]
"target" "target/jvm"
... "dependencies" is an optional list of dependencies to fetch.
... The dependencies have the same shape as when specifying the compiler.
... When omitting the packaging format of the dependency, "tar" will be assumed.
Expand All @@ -64,24 +66,28 @@

"js"
["lux" ["com.github.luxlang" "lux-js" "0.9.0-SNAPSHOT" "js"]
"target" "target/js"
... The OS command to use when running JS tests. The default is described below.
... "js" ["node" "--stack_size=8192"]
]

"lua"
["lux" ["com.github.luxlang" "lux-lua" "0.9.0-SNAPSHOT" "jar"]
"target" "target/lua"
... The OS command to use when running Lua tests. The default is described below.
... "lua" ["lua"]
]

"python"
["lux" ["com.github.luxlang" "lux-python" "0.9.0-SNAPSHOT" "jar"]
"target" "target/python"
... The OS command to use when running Python tests. The default is described below.
... "python" ["python3"]
]

"ruby"
["lux" ["com.github.luxlang" "lux-ruby" "0.9.0-SNAPSHOT" "jar"]
"target" "target/ruby"
... The OS command to use when running Ruby tests. The default is described below.
... "ruby" ["ruby"]
]
Expand Down
11 changes: 11 additions & 0 deletions stdlib/source/library/lux/control/exception.lux
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,17 @@
Bit))
(text.starts_with? (its #label exception) error))

(.the .public (failure? exception it)
(for_any (_ it of)
(-> (Exception it) (Try of)
Bit))
(.when it
{//.#Failure error}
(is? exception error)

success
false))

(.the .public (when exception then try)
(for_any (_ it of)
(-> (Exception it) (-> Text of) (Try of)
Expand Down
2 changes: 1 addition & 1 deletion stdlib/source/library/lux/ffi/export.rb.lux
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
[@self (translation.learn_custom name (list#mix set.has dependencies interim_artifacts))
.let [[:input:/* :output:] (type.flat_function type)
code (if global?
(/.set (list (/.manual name)) term)
(/.statement (/.set (list (/.manual name)) term))
(when :input:/*
{.#End}
(/.function (/.manual name) (list)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
(in (<| (as Expression)
(is Statement)
(all _.then
(_.set (list @input) inputG)
(_.statement (_.set (list @input) inputG))
(list#mix (function (_ [test then!] else!)
(_.if test then! else!))
else!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
(_.statement before)
after))))

... TODO: Find some way to do 'let' without paying the price of the closure.
(the .public (let next archive it)
(Translator (synthesis.Let synthesis.Term))
(do [! phase.monad]
Expand All @@ -77,12 +78,13 @@
(list.partial context
tail))
body (next archive body)]
... TODO: Find some way to do 'let' without paying the price of the closure.
... (in (list#mix _., body (list.reversed bindings)))
(in (_.apply (<| (_.closure (list))
(list#mix _.then
(_.return body)
(list.reversed bindings)))
(list)))))
(list)))
))

(the .public (let! statement expression archive [[register valueS] bodyS])
(Translator! (synthesis.Let synthesis.Term))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
(|>> (///reference.foreign //reference.system) as_expected))

... TODO: Find some way to do 'let' without paying the price of the closure.
... https://peps.python.org/pep-0572/
... https://docs.python.org/3/whatsnew/3.8.html
(the .public (let expression archive [[register valueS] bodyS])
(Translator (synthesis.Let synthesis.Term))
(do phase.monad
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@
(let [@self (_.global self)]
(when inits
{.#End}
[(_.set (list @self) function_definition)
[(_.statement (_.set (list @self) function_definition))
@self]

_
[(_.set (list @self) (_.lambda {.#None}
[(|> (list.enumeration inits)
(list#each (|>> product.left ..capture)))
(let [@self (_.local self)]
(all _.then
(_.set (list @self) function_definition)
(_.return @self)))]))
[(_.statement (_.set (list @self) (_.lambda {.#None}
[(|> (list.enumeration inits)
(list#each (|>> product.left ..capture)))
(let [@self (_.local self)]
(all _.then
(_.statement (_.set (list @self) function_definition))
(_.return @self)))])))
(_.apply_lambda inits @self)])))

(the input
Expand All @@ -87,18 +87,18 @@

_
(_.local function_name)))
initialize_self! (_.set (list (//when.register 0)) @self)
initialize_self! (_.statement (_.set (list (//when.register 0)) @self))
initialize! (list#mix (.function (_ post pre!)
(all _.then
pre!
(_.set (list (..input post)) (_.item (|> post .integer _.int) @curried))))
(_.statement (_.set (list (..input post)) (_.item (|> post .integer _.int) @curried)))))
initialize_self!
(list.indices arity))
[declaration instatiation] (with_closure closureO+ function_name
(_.lambda {.#None}
[(list (_.variadic @curried))
(all _.then
(_.set (list @num_args) (_.its "length" @curried))
(_.statement (_.set (list @num_args) (_.its "length" @curried)))
(<| (_.if (|> @num_args (_.= arityO))
(<| (_.then initialize!)
//loop.with_scope
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
list.enumeration
(list#each (|>> product.left (n.+ offset) //when.register)))]
(all _.then
(_.set variables (_.multi bindings))
(_.statement (_.set variables (_.multi bindings)))
body)))

(the symbol
Expand Down

0 comments on commit 9f32a08

Please sign in to comment.