Live data from Hacker News

Why I still reach for Lisp and Scheme instead of Haskell

jointhefreeworld.org

21–30 of 172 posts

Re: Why I still reach for Lisp and Scheme instead of Haskell

#21
I don't believe monads are a "heavy handed abstraction" and that's what prevents people from prototyping in Haskell.

What really prevents people from writing in Haskell at a reasonable speed is the poor language design. Programming languages are supposed to aid in reading by emphasizing structure. It's important to emphasize that a particular group of "words" constitutes a function call, or a variable definition, or a type definition -- whatever the language has to offer.

Haskell is a word salad. Every line you read, you have to read multiple times, every time trying to guess the structure from the disconnected acronyms. It belongs to the "buffalo buffalo buffalo buffalo" gimmick family. This is a huge roadblock on the way to prototyping as well as any other activity that implies the ability to read code quickly. And then it's also spiced by the most bizarre indentation rules invented by men.

This is not at all a problem with eg. SML or Erlang, even though they are roughly in the same category of languages.

Haskell would've been a much better language if it made its syntax more systematic and disallowed syntactical extensions s.a. introduction of user-invented infix operators, overloading of literals (heaven, why???) and requiring parenthesis around function arguments both for definition and for application. The execution model is great, the typesystem is great... but the surface, the front door to all these nice things the language has is just some amateur level nonsense.

* * *

As for the upsides of using languages from the Lisp family for practical problems... I don't find (syntax-rules ...) all that exciting. I understand this was an attempt to constrain the freedom given by Common Lisp macros, and I don't think it worked. I think it's clumsy and annoying to deal with. The very first time I tried to use it, I ran into its limitations, and that felt completely unjustified. To prototype, you want freedom of movement, not some pedantry that will stand in your way and demand you work around it somehow.

The absolute selling point, however, is SWANK. Instead of editing the source code, you are editing the program itself, that can be interacted with in points of your choosing. I don't know of any modern language that offers this kind of experience. I think, even still in the 80s, this approach to programmers interacting with computers was common. At school, we had terminals with some variety of Basic, and it worked just like that: you type the program and it instantly shows the effect of your changes. Then, there was also Forth, which also worked in a similar way: it felt like you are "talking" to the computer in a very organized and structured way, but real-time.

Most mainstream languages today sprouted from the idea of batch jobs, where the programmer isn't at the keyboard when the program runs. They came with the need to anticipate and protect the programmer from every minor mistake they might've easily detected and fixed during an interactive session far, far in advance.

Whenever I think about writing in C, or Rust, or Haskell, I imagine being tasked with going to the grocery blindfolded: I'd need to memorize the number of steps, the turns, predict the traffic, have canned strategies for what to do when potatoes go on sale... I deeply regret that programming evolved using this evolution path, and our idea of what it means to program is, mostly, the skill of guessing the impossible to predict future, instead of learning to react to the events as they unfold.

Re: Why I still reach for Lisp and Scheme instead of Haskell

#22
post #18

I tried some ML language once, it's difficult even to write a basic factorial example, which in Scheme I could do it iteratively and recursively with ease. Either with S9 Scheme for quick fun (it has Unix sockets and ncurses :D ) or Chicken Scheme for completeneless (R5RS/R7RS-small + modules), I always have fun with both. Oh, and well, Forth, too, but more like a puzzle (altough it shines to teach you that you can d…

Even as simple as

  fac 1 = 1
  fac n = n * (fac (n - 1))
which is a working Haskell implementation?

I mean, in Scheme it is longer to write. I enjoy Lisps and use Emacs for everything, but Haskell can be as terse, or even more terse. (Which is not always a good thing.)

Re: Why I still reach for Lisp and Scheme instead of Haskell

#23

I learned Scheme before Haskell and as much as I enjoyed the experience, I still wouldn't reach for Haskell first. It's pretty much limited to my xmonad configuration.

I have written a very large codebase in Scheme (gambit) and in the end I really, really, wanted a type system to catch bugs.

I get where you're coming from but I talked to a few folks working in large Haskell codebases and I'm not sure I would make that trade.

Re: Why I still reach for Lisp and Scheme instead of Haskell

#24
post #18

I tried some ML language once, it's difficult even to write a basic factorial example, which in Scheme I could do it iteratively and recursively with ease. Either with S9 Scheme for quick fun (it has Unix sockets and ncurses :D ) or Chicken Scheme for completeneless (R5RS/R7RS-small + modules), I always have fun with both. Oh, and well, Forth, too, but more like a puzzle (altough it shines to teach you that you can d…

I don't see how: Racket: > (define (fact n) (if (= n 1) 1 (* n (fact (- n 1))))) > (fact 6) 720 OCaml: # let rec fact = function | 1 -> 1 | n when n > 1 -> n * (fact (n - 1)) in fact 6;; - : int = 720

Whenever someone complains about not being able to use a slightly different syntax, I assume they just don't have any neuroplasticity anymore.

Re: Why I still reach for Lisp and Scheme instead of Haskell

#25
post #14

Earlier quoted context omitted.

For all practical purposes, the syntax of Lisp isn't just a cosmetic choice, though.

Lisp was meant to be written with M-expressions instead of S-expressions anyway.

M-expressions were never implemented and never used.

Re: Why I still reach for Lisp and Scheme instead of Haskell

#26
post #8

> Lisp hackers have been effortlessly reshaping the language for decades using the powerful macro system and extending and bending the language to their will. I've written a bit of Racket code ( https://github.com/evdubs?tab=repositories&q=&type=&language... ) and I still haven't written a macro. In only one case did I even think a macro would be useful: merging class member definitions to include both the type and t…

Sometime back 15 years ago [0], I hit a bit of an existential crisis regarding my career and the kind of work I was doing.

I thought the particular technology I was working in was "part of the problem", as I felt pigeon-holed by .NET and C# to always be a corporate-monkey CRUD consultant. So, I went out in search of something better. Different programming languages. Different environments. Just something that wasn't working for asshole clients who thought it was okay to yell at people about an outage in a hotel on the complete opposite side of the country that was more due to local radio interference than anything I had done in the database code that configured things. Long story involving missing a holiday with my family over something completely outside of my control and yet I still got blamed for it. The problem wasn't the technology, it was the company I was working for, but at that time in my life, I didn't understand the difference.

Racket was a life preserver at that time.

It's really hard to explain, because I never actually ended up working in Racket full-time and I haven't even touched it in probably 10 years. But it still has this impact on my identity as a software developer. I learned Racket. I forced myself out of being a Glub programmer and into someone who saw the strings that underwrote The Universe. The beauty of S-Expressions and syntactic forms and code-is-data and all that. It had a permanent impact on my view of what this job could be.

I still work primarily in .NET. Most of the things that were technological issues about .NET Framework got absolved by what was first .NET Core and what is now .NET. So, I no longer feel like my tools are holding me back. And I'll forever be thankful to Racket (and the community! The Racket listserve was amazing back then. Probably still is, I just don't interact with it anymore) for being there for me.

Edit: Haskell was in fact another language I explored at that time, in addition to Ocaml and Ruby and Python (ugh! Don't get me started on Python!) and many other things. They were all "cool" in their own way, but nothing felt like Racket. They all had their own weird rules that felt like being bossed at again. Racket felt like art. Racket felt like it was there for me, not the other way around.

[0] I still think of this time as the "mid-point" in my career, but it's now been long enough ago that I've been more past the crisis than I was ever in it. Strange feelings.

Re: Why I still reach for Lisp and Scheme instead of Haskell

#27
post #14

Earlier quoted context omitted.

Lisp was meant to be written with M-expressions instead of S-expressions anyway.

M-expressions were never implemented and never used.

Except in mathematica - which isn’t formally a lisp, but practically it’s used like one a lot of the time.

Re: Why I still reach for Lisp and Scheme instead of Haskell

#28
post #14

Earlier quoted context omitted.

Lisp was meant to be written with M-expressions instead of S-expressions anyway.

M-expressions were never implemented and never used.

Haskell's syntax comes from ISWIM, which was motivated quite a lot by m-expressions.

Re: Why I still reach for Lisp and Scheme instead of Haskell

#30
post #8

> Lisp hackers have been effortlessly reshaping the language for decades using the powerful macro system and extending and bending the language to their will. I've written a bit of Racket code ( https://github.com/evdubs?tab=repositories&q=&type=&language... ) and I still haven't written a macro. In only one case did I even think a macro would be useful: merging class member definitions to include both the type and t…

For what it's worth, anytime I have written a macro it's usually not because it's needed, but just because I think it'll be fun :)
Post reply on HN