* [PATCH] lambda* fails with #:key and rest argument
@ 2002-05-30 18:44 Christopher Cramer
2002-06-29 19:44 ` Thien-Thi Nguyen
0 siblings, 1 reply; 6+ messages in thread
From: Christopher Cramer @ 2002-05-30 18:44 UTC (permalink / raw)
Here's the problem:
guile> (use-modules (ice-9 optargs))
guile> (lambda* (#:key foo . bar) #t)
/usr/local/share/guile/1.5.6/ice-9/optargs.scm:371:24: In procedure list-copy in expression (list-copy arglist):
/usr/local/share/guile/1.5.6/ice-9/optargs.scm:371:24: Wrong type argument in position 1: (#:key foo . bar)
ABORT: (wrong-type-arg)
Basically, there's a part where it tries to copy an improper list
with list-copy, which doesn't work. The solution lies in creating
improper-list-copy. At first I just put a new function in list.c (which
is trivial: copy scm_list_copy to scm_improper_list_copy and change
SCM_VALIDATE_LIST to SCM_VALIDATE_CONS), but then I figured I wanted
it fixed in stable, and we probably don't want a new public procedure at
this point.
Index: ice-9/optargs.scm
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/ice-9/optargs.scm,v
retrieving revision 1.14.2.3
diff -u -r1.14.2.3 optargs.scm
--- ice-9/optargs.scm 18 Oct 2001 19:41:08 -0000 1.14.2.3
+++ ice-9/optargs.scm 30 May 2002 18:26:05 -0000
@@ -368,7 +368,7 @@
((null? arglist) (cont '() '() '() #f #f))
((not (pair? arglist)) (cont '() '() '() #f arglist))
((not (list? arglist))
- (let* ((copy (list-copy arglist))
+ (let* ((copy (improper-list-copy arglist))
(lp (last-pair copy))
(ra (cdr lp)))
(set-cdr! lp '())
@@ -387,7 +387,16 @@
(parse-rest arglist cont))
-
+(define (improper-list-copy l)
+ (let ((out '()))
+ (let loop ((in l) (prev '()))
+ (if (pair? in)
+ (let ((cur (cons (car in) (cdr in))))
+ (if (null? prev)
+ (set! out cur)
+ (set-cdr! prev cur))
+ (loop (cdr in) cur))
+ out))))
;; define* args . body
;; define*-public args . body
--
Christopher Cramer <crayc@pyro.net> <http://www.pyro.net/~crayc/>
On résiste à l'invasion des armées; on ne résiste pas à l'invasion
des idées. -- Victor Hugo
_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-guile
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] lambda* fails with #:key and rest argument
2002-05-30 18:44 [PATCH] lambda* fails with #:key and rest argument Christopher Cramer
@ 2002-06-29 19:44 ` Thien-Thi Nguyen
2002-06-30 19:19 ` Dirk Herrmann
0 siblings, 1 reply; 6+ messages in thread
From: Thien-Thi Nguyen @ 2002-06-29 19:44 UTC (permalink / raw)
Cc: bug-guile
From: Christopher Cramer <crayc@pyro.net>
Date: Thu, 30 May 2002 13:44:11 -0500
Index: ice-9/optargs.scm
thanks for the patch. i've applied it for 1.4.2.
thi
_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-guile
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] lambda* fails with #:key and rest argument
2002-06-29 19:44 ` Thien-Thi Nguyen
@ 2002-06-30 19:19 ` Dirk Herrmann
2002-07-07 22:37 ` Marius Vollmer
0 siblings, 1 reply; 6+ messages in thread
From: Dirk Herrmann @ 2002-06-30 19:19 UTC (permalink / raw)
Cc: crayc, bug-guile
On Sat, 29 Jun 2002, Thien-Thi Nguyen wrote:
> From: Christopher Cramer <crayc@pyro.net>
> Date: Thu, 30 May 2002 13:44:11 -0500
>
> Index: ice-9/optargs.scm
>
> thanks for the patch. i've applied it for 1.4.2.
>
> thi
Hi,
I assume that the problem is also relevant for the newer branches.
There, we could think of providing a public improper-list-copy in list.c
instead of providing it privately within optargs.scm. Do we want that?
Best regards,
Dirk
_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-guile
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] lambda* fails with #:key and rest argument
2002-06-30 19:19 ` Dirk Herrmann
@ 2002-07-07 22:37 ` Marius Vollmer
2002-07-08 18:16 ` Marius Vollmer
0 siblings, 1 reply; 6+ messages in thread
From: Marius Vollmer @ 2002-07-07 22:37 UTC (permalink / raw)
Cc: ttn, crayc, bug-guile
Dirk Herrmann <dirk@sallust.ida.ing.tu-bs.de> writes:
> I assume that the problem is also relevant for the newer branches.
> There, we could think of providing a public improper-list-copy in list.c
> instead of providing it privately within optargs.scm. Do we want that?
Yes, that looks like the better option to me. What names are other
Schemes using for this operation? We shouldn't be gratuitously
incompatible. Also, should improper-list-copy be able to copy
circular lists, or only dotted lists?
SRFI-1 list-copy can copy dotted lists. Maybe we can just use it.
_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-guile
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2002-07-16 22:44 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-05-30 18:44 [PATCH] lambda* fails with #:key and rest argument Christopher Cramer
2002-06-29 19:44 ` Thien-Thi Nguyen
2002-06-30 19:19 ` Dirk Herrmann
2002-07-07 22:37 ` Marius Vollmer
2002-07-08 18:16 ` Marius Vollmer
2002-07-16 22:44 ` Dirk Herrmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).