diff options
author | Eduardo Julian | 2018-08-02 23:03:19 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-08-02 23:03:19 -0400 |
commit | 015134cd44e066e49b3bac56b442a6150c782600 (patch) | |
tree | 365056bf5bd62796b41e1e7eff9fcf0909cd430b /stdlib/source/lux.lux | |
parent | a4d56600054d833002a7793f98f192feb5d3f27b (diff) |
Moved statement phase into stdlib.
Diffstat (limited to 'stdlib/source/lux.lux')
-rw-r--r-- | stdlib/source/lux.lux | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index 34ceb43ba..1c7969f99 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -5832,10 +5832,16 @@ (fail "Wrong syntax for undefined"))) (macro: #export (:of tokens) - {#.doc (doc "Generates the type corresponding to a given definition or variable." - (let [my-num (: Int +123)] + {#.doc (doc "Generates the type corresponding to a given expression." + "Example #1:" + (let [my-num +123] (:of my-num)) "==" + Int + "-------------------" + "Example #2:" + (:of +123) + "==" Int)} (case tokens (^ (list [_ (#Identifier var-name)])) @@ -5843,6 +5849,12 @@ [var-type (find-type var-name)] (wrap (list (type-to-code var-type)))) + (^ (list expression)) + (do Monad<Meta> + [g!temp (gensym "g!temp")] + (wrap (list (` (let [(~ g!temp) (~ expression)] + (..:of (~ g!temp))))))) + _ (fail "Wrong syntax for :of"))) |