News for hackers. Stuff that matters.
Re:Lisp for C++ programmers by mrottenkolber on Monday October 28, 2013 @08:06AM (#6626416)
I won't go into details about deficiencies of Lisp. That's another problem to be discussed; an extremely painful problem, in fact.

I don't buy it. Nobody wants to talk about these apparently obvious (to non Lispers) problems of Lisp, yet they are still there? Bring them up and be argued with or be quiet.

Later he talks about the ugliness of Lisp syntax, especially CL, but Scheme and Clojure are supposed to be better. On what basis? I may admit scheme is elegant, but calling clojure's syntax an improvement over CL is a pretty long jump.

Re:Lisp for C++ programmers by blueblob on Monday October 28, 2013 @09:24AM (#6626697)
I think many people that don't like lisp haven't spent much time with it. I personally do not like lisp. I took an artificial intelligence class where we wrote search techniques in common lisp. One problem that I had with lisp is the end of my A* search had a massive number of parenthesis at the end. I think this would have been a little better if we were taught about common lisp structs earlier on. My next big problem was that I was coming from C where you occasionally put extra parenthesis in to group portions of code (sometimes necessary in macros or if statements). This is a very bad habit in lisp because it tries to call a function.
Re:Lisp for C++ programmers by dllthomas on Monday October 28, 2013 @09:44AM (#6626836)
There've been dialects of Lisp where a single ] would close all outstanding open parentheses. Having never actually used one, I reserve judgment on whether this is a good or bad idea.
Re:Lisp for C++ programmers by adwf on Monday October 28, 2013 @10:45AM (#6627218)
I think it just became irrelevant at some point. Every decent Lisp editor since the 80's will automatically match parens for you, so I don't even notice them anymore, unless I specifically need to do something special with them.

Then when you add in other little features that you can do in emacs, like fading the parens close to background colour when you're not working on them, highlighting when you are, etc... It all adds up to make the old "parenthesis hell" a bit nonsense.

I sometimes imagine that there must've been a stage when universities forced people to write Lisp in Notepad or something, or by hand maybe. I can't imagine how much that would drive me insane!

Re:Lisp for C++ programmers by eropple on Monday October 28, 2013 @11:11AM (#6627389)
Consider that most people writing Lisp or Scheme for schools are probably not using great editors. When I took a class with Scheme, the recommended editor was GEdit or Notepad++. It wasn't until I switched to Kate that I had colored parens.
Re:Lisp for C++ programmers by hajile on Monday October 28, 2013 @02:06PM (#6628619)
This is simply the ignorance of academics. What they SHOULD be recommending for these languages is Vim or EMACS with EVIL (got to keep sane keybindings somehow).

The problem is that many programmers and academics today are unwilling to take the time to learn the right tools for the job.

Re:Lisp for C++ programmers by adwf on Monday October 28, 2013 @11:54AM (#6627666)
That's quite a scary thought. It's like trying to program with one hand tied behind your back and only your little finger to poke out the keys...
Re:Lisp for C++ programmers by blueblob on Monday October 28, 2013 @04:35PM (#6629593)
both gedit and notepad++ have plugins for colored parens.
Re:Lisp for C++ programmers by AUmrysh on Monday October 28, 2013 @10:07AM (#6626967)
I think, just like any other syntactic sugar, it's fine if used with proper understanding of possible consequences. I'd like to see lisp use indention instead of parens like Python. I'm sure someone's done it and it isn't popular for some reason or another, but I think getting rid of the parens would go a long way to making people stop hating LISP.
Re:Lisp for C++ programmers by hajile on Monday October 28, 2013 @02:20PM (#6628719)
Some people have played with this idea http://readable.sourceforge.net/ http://www.informatimago.com/develop/lisp/com/informatimago/...

In fact (if you didn't know) lisp M-expressions using whitespace and indentation existed long before python (though the original M-expression syntax idea was based on FORTRAN). The reason M-expressions aren't used in place of S-expressions is because people using lisp preferred and continue to prefer S-expressions.

Re:Lisp for C++ programmers by blueblob on Monday October 28, 2013 @12:50PM (#6628051)
I don't see how lisp could get rid of parends with indentation. Parends are used for function calls so you would then have to indent one extra level to call a function? If there was a workaround for the function calls, then it would also require every function to be written on a separate line, there would be no concept of a one liner.
Re:Lisp for C++ programmers by sparkie on Monday October 28, 2013 @01:37PM (#6628388)
Indeed. A workaround would be to introduce some infix operators (there are various lisps that do so), so you could use something like '$' for function application and end up with a syntax like Haskell.

Of course, this is a terrible idea and very un-lispy, because one of the key benefits of lisp is that it's simple to parse. Introducing infix operators destroys that simplicity.

Another workaround, which I quite like, is to simply remove all the "lisp syntax" entirely, and edit a tree directly using a syntax directed editor.

Re:Lisp for C++ programmers by dllthomas on Wednesday October 30, 2013 @08:46PM (#6644595)
Building a tree with indentation is easy. You would need some method to distinguish between a one element list and a value, and some method of specifying an empty list (though you could just write nil). One option that leaves everything completely uniform is to use something that says "this starts a list", and then have the (zero or more) elements indented including the list head if present. If we use (), this would read like:

    ()
      prin1
      ()
        *
        ()
          +
          3
          4
        7

Exceedingly vertical, obviously, if you don't allow inline parens at all.

If you were, you could compress any run of lines by simply moving everything with no children into the parent parens. Applying that only to the deepest bit of the above, we'd get:

    ()
      prin1
      ()
        *
        (+ 3 4)
        7


Of course, the original could be transformed into actual lisp by simply moving end-parens:

    (
      prin1
      (
        *
        (
          +
          3
          4
        )
        7
      )
    )
Re:Lisp for C++ programmers by frou_dh on Monday October 28, 2013 @09:45AM (#6626841)
I've enjoyed coming up with a Lisp-ish toy language and implementing an interpreter for it. I haven't yet used any kind of Lisp for a real project (and may never), but getting a grip on its concepts has, and continues to be, interesting.
Re:Lisp for C++ programmers by AUmrysh on Monday October 28, 2013 @10:07AM (#6626973)
I'd really like to learn to implement a basic lisp in assembly. Do you know of any resources for doing this?
Re:Lisp for C++ programmers by ericbb on Monday October 28, 2013 @12:02PM (#6627727)
Re:Lisp for C++ programmers by frou_dh on Monday October 28, 2013 @10:21AM (#6627062)
Sorry, no. I used Go.
Re:Lisp for C++ programmers by sparkie on Monday October 28, 2013 @11:32AM (#6627517)
I can imagine people not liking lisp if they've used a dumb text editor to try writing it, but if using something a bit more intelligent like ParEdit+emacs, the closing parens become a non-issue, they're added for you, and you're given a nice set of commands to navigate around s-expressions.
Re:Lisp for C++ programmers by angersock on Monday October 28, 2013 @12:29PM (#6627888)
There is a point beyond which the syntax of a language becomes unforgivable, even if you have an IDE to make it more palatable.

Java, for example, is completely awful to write (I find) without the use of Eclipse or some similar tool. C and Ruby, by contrast, I'm happy to hack on in Vim.

Re:Lisp for C++ programmers by rsynnott on Monday October 28, 2013 @11:03AM (#6627334)
> but calling clojure's syntax an improvement over CL is a pretty long jump.

Well, it has all of _three_ types of brackets, which may be reassuring to the C++ programmer.

Re:Lisp for C++ programmers by cbp on Monday October 28, 2013 @09:03AM (#6626614)
> Later he talks about the ugliness of Lisp syntax, especially CL, but Scheme and Clojure are supposed to be better. On what basis? I may admit scheme is elegant, but calling clojure's syntax an improvement over CL is a pretty long jump.

Having syntax for 4 different data structures instead of just one would be one of my main reasons. Also, the syntax of a lisp-1 is cleaner.

Re:Lisp for C++ programmers by Jtsummers on Monday October 28, 2013 @12:36PM (#6627952)
While I like scheme and clojure, why do you think lisp-1's are cleaner? Perhaps it was just my order of learning, but I rather liked the different namespaces CL provided, primarily as it eliminated name collisions between variables and functions. If list were an appropriate variable name, I could call a thing list versus the abbreviated form lst in scheme (that's a trivial example, but I recall more name collisions back when I was using scheme and CL as hobby languages).

I guess, syntax-wise, the main difference is no longer needing funcall, which was a headache when I was learning CL.

Re:Lisp for C++ programmers by mrottenkolber on Monday November 04, 2013 @06:31PM (#6671954)
Because what if there where 6 equally important datastructures, or 100? The only datastructure you need to express when you are programming is the AST, in my humble opinion, and lists serve it well, visual trees might be interesting.

The Lisp-2 design has a very good practical reason: 50% of a common type of mistake are impossible to make. More namespaces don't hurt a language, while less namespaces usually do (Javascript for instance).