From: Alessio Stalla on 19 Apr 2010 12:16 On 19 Apr, 17:28, Peter Keller <psil...(a)merlin.cs.wisc.edu> wrote: > Alessio Stalla <alessiosta...(a)gmail.com> wrote: > > An example: > > > with-output-to-string (str) { > > print #\c str; > > if (> foo 45) { > > progn { print 3; print 4; } > > print 5; > > } > > } > > How would you write a macro to do a non-trivial code transformation in the > above syntax? As I said, it's not intended to replace S-expressions: what I meant is that you cannot use it to write macros cleanly. I believe that if you know macros then usually you are also convinced that sexp-based syntax is the most powerful one possible (to write macros). The main use I intend to do of this syntax is to provide it to end-users of a library/ DSL who potentially don't care about Lisp and macros at all. Of course the advanced users, or those who already know Lisp, won't have any reason to use the dumbed-down syntax. And, since the syntax outputs Lisp forms, you can more-or-less trivially convert from "C-like" to Lisp by means of reading and then printing the forms. Again, if it's not clear, the sense of my post was not to promote the syntax to lispers (which is stupid), but to show how, with relatively few lines of code, you can build a "C-like" mock syntax on top of the Lisp reader. Of course to be really C-like it should be more polished and feature-rich - say, infix operators, [] to access arrays and hash tables, other corner cases I'm not aware of, ... Cheers, Alessio
From: Peter Keller on 19 Apr 2010 12:42 Alessio Stalla <alessiostalla(a)gmail.com> wrote: > Again, if it's not clear, the sense of my post was not to promote the > syntax to lispers (which is stupid), but to show how, with relatively > few lines of code, you can build a "C-like" mock syntax on top of the > Lisp reader. Of course to be really C-like it should be more polished > and feature-rich - say, infix operators, [] to access arrays and hash > tables, other corner cases I'm not aware of, ... Ah, I understand the intention more fully now. It really is a neat piece of code you wrote. -pete
From: Tamas K Papp on 19 Apr 2010 14:19 On Mon, 19 Apr 2010 08:14:05 -0700, o.jasper(a)gmail.com wrote: > Alessio Stalla wasn't be the first and won't be the last :), i did it > once too(http://www.lispforum.com/viewtopic.php? > f=20&t=300&p=2044&hilit=unlisp#p2044, just ftr, it sucks), i don't think > it is all that bad an idea, if it gets nubs to use lisp.. But we don't I think that the intention of helping newbies may be laudable, but I don't see the practical advantage. S-expressions (and macros) are what makes Lisp powerful. With a C-like syntax, Lisp is not much more powerful than a C-like language (with a few nice features thrown in, eg Blub OO systems rarely ever come close to CLOS). The greatest help one can give to newbies is help with learning CL as it is. That said, it is a cool hack. Tamas
From: Günther Thomsen on 20 Apr 2010 23:43 On Apr 19, 11:19 am, Tamas K Papp <tkp...(a)gmail.com> wrote: [..] > I think that the intention of helping newbies may be laudable, but I > don't see the practical advantage. Indeed. This comes up every now and then. I'm not sure whether this parenthesis-paralysis is actually a real problem or an often-repeated myth. In any case, Dylan did away with the prefix-syntax and that wasn't enough to make it popular (but of course, there might have been other reasons or no reasons why it failed to gain popularity). > S-expressions (and macros) are > what makes Lisp powerful. With a C-like syntax, Lisp is not much > more powerful than a C-like language (with a few nice features thrown in, > eg Blub OO systems rarely ever come close to CLOS). The greatest help > one can give to newbies is help with learning CL as it is. Not sure about that. But why not start with a good book and classic Scheme? Once through that, the student surely will be able to deal with those parenthesis and can move on to CL, if so inclined. > > That said, it is a cool hack. Sure. The Lisp world isn't lacking cool hacks though.
From: His kennyness on 23 Apr 2010 15:59
Pillsy wrote: > On Apr 22, 11:45 am, His kennyness <kentil...(a)gmail.com> wrote: >> Pillsy wrote: > [...] >>> I did too. Actually, I discovered that I liked it almost immediately. >>> OTOH, I find C-descended syntaxes to be very uncomfortable. Part of >>> the reason I'm so convinced of the role that personal preference plays >>> in this is that my own preferences seem to be so radically different >>> from most other programmers. > >> What makes you think most other programmers would not have the same >> result as yourself, viz. discover they like it almost immediately? > > If that were the case, wouldn't we see Lispy syntaxes everywhere? Why on Earth would that follow? The acid test is what you see in the Road to Lisp: someone who really evaluated Lisp as a potential language, not students dying to learn Java or Python or even C++ forced to do some Scheme in a language survey (who would end up writing about 50 lines of code over a week). > Lots > of people are exposed to Lisp through intro CS courses or editing > Emacs configuration files, and writing a Lisp reader is pretty damned > easy. Even if people hate the dynamic typing or garbage collection, Sorry? People who hate dynamic typing or GC? You are just inventing people now! :) What about all the straight men who would not want to date Anna Kournikova? > they could still give their new languages all the parentheses you > could ever want. Thank god the HTML and XML folks did not use a nested list format!!! > > Add to that people's #1 superficial complaint about Lisp is the > Legions of Irritating Stupid Parentheses, and ....you just went OT back to the irrelevant opinion-at-a-distance if we are talking about actual-inability-to-handle-parens. > I'm pretty sure I'm > right about this. No problem. :) kt |