You are looking at historical revision 19403 of this page. It may differ significantly from its current revision.

dsssl-utils

Documentation

An API to compensate for the #!rest #!key order of a DSSSL extended lambda list.

dsssl-fixup

[syntax] (dsssl-fixup OPTIONALS KEYS REST BODY...)

Expands the BODY... in a new lexical scope where the #!optional, #!key, and #!rest variables have the correct value.

OPTIONALS is (OPTIONAL...).

KEYS is ((KEYWORD KEYWORD-VARIABLE)...).

OPTIONAL is a list with the form:

(OPTIONAL-VARIABLE OPTIONAL-DEFAULT)
as is
(OPTIONAL-VARIABLE)
becomes (OPTIONAL-VARIABLE #f)
OPTIONAL-VARIABLE
becomes (OPTIONAL-VARIABLE #f)

fixup-dsssl-lambda-list

[procedure] (fixup-dsssl-lambda-list OPTIONALS KEYS REST) => values

Returns 3 "correct" values: the rest list, optionals list, and keys list.

OPTIONALS is (({{OPTIONAL-VALUE OPTIONAL-DEFAULT)...)}}.

KEYS is ((KEYWORD KEYWORD-VALUE)...).

Usage

(require-extension dsssl-utils)

Examples

(use dsssl-utils)

(define (f a1 a2 #!optional (o1 'x) o2 #!rest rest #!key k1 k2)
  (print (list (list 'a1 a1 'a2 a2)
               (list 'o1 o1 'o2 o2)
               (list #:k1 k1 #:k2 k2)
               (list 'rest rest)))
  (dsssl-fixup ((o1 'x) o2) ((#:k1 k1) (#:k2 k2)) rest
    (list (list 'a1 a1 'a2 a2)
          (list 'o1 o1 'o2 o2)
          (list #:k1 k1 #:k2 k2)
          (list 'rest rest)) ) )

Author

kon lovett

Version history

1.0.0
Hello

License

Copyright (C) 2010 Kon Lovett. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.