[Top][All Lists]

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

invalid args to define*

From: Bill Schottstaedt
Subject: invalid args to define*
Date: Mon, 15 Mar 2004 04:16:13 -0800
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030225

define* is a bit confusing in that it simply ignores invalid arguments:

/home/bil/cl/ guile
guile> (use-modules (ice-9 optargs))
guile> (define* (ho #:key a b) (list a b))
guile> (ho 1 2)
(#f #f)
guile> (ho 1 2 3 4 5)
(#f #f)
guile> (ho 1 2 3 #:a 1)
(1 #f)

In Lisp, this gives an eror:

USER(1): (defun ho (&key a b) (list a b))
USER(2): (ho 1 2)
Error: 1 not a legal keyword arg.
  [condition type: PROGRAM-ERROR]

Restart actions (select using :continue):
 0: Ignore it.
[1c] USER(3): :exit
; Exiting Lisp

reply via email to

[Prev in Thread] Current Thread [Next in Thread]