Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added &once-only, &with-gensyms and &complex.

  • Loading branch information...
commit b35d3959a5db574081e001a0b71216387d0713f3 1 parent 6869c68
@tpapp authored
Showing with 23 additions and 3 deletions.
  1. +14 −0 extensions.lisp
  2. +2 −3 package.lisp
  3. +7 −0 tests.lisp
View
14 extensions.lisp
@@ -69,3 +69,17 @@ closure"
`(progn
(assert ,test-form ,@arguments)
,@body))
+
+(define-let+-expansion (&once-only specs :uses-value? nil)
+ "Expand to (ONCE-ONLY SPECS ...)."
+ `(once-only ,specs ,@body))
+
+(define-let+-expansion (&with-gensyms names :uses-value? nil)
+ "Expand to (WITH-GENSYMS NAMES ...)."
+ `(with-gensyms ,names ,@body))
+
+(define-let+-expansion (&complex (x y))
+ "Access real and imaginary part of the value. Read-only."
+ `(let ((,x (realpart ,value))
+ (,y (imagpart ,value)))
+ ,@body))
View
5 package.lisp
@@ -18,7 +18,6 @@
;; extensions
- &flet+ &labels+ lambda+ defun+ define-structure-let+ &fwrap &assert
-
- ))
+ &flet+ &labels+ lambda+ defun+ define-structure-let+ &fwrap &assert
+ &once-only &with-gensyms &complex))
View
7 tests.lisp
@@ -200,3 +200,10 @@ should)."
;; (values a b c))
;; (values 1 2 3))
)
+
+(addtest (let-plus-tests)
+ test-complex
+ (let ((c #C(3 5)))
+ (let+ (((&complex x y) c))
+ (ensure-same x 3)
+ (ensure-same y 5))))
Please sign in to comment.
Something went wrong with that request. Please try again.