aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/library')
-rw-r--r--stdlib/source/library/lux/ffi/export.rb.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/ruby.lux5
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/translation/ruby/common.lux12
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/translation/ruby/host.lux5
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/ruby.lux6
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/translation.lux18
-rw-r--r--stdlib/source/library/lux/meta/target/ruby.lux3
-rw-r--r--stdlib/source/library/lux/world/file.lux9
-rw-r--r--stdlib/source/library/lux/world/finance/market/analysis/pivot_point.lux78
-rw-r--r--stdlib/source/library/lux/world/shell.lux2
10 files changed, 116 insertions, 24 deletions
diff --git a/stdlib/source/library/lux/ffi/export.rb.lux b/stdlib/source/library/lux/ffi/export.rb.lux
index bd76976e7..ec871f1d2 100644
--- a/stdlib/source/library/lux/ffi/export.rb.lux
+++ b/stdlib/source/library/lux/ffi/export.rb.lux
@@ -28,8 +28,8 @@
["[0]" dependency
["[1]" artifact]]]]
[language
- ["[0]" phase]
[lux
+ ["[0]" phase]
["[0]" translation]
["[0]" declaration]
["[0]" analysis
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/ruby.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/ruby.lux
index de66972a1..9e85ce56b 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/ruby.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/ruby.lux
@@ -23,10 +23,9 @@
[///
["[0]" extension]
[//
+ ["[0]" phase]
["[0]" analysis (.only Analysis Operation Phase Handler Bundle)
- ["[1]/[0]" type]]
- [///
- ["[0]" phase]]]]])
+ ["[1]/[0]" type]]]]])
(def array::new
(-> Text Handler)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/translation/ruby/common.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/translation/ruby/common.lux
index 151cf3c74..f5facd483 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/translation/ruby/common.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/translation/ruby/common.lux
@@ -40,11 +40,10 @@
["[1][0]" when]
["[1][0]" loop]]]
[//
+ ["[0]" phase (.use "[1]#[0]" monad)]
["[0]" translation]
["[0]" synthesis (.only %synthesis)
- ["<[1]>" \\parser (.only Parser)]]
- [///
- ["[0]" phase (.use "[1]#[0]" monad)]]]])
+ ["<[1]>" \\parser (.only Parser)]]]])
(def .public (custom [parser handler])
(All (_ s)
@@ -239,7 +238,12 @@
(def io//error!
(Unary Expression)
- _.raise)
+ (let [stack_trace (_.do "join" (list (_.string text.new_line))
+ {.#None}
+ _.caller/0)]
+ (|>> (_.+ (_.string (%.format text.new_line text.new_line)))
+ (_.+ stack_trace)
+ _.raise)))
(def with_io_extensions
(-> Bundle Bundle)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/translation/ruby/host.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/translation/ruby/host.lux
index 982c33f38..aebe5f445 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/translation/ruby/host.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/translation/ruby/host.lux
@@ -27,10 +27,9 @@
["[0]" runtime (.only Operation Phase Handler Bundle
with_vars)]]]
[//
+ ["[0]" phase]
["[0]" synthesis
- ["?[1]" \\parser (.only Parser)]]
- [///
- ["[0]" phase]]]]])
+ ["?[1]" \\parser (.only Parser)]]]]])
(def (array::new [size])
(Unary Expression)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/ruby.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/ruby.lux
index 427411877..95fa56148 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/ruby.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/ruby.lux
@@ -27,9 +27,9 @@
["[1]/[0]" common]]]]
["/[1]" //
[analysis (.only)]
+ ["[0]" phase (.use "[1]#[0]" monad)]
["[1][0]" synthesis]
["//[1]" ///
- ["[1][0]" phase (.use "[1]#[0]" monad)]
[reference (.only)
[variable (.only)]]]]]]])
@@ -42,7 +42,7 @@
(when synthesis
(^.with_template [<tag> <translator>]
[(<tag> @ value)
- (//////phase#in (<translator> value))])
+ (phase#in (<translator> value))])
([////synthesis.bit /primitive.bit]
[////synthesis.i64 /primitive.i64]
[////synthesis.f64 /primitive.f64]
@@ -69,7 +69,7 @@
[////synthesis.function/abstraction /function.function])
(////synthesis.loop/again @ _)
- (//////phase.except ..cannot_recur_as_an_expression [])
+ (phase.except ..cannot_recur_as_an_expression [])
[@ {////synthesis.#Reference value}]
(//reference.reference /reference.system archive value)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/translation.lux b/stdlib/source/library/lux/meta/compiler/language/lux/translation.lux
index cb92a5e51..fc6ab8350 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/translation.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/translation.lux
@@ -58,18 +58,24 @@
(type .public (Host expression declaration)
(Interface
- (is (-> unit.ID [(Maybe unit.ID) expression] (Try Any))
+ (is (-> unit.ID [(Maybe unit.ID) expression]
+ (Try Any))
evaluate)
- (is (-> declaration (Try Any))
+ (is (-> declaration
+ (Try Any))
execute)
- (is (-> unit.ID (Maybe Text) [(Maybe unit.ID) expression] (Try [Text Any declaration]))
+ (is (-> unit.ID (Maybe Text) [(Maybe unit.ID) expression]
+ (Try [Text Any declaration]))
define)
- (is (-> unit.ID Binary declaration)
+ (is (-> unit.ID Binary
+ declaration)
ingest)
- (is (-> unit.ID (Maybe Text) declaration (Try Any))
+ (is (-> unit.ID (Maybe Text) declaration
+ (Try Any))
re_learn)
- (is (-> unit.ID (Maybe Text) declaration (Try Any))
+ (is (-> unit.ID (Maybe Text) declaration
+ (Try Any))
re_load)))
(type .public (State anchor expression declaration)
diff --git a/stdlib/source/library/lux/meta/target/ruby.lux b/stdlib/source/library/lux/meta/target/ruby.lux
index 82fbaa9b4..c47ea733c 100644
--- a/stdlib/source/library/lux/meta/target/ruby.lux
+++ b/stdlib/source/library/lux/meta/target/ruby.lux
@@ -506,7 +506,8 @@
<definitions>))]
[0
- [["gets"]]]
+ [["gets"]
+ ["caller"]]]
[1
[["print"]
diff --git a/stdlib/source/library/lux/world/file.lux b/stdlib/source/library/lux/world/file.lux
index 94bea7fad..997330d7f 100644
--- a/stdlib/source/library/lux/world/file.lux
+++ b/stdlib/source/library/lux/world/file.lux
@@ -1255,7 +1255,9 @@
(in (|> |store|
(..retrieve_mock_file! separator path)
(try#each (|>> product.right
- (the #mock_content))))))))
+ (the #mock_content)
+ (composite identity)
+ (with binary.monoid))))))))
(def (delete path)
(stm.commit!
@@ -1273,7 +1275,10 @@
(do async.monad
[now (async.future instant.now)]
(stm.commit!
- (..attempt! (..update_mock_file! separator path now content) store))))
+ (..attempt! (..update_mock_file! separator path now
+ (with binary.monoid
+ (composite identity content)))
+ store))))
(def (append path content)
(do async.monad
diff --git a/stdlib/source/library/lux/world/finance/market/analysis/pivot_point.lux b/stdlib/source/library/lux/world/finance/market/analysis/pivot_point.lux
new file mode 100644
index 000000000..8b0693abb
--- /dev/null
+++ b/stdlib/source/library/lux/world/finance/market/analysis/pivot_point.lux
@@ -0,0 +1,78 @@
+(.require
+ [library
+ [lux (.except Analysis)
+ [control
+ ["[0]" maybe]]
+ [math
+ [number
+ ["n" nat]]]
+ [world
+ [time
+ ["[0]" series (.only Series) (.use "[1]#[0]" functor)]]]]]
+ [///
+ [price (.only Price)]
+ [//
+ ["[0]" money]
+ [trade
+ ["[0]" session (.only Session)]]]])
+
+... https://en.wikipedia.org/wiki/Typical_price
+(def .public (typical_price it)
+ (All (_ $)
+ (-> (Session $)
+ (Price $)))
+ (|> (all money.+
+ (the session.#high it)
+ (the session.#low it)
+
+ (the session.#open it)
+ (the session.#close it))
+ money.amount
+ (n./ 4)
+ (money.money (money.currency (the session.#close it)))))
+
+... https://en.wikipedia.org/wiki/Pivot_point_(technical_analysis)
+(type .public (Central_Pivot_Range $)
+ (Record
+ [#top_central (Price $)
+ #pivot_point (Price $)
+ #bottom_central (Price $)]))
+
+(def (bottom_central it)
+ (All (_ $)
+ (-> (Session $)
+ (Price $)))
+ (|> (all money.+
+ (the session.#high it)
+ (the session.#low it))
+ money.amount
+ (n./ 2)
+ (money.money (money.currency (the session.#high it)))))
+
+(def (top_central pivot_point bottom_central)
+ (All (_ $)
+ (-> (Price $) (Price $)
+ (Price $)))
+ (|> pivot_point
+ (money.+ pivot_point)
+ (money.- bottom_central)
+ maybe.trusted))
+
+(def .public (central_pivot_range it)
+ (All (_ $)
+ (-> (Session $)
+ (Central_Pivot_Range $)))
+ (let [pivot_point (typical_price it)
+ bottom_central (bottom_central it)]
+ [#top_central (top_central pivot_point bottom_central)
+ #pivot_point pivot_point
+ #bottom_central bottom_central]))
+
+(type .public (Analysis from to)
+ (-> (Series from)
+ (Series to)))
+
+(def .public analysis
+ (All (_ $)
+ (Analysis (Session $) (Central_Pivot_Range $)))
+ (series#each ..central_pivot_range))
diff --git a/stdlib/source/library/lux/world/shell.lux b/stdlib/source/library/lux/world/shell.lux
index 57535fb3b..d74bdc120 100644
--- a/stdlib/source/library/lux/world/shell.lux
+++ b/stdlib/source/library/lux/world/shell.lux
@@ -188,7 +188,7 @@
(import (java/util/Map k v)
"[1]::[0]"
- (put [k v] v))
+ (put [k v] "?" v))
(def (jvm::load_environment input target)
(-> Environment