From: Ken A. <kan...@bb...> - 2004-04-05 19:48:23
|
This is an interesting question. I think that (apply and '(#t #t)) should be a syntax error, because and is considered syntax, and not a procedure. In JScheme, and is an instance of Macro which is a subclass of Procedure. Apply is a primitive that essentially calls .apply on its first argument and the list of remaining arguments. For a Macro, .apply macroexpands the macro and arguments. Scheme.analyze() calls .apply to get macroexpansion done, but for apply it should probably be and error. The right way to apply a macro is like this: (apply (lambda (a b) (and a b)) (list #t #f)) However, i did notice that (apply + 2 3) does not provide an informative error message, i'll fix that. k At 02:49 PM 4/5/2004 -0400, Borislav Iordanov wrote: >Hi, > >I tried and-ing a list of boolean with: > >(apply and values) > >It doesn't work. Why is it possible to do: > >(apply + (list 2 2)) > >But not: > >(apply and (list #t #t))? > >It seems like and is a macro that expands the above into: > >(if #t (and #t) #f) > >Of course, I can 'and' that list in many other ways, but just >wondering.... > >Thanks, >Boris > > > >------------------------------------------------------- >This SF.Net email is sponsored by: IBM Linux Tutorials >Free Linux tutorial presented by Daniel Robbins, President and CEO of >GenToo technologies. Learn everything from fundamentals to system >administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click >_______________________________________________ >Jscheme-user mailing list >Jsc...@li... >https://lists.sourceforge.net/lists/listinfo/jscheme-user |