[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

let-keywords



I've integrated LET-KEYWORDS and LET-KEYWORDS* into the ALET and ALET*
with a syntactic keyword `key'.  They use simple symbols as keywords.

Examples:

(define rest '(a 10 a 30 c 20 40))

(alet* ((key rest (a 1) (b 2 (< a b)) . c)) (list a b c))
=> error: duplicate keysymbol a

(alet* ((key rest allow-duplicate-keys
	     (a 1) (b 2 (< a b)) . c)) (list a b c))
=> error: unknown keysymbol c

(alet* ((key rest allow-duplicate-keys allow-other-keys
	    (a 1) (b 2 (< a b)) . c)) (list a b c))
=> error: no keysymbol 40

(alet* ((key rest allow-duplicate-keys allow-other-keys allow-non-keys
	    (a 1) (b 2 (< a b)) . c)) (list a b c))
=> (10 2 (a 30 c 20 40))

(alet* ((key rest #t (a 1) (b 2 (< a b)) . c)) (list a b c))
=> (10 2 (a 30 c 20 40))

((lambda (m . n)
      (alet* ((opt n (a 10) (b 20) (c 30) . d)
	      (key d (x 100) (y 200) ((a z) 300)))
       (list m a b c x y)))
    0 1 2 3 'z 30 'y 20 'x 10)
=> (0 30 2 3 10 20)

((lambda (m . n)
      (alet* ((key n (x 100) (y 200) ((a z) 300) . d)
	      (opt d (a 10) (b 20) (c 30)))
       (list m a b c x y)))
    0 'z 30 'y 20 'x 10 1 2 3)
=> (0 1 2 3 10 20)

--
Joo ChurlSoo