tag:blogger.com,1999:blog-12753102.post4340945050415110215..comments2024-03-28T15:41:37.170-04:00Comments on Ben's Journal: Syntax that cheats and a lesson for R7RSBen Simonhttp://www.blogger.com/profile/09833753747177544979noreply@blogger.comBlogger11125tag:blogger.com,1999:blog-12753102.post-43870320439536472752011-10-10T02:45:56.704-04:002011-10-10T02:45:56.704-04:00Well, we didn't remove everything from R7RS th...Well, we didn't remove everything from R7RS that we could have, but neither does R5RS, not by a long shot. Why not write your own COND and LENGTH, for example? Why have them in the standard? So that (a) you don't have to write them yourself, and (b) everybody doesn't have to adapt to your slightly different implementation; if your code uses the standard implementation, it's readable automatically.<br /><br />R7RS has grown by about 50% in terms of pages. I think that's reasonable, considering how much additional function it standardizes.John Cowanhttps://www.blogger.com/profile/11452247999156925669noreply@blogger.comtag:blogger.com,1999:blog-12753102.post-26825874863909220722010-10-17T08:29:15.869-04:002010-10-17T08:29:15.869-04:00guys with a problem with:
(< a b)
are the sam...guys with a problem with:<br /><br />(< a b)<br /><br />are the same with a problem with:<br /><br />(sort < ls)<br /><br />there are no operators in Lisp, only functions.<br /><br />Not worth the time fixing a 50-year old nice model of computation in favor of lesser developers who can't get their asses out of their C-heads. In trying to fix Lisp we could get ourselves inside far too much perlisms as with Haskell's ``, $, . etcnamekuseijinhttps://www.blogger.com/profile/02436340179949427584noreply@blogger.comtag:blogger.com,1999:blog-12753102.post-29908354134478925772009-11-09T17:10:05.850-05:002009-11-09T17:10:05.850-05:00Infix lisp isn't a real lisp.Infix lisp isn't a real lisp.Slobodan Blazeskihttps://www.blogger.com/profile/03330021974453479123noreply@blogger.comtag:blogger.com,1999:blog-12753102.post-61184535529649639212009-10-16T09:57:18.897-04:002009-10-16T09:57:18.897-04:00Ted -
I'll bite, don't get what?
-BenTed -<br /><br />I'll bite, don't get what?<br /><br />-BenBen Simonhttps://www.blogger.com/profile/09833753747177544979noreply@blogger.comtag:blogger.com,1999:blog-12753102.post-37565583567536015422009-10-15T02:48:57.600-04:002009-10-15T02:48:57.600-04:00You just don't get it, do you? ;-)You just don't get it, do you? ;-)Ted Henrynoreply@blogger.comtag:blogger.com,1999:blog-12753102.post-60383569450435797732009-07-04T09:55:33.565-04:002009-07-04T09:55:33.565-04:00Ben, I went through the same thing coding some tri...Ben, I went through the same thing coding some trig computations a few weeks ago... from (- a b) to (a . - . b) to (infix a - b) to [a-b].<br /><br />I wrote a reader macro that handles all the C operators using a shunting-yard parser. It's not simple or portable but it does exactly what I want. I'll upload it to PLaneT once it's cleaned up and tested enough.Goto Hellhttps://www.blogger.com/profile/15278697441089045265noreply@blogger.comtag:blogger.com,1999:blog-12753102.post-63001381760643062492009-05-15T19:35:00.000-04:002009-05-15T19:35:00.000-04:00Robert - Thanks for sharing the code.
Matt - yo...Robert - Thanks for sharing the code. <br /><br />Matt - you're version definitely makes you sound smarter than my version ;-)<br /><br />I'll keep that in mind for future reference.Ben Simonhttps://www.blogger.com/profile/09833753747177544979noreply@blogger.comtag:blogger.com,1999:blog-12753102.post-81186901952094551012009-05-15T19:24:00.000-04:002009-05-15T19:24:00.000-04:00Minor quibble, but I read (+ a b c) as "the sum of...Minor quibble, but I read (+ a b c) as "the sum of a, b and c."Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-12753102.post-74575499487494539252009-05-15T15:51:00.000-04:002009-05-15T15:51:00.000-04:00Well, considering it was one of first macros I eve...Well, considering it was one of first macros I ever tried to write and it only took me like 10 minutes, I’d think it’d be easy for a more experienced Schemer.<br /><br />Of course, it can get non-trivial. Mine doesn’t implement precedence, which some people might consider a requirement of an infix macro. (Even in languages with infix notation I tend to fully parenthesize expressions rather than relying on precedence.) Also, I didn’t provide a way to escape back into prefix notation.<br /><br />FWIW, here it is:<br /><br />(define-syntax infix<br /> (syntax-rules ()<br /> ((_ (x . y))<br /> (infix x . y))<br /> ((_ x op y)<br /> (op (infix x) (infix y)))<br /> ((_ op x)<br /> (op (infix x)))<br /> ((_ x)<br /> x)))Roberthttps://www.blogger.com/profile/16733274876782876659noreply@blogger.comtag:blogger.com,1999:blog-12753102.post-38197152104310739732009-05-15T15:03:00.000-04:002009-05-15T15:03:00.000-04:00Hey Robert -
Thanks for sharing. I would probabl...Hey Robert -<br /><br />Thanks for sharing. I would probably have less guilt using (infix i < j).<br /><br />It seems like it would be a trivial macro to write - I wonder why I hadn't ever though of writing it?<br /><br />Thanks for sharing!Ben Simonhttps://www.blogger.com/profile/09833753747177544979noreply@blogger.comtag:blogger.com,1999:blog-12753102.post-14199913299514201602009-05-15T14:31:00.000-04:002009-05-15T14:31:00.000-04:00I prefer (infix i < j) since I think it is clea...I prefer (infix i < j) since I think it is clearer and my macro is portable between Scheme implementations.<br /><br />That said, I agree that Scheme should have standard ways to enhance the reader.Roberthttps://www.blogger.com/profile/16733274876782876659noreply@blogger.com