Ignore:
Timestamp:
05/19/04 20:05:39 (17 years ago)
Author:
piso
Message:

Optional parameters default to * rather than NIL.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/deftype.lisp

    r4080 r6833  
    22;;;
    33;;; Copyright (C) 2003 Peter Graves
    4 ;;; $Id: deftype.lisp,v 1.1 2003-09-27 17:30:58 piso Exp $
     4;;; $Id: deftype.lisp,v 1.2 2004-05-19 20:05:39 piso Exp $
    55;;;
    66;;; This program is free software; you can redistribute it and/or
     
    2121
    2222(defmacro deftype (name lambda-list &rest body)
     23  ;; Optional parameters default to * rather than NIL.
     24  ;; FIXME Extend this code to handle keyword parameters too!
     25  (when (memq '&optional lambda-list)
     26    (let ((new-lambda-list ())
     27          (optionalp nil))
     28      (dolist (thing lambda-list)
     29        (cond (optionalp
     30               (when (symbolp thing)
     31                 (setf thing (list thing ''*))))
     32              ((eq thing '&optional)
     33               (setf optionalp t))
     34              ((memq thing lambda-list-keywords)
     35               (setf optionalp nil)))
     36        (push thing new-lambda-list))
     37      (setf lambda-list (nreverse new-lambda-list))))
    2338  `(progn
    2439     (setf (get ',name 'deftype-definition) #'(lambda ,lambda-list ,@body))
Note: See TracChangeset for help on using the changeset viewer.