On Fri, 2005-04-15 at 11:38 -0700, Steve Juranich wrote:
> I was wondering, is this "expected behavior", or have I uncovered
> something?  If this is expected behavior, I'd suggest that FOLD should
> do a check to make sure that the KONS argument is not a macro.  If
> I've uncovered a bug, I'll file a bug report.

`fold' in SRFI-1 mentions that KONS is supposed to be a function.

If you give a macro to fold, the macro gets expanded and memoized as
such, when the macro is called normally, as it is as an optimization in
the common case of one list.  Try passing multiple lists; I bet you will
get a type error on `apply'.

As for checking whether KONS is a function, well, here is from SRFI-1:

@q
Note that statements of the form "it is an error" merely mean "don't do
that." They are not a guarantee that a conforming implementation will
"catch" such improper use by, for example, raising some kind of
exception. Regrettably, R5RS Scheme requires no firmer guarantee even
for basic operators such as car and cdr, so there's little point in
requiring these procedures to do more.
@end q

So I would say "it is an error" to pass a macro to fold.  Seems like a
serious error, of course, that leaves the system in an undefined state
unlike errors that don't modify the implementation :); I am no authority
on whether this should be fixed (which is the only issue; the fix is
trivial, but has potential philosophical implications).

--
Stephen Compall


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user

Reply via email to