Skip to content

Commit

Permalink
Using special variable LAZY:*MEMO-THREAD-SAFE*
Browse files Browse the repository at this point in the history
  • Loading branch information
dsorokin committed Dec 15, 2012
1 parent 66e4487 commit 0741c24
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
RECLET -- a recursive LET for Common Lisp

This is close to macro LETREC but different. RECLET recursively defines the variables, not functions. It uses a laziness and SYMBOL-MACROLET to create recursive bindings. Moreover, the recent implementation is thread safe.
This is close to macro LETREC but different. RECLET recursively defines the variables, not functions. It uses a laziness and SYMBOL-MACROLET to create recursive bindings. To define whether the recursive definitions are thread-safe, set special variable LAZY:*MEMO-THREAD-SAFE* to true.

Example 1: Fibonacci Sequence (using Generic Sequences)

Expand All @@ -15,7 +15,7 @@ Example 1: Fibonacci Sequence (using Generic Sequences)
(delay-seq (seq-cdr fibs))))))))
fibs))

Example 2: Not-strict Order
Example 2: Non-strict Order

(reclet
((a c)
Expand Down
3 changes: 1 addition & 2 deletions reclet.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
(gen-symbol-macrolet (info)
`(,(getf info :name) (force ,(getf info :gen))))
(gen-setf (info)
`(setf ,(getf info :gen) (delay ,(getf info :value)
:thread-safe t)))
`(setf ,(getf info :gen) (delay ,(getf info :value))))
(gen-lets (infos)
(loop for info in infos collect (gen-let info)))
(gen-symbol-macrolets (infos)
Expand Down

0 comments on commit 0741c24

Please sign in to comment.