From 015134cd44e066e49b3bac56b442a6150c782600 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 2 Aug 2018 23:03:19 -0400 Subject: Moved statement phase into stdlib. --- stdlib/source/lux.lux | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'stdlib/source/lux.lux') 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 + [g!temp (gensym "g!temp")] + (wrap (list (` (let [(~ g!temp) (~ expression)] + (..:of (~ g!temp))))))) + _ (fail "Wrong syntax for :of"))) -- cgit v1.2.3