6 ms·
Lisp without parentheses: Lisp INdented
- jacquesm 17y agoHm, this feels like comitting hara-kiri, but I actually found the eight queens sample: http://www.genyris.com/wiki?page=default/eightqueenssource http://www.genyris.com/wiki?page=default/eightqueenssource A lot more readable than the 'regular' lisp version: http://obereed.net/queens/algorithm.html http://obereed.net/queens/algorithm.html By automating the process of converting between 'indented' lisp and 'regular' lisp those that want it can have it and those that do not can simply ignore it.
- licoresse 17y agoThe "more readable version" does have some parentheses, doesn't this make it hard for beginners? Sometimes you use and sometimes you don't. The site is inaccessible right now, so I have not read everything, only parts of it via google cache...
- philh 17y agoI think that's partly because the way it's written is much more readable. Larger font probably doesn't hurt either (though the caps does).
- prodigal_erik 17y agoTrue, having a round trip to Lisp's standardized format might make this usable. I have to wonder how much of Ruby's success is owed to being unable to trivially share Python code with strangers without most of our tools shredding the whitespace.
- jacquesm 17y agoThat's one of my pet peeves with python. Even sites like the django documentation suffer from this, cut&paste simply does not work in the python world and it is much poorer because of that. It also can make debugging such a problem hell because you have to completely grok the code in order to spot the fact that the last line of a code block has somehow mysteriously jumped left 4 spaces. And it makes refactoring code a major pain. Braces rule compared to spaces.
- stcredzero 17y agocut&paste simply does not work in the python world and it is much poorer because of that. I think that might have made it much better! http://perldesignpatterns.com/?CutAndPasteProgramming http://perldesignpatterns.com/?CutAndPasteProgramming
- geocar 17y agoThere are other uses for cut/paste besides CutAndPasteProgramming; for example, one may want to post a snippet to a comment box that doesn't offer a preview function. def foo(): if something: do_something_else print "bar" What went wrong?
- jacquesm 17y agoEspecially while learning a new language cut & paste is a pretty good way to get function definitions from the the tutorial into the interpreter. Having to re-type a bunch of stuff that is already in a computer makes me feel like it is 1978 again.
- snprbob86 17y agoCut and paste is a good way to get the definitions from the tutorial into the interpreter without reading them. Personally, I've only ever had a problem copy-pasting from the web. Even then, it is rare; a mild occasional annoyance well worth the price of the clutter free syntax.
- JulianMorrison 17y agoSet the highlight color of your () to white. Solved.
- olliesaunders 17y agoWhy are people up-voting this? This is a recipe for bugs.
- DrJokepu 17y agoI think (hope) that it was meant to be funny as opposed to being a serious advice.
- olliesaunders 17y agoOh right. I get it now :-)
- jamesbritt 17y agoI've done this with Ruby and set the color to light gray. My co-workers wanted to have C/Java-style parens around damn near everything (except when they didn't; the reasoning to omit them was something along the lines of, "But, see, here it's a DSL." ) They strike me as line noise and make it harder to read many things, so I lightened up the color in my vim syntax files to give the appearance of more white space. I had mixed results. Yes, it was far more readable to me, but there were times when a paren was missing or mistakenly added, or the spacing was off (another coding standard violation), and so on. Now that I code on my own, the new coding standards say no parens unless required by the language. I also changed my syntax coloring back to more clearly show parens.
- DrJokepu 17y agoHeated debates amongst programmers (coworkers) about marginally important questions such as indenting styles, parenthesis usage, naming conventions, source code directory structure, etc. are always very amusing to observe. I usually sit back and just watch the show.
- lucraft 17y agoYes, it has been a few months since the last person tried this.
- sharjeel 17y agoDid you mean Python?
- deleted 17y ago[deleted]
- mahmud 17y agoBest attempt at this has got to be Dylan. Latest, plausible, attempt is probably David Moon's PLOT (Programming for Old Timers): http://users.rcn.com/david-moon/PLOT/ http://users.rcn.com/david-moon/PLOT/ See how he does macros for a syntax-full language :-) http://users.rcn.com/david-moon/PLOT/Moon-ILC09.pdf http://users.rcn.com/david-moon/PLOT/Moon-ILC09.pdf
- alrex021 17y agoOh no, I have no parenthesis. I am not a dataset nor a function, how do I compute?
- radu_floricica 17y agoEither have parentheses and format by hand or use parentheses and have the editor format the text. Personally, I like the latter best. Easier to change stuff.
- anonjon 17y agoHow about we have water without wet?
- kraemate 17y agoAm i the only one who likes lisp because of the parenthesis and the lack of syntax? The parens are the perfect way of representing the syntax trees, and you dont have to be bothered with remembering all the syntax and operators etc like with the other languages.
- eru 17y agoYes. But significant indentation does not destroy this lovely property.
- kingkongrevenge 17y ago> the perfect way of representing the syntax trees Humans don't think in syntax trees.
- rbanffy 17y agoMost humans don't. Some do.
- shiro 17y agoI do. When I think of algorithms I vaguely imagine DAG, which maps nicely to S-expr (the junction point maps to a tail function call). In languages with syntax, I have to add syntactic fluff to satisfy the compiler, which is mostly an extra annoyance. I don't say my way of thinking is the correct one. Some great programmers I respect have said they don't think in DAG (and naturally they choose languages other than Lisp as a primary tool).
- abstractbill 17y agoNo, you're not the only one. Often when writing code in other languages I think in Lisp, and then translate.
- kwantam 17y agoNo, definitely not. I agree with you 100%. The claim that somehow this retains all qualities of Lisp is absolutely ridiculous. The single most important property of Lisp is that programs are lists, i.e., code==data. "Indented" lisp breaks this. I'm not intending to troll when I say that people who don't like the parens just don't "get it."