OMG Lightweight Log
Has anyone implemented the OMG lightweight log spec into a c++
#! rnews 1946
Xref: xyzzy comp.lang.lisp:150483
From: Jeffrey Cunningham <email@example.com>
Subject: PCL question about using &rest and &key parameters together
Content-Type: text/plain; charset=ISO-8859-1
User-Agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.)
Sender: firstname.lastname@example.org (Boeing NNTP News Access)
Organization: The Boeing Company
Date: Tue, 17 May 2005 18:19:25 GMT
I was reading in Seibel's PCL the following:
You can safely combine &rest and &key parameters, but the behavior may be
a bit surprising initially. Normally the presence of either &rest or &key
in a parameter list causes all the values remaining after the required and
&optional parameters have been filled in to be processed in a particular
way--either gathered into a list for a &rest parameter or assigned to the
appropriate &key parameters based on the keywords. If both &rest and &key
appear in a parameter list, then both things happen--all the remaining
values, which include the keywords themselves, are gathered into a list
that's bound to the &rest parameter, and the appropriate values are also
bound to the &key parameters.
So I tried the following:
(defun foo (a &rest rest &key b c)
(list a rest b c))
(foo 1 2 :b 3 :c 4)
When I run it from slime, it bombs with the following error message:
Function called with odd number of keyword arguments.
[Condition of type KERNEL:SIMPLE-PROGRAM-ERROR]
0: [ABORT] Abort handling SLIME request. 1: [ABORT] Return to Top-Level.
1: (NIL 1 (2 :B 3 :C 4) 5)[:OPTIONAL] 2: (SWANK::EVAL-REGION "(foo 1 2
:b 3 :c 4)
Any idea why this doesn't work as expected? I'm using CMUCL.
|All times are GMT. The time now is 05:30 AM.|
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.