diff options
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"))) |