aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/data/lazy.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/library/lux/data/lazy.lux')
-rw-r--r--stdlib/source/library/lux/data/lazy.lux18
1 files changed, 11 insertions, 7 deletions
diff --git a/stdlib/source/library/lux/data/lazy.lux b/stdlib/source/library/lux/data/lazy.lux
index d3283cfc8..d4b345f87 100644
--- a/stdlib/source/library/lux/data/lazy.lux
+++ b/stdlib/source/library/lux/data/lazy.lux
@@ -20,6 +20,9 @@
(abstract: #export (Lazy a)
(-> [] a)
+ {#.doc (doc "A value specified by an expression that is calculated only at the last moment possible."
+ "Afterwards, the value is cached for future reference.")}
+
(def: (lazy' generator)
(All [a] (-> (-> [] a) (Lazy a)))
(let [cache (atom.atom #.None)]
@@ -33,20 +36,21 @@
(exec (io.run (atom.compare_and_swap _ (#.Some value) cache))
value)))))))
- (def: #export (value l_value)
+ (def: #export (value lazy)
(All [a] (-> (Lazy a) a))
- ((:representation l_value) [])))
+ ((:representation lazy) [])))
-(syntax: #export (lazy expr)
+(syntax: #export (lazy expression)
+ {#.doc (doc "Specifies a lazy value by providing the expression that computes it.")}
(with_gensyms [g!_]
- (in (list (` ((~! lazy') (function ((~ g!_) (~ g!_)) (~ expr))))))))
+ (in (list (` ((~! lazy') (function ((~ g!_) (~ g!_)) (~ expression))))))))
-(implementation: #export (equivalence (^open "_\."))
+(implementation: #export (equivalence (^open "\."))
(All [a] (-> (Equivalence a) (Equivalence (Lazy a))))
(def: (= left right)
- (_\= (..value left)
- (..value right))))
+ (\= (..value left)
+ (..value right))))
(implementation: #export functor
(Functor Lazy)