unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* for-each and varargs
@ 2003-02-09 22:28 Kevin Ryde
  2003-02-10 12:43 ` Mikael Djurfeldt
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin Ryde @ 2003-02-09 22:28 UTC (permalink / raw)


In the latest cvs built on a recent i386 debian, for-each doesn't
always seem to like a procedure taking a variable number of arguments.
For instance foo.scm,

    (for-each (lambda (x . y) (display x))
              '(1 2 3))

run with "guile -s foo.scm" gives

    ERROR: In procedure for-each:
    ERROR: Wrong type argument in position 1: #<procedure #f (x . y)>

whereas I hoped it would display `123'.  Curiously this is what it
does when run interatively, not with "guile -s".

I noticed this in guile-www where http.scm maps display-with-crlf
across a list of header strings.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: for-each and varargs
  2003-02-09 22:28 for-each and varargs Kevin Ryde
@ 2003-02-10 12:43 ` Mikael Djurfeldt
  0 siblings, 0 replies; 2+ messages in thread
From: Mikael Djurfeldt @ 2003-02-10 12:43 UTC (permalink / raw)
  Cc: guile-devel

Kevin Ryde <user42@zip.com.au> writes:

> In the latest cvs built on a recent i386 debian, for-each doesn't
> always seem to like a procedure taking a variable number of arguments.
> For instance foo.scm,
>
>     (for-each (lambda (x . y) (display x))
>               '(1 2 3))
>
> run with "guile -s foo.scm" gives
>
>     ERROR: In procedure for-each:
>     ERROR: Wrong type argument in position 1: #<procedure #f (x . y)>
>
> whereas I hoped it would display `123'.

* eval.c (scm_trampoline_0, scm_trampoline_1, scm_trampoline_2):
Fixed formals tests for closures.  (Thanks to Kevin Ryde.)

Silly me.  I've been a bit careless when implementing this one.

> Curiously this is what it does when run interatively, not with
> "guile -s".

That's because "guile -s" uses the "normal" evaluator by default.
for-each doesn't use an optimized strategy when the debugging
evaluator is active.  This is to get a more informative backtrace.

Best regards,
Mikael D.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-02-10 12:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-09 22:28 for-each and varargs Kevin Ryde
2003-02-10 12:43 ` Mikael Djurfeldt

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).