Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!dali.cs.montana.edu!milton!ogicse!pdxgate!qiclab!percy!data!kend From: kend@data.UUCP (Ken Dickey) Newsgroups: comp.lang.scheme Subject: Re: Logic does not Apply Message-ID: <484@data.UUCP> Date: 2 May 91 16:14:56 GMT References: <9104300906.aa04392@mc.lcs.mit.edu> Organization: Microcosm, Beaverton, OR Lines: 35 STCS8004%IRUCCVAX.UCC.IE@mitvma.mit.EDU writes: >The title says it all, but some elaboration is perhaps in order! >One might expect (naively?) that > (apply bin-op (list item1 item2)) = (bin-op item1 item2) >for *all* bin-ops, provided that bin-op's arguments are compatible with it. >But it is not so, since instead of the expected > (apply and '(#f #t)) --> #f >one gets some grumble that either 'and' is an undefined variable or it is >not the right kind of parameter-1 to 'apply'. I suggest that the problem is not one of "logic", but of using a similar syntax to express both procedure calls and evaluation rules. {The number of special forms in Scheme is, after all, quite small}. From your comments, you would expect the following to "work": (apply if (list a b c)) (apply begin (list a b c)) (apply set! (list a b)) (apply let (list ((a 1)(b 2) (+ a b)))) ... (apply a b) is *not* equivalent to (eval (cons 'a b)) because of differences in order of evaluation. > Why shouldn't 'and' and 'or' be first class citizens of Scheme? Why are special forms not applications? Because they are very useful is expressing another level of computational specification: how evaluation is to proceed. -Ken Dickey kend@data.uucp