Live data from Hacker News

Why I still reach for Lisp and Scheme instead of Haskell

jointhefreeworld.org

151–160 of 172 posts

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

#151

> Actually, in my opinion, Scheme (and Lisp) allows you to express complex systems and problem domains in more simple terms than any other language can. I disagree with this. Lisps are procedural languages like most other programming languages. They can describe procedures in a relatively simple manner (big asterisk on that one, the simplicity of Lisp as a language is greatly overstated and conflated with the simplic…

Prolog is great for the cases where logic programming makes sense but you can easily create a logic engine in Lisp (or other languages - that's what kanren/minikanren which has been ported to many languages)

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

#152

> Actually, in my opinion, Scheme (and Lisp) allows you to express complex systems and problem domains in more simple terms than any other language can. I disagree with this. Lisps are procedural languages like most other programming languages. They can describe procedures in a relatively simple manner (big asterisk on that one, the simplicity of Lisp as a language is greatly overstated and conflated with the simplic…

Prolog is great for the cases where logic programming makes sense but you can easily create a logic engine in Lisp (or other languages - that's what kanren/minikanren which has been ported to many languages)

Exactly, clojure.core.logic is an example Minikanren inspired logic engine.

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

#153

> Actually, in my opinion, Scheme (and Lisp) allows you to express complex systems and problem domains in more simple terms than any other language can. I disagree with this. Lisps are procedural languages like most other programming languages. They can describe procedures in a relatively simple manner (big asterisk on that one, the simplicity of Lisp as a language is greatly overstated and conflated with the simplic…

Prolog is great for the cases where logic programming makes sense but you can easily create a logic engine in Lisp (or other languages - that's what kanren/minikanren which has been ported to many languages)

Of course, it holds for all turing complete languages, that's what computational class is all about. It's not a good argument to use or not use something though, because in practice it's always worse. You can think of it like this, would you rather write programs with SBCL or some company's internal unnamed domain-specific tree-walking sexpr language that doesn't even have macros, TCO or a real REPL and possibly isn't even turing complete? Would you ever in a million years suggest that the latter is even half as good as proper CL, let alone a replacement? I sure wouldn't.

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

#154
post #74

Earlier quoted context omitted.

That sort of hotfix workflow isn't really a thing in Racket or Scheme in general. Changing the definition of a function doesn't update everything else that calls that function like it does in CL. Maybe emacs lisp works that way?

You know, after some testing with a bunch of different scheme implementations, I take back what I said, at least for working in a REPL. (define (displayln msg) (display msg) (newline)) (define (inner x) (+ x 1)) (define (outer x) (inner x)) (displayln (outer 5)) (define (inner x) (+ x 2)) (displayln (outer 5)) outputs 6 and 7 in every one I tried, not the 6 and 6 I expected.

Perhaps you were thinking of lexical scope vs dynamic scope? Lexical scoping would prevent a local definition of inner from changing the definition used in outer.

  (let ((inner (lambda (x) (+ x 3)))) (outer 5))
  "7"
But updating the definition of inner with set! or define changes the top-level definition.

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

#155
post #99

Earlier quoted context omitted.

The other motivation for me is to drastically reduce boilerplate code. I can’t believe people here are saying they never use macros, they are so good for this that avoiding them sounds to me like a skill issue! Overuse can damage readability, sure, but so can pretending macros are not an option.

Operatives do that for me, better than macros. Parent is correct that macros are compile time, which gives them a performance advantage over operatives - but IMO, they're not better ergonomically. I find operatives simpler, cleaner and more powerful.

I hadn't heard of operatives. Can you describe them or provide a link?

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

#156
post #150

> Actually, in my opinion, Scheme (and Lisp) allows you to express complex systems and problem domains in more simple terms than any other language can. I disagree with this. Lisps are procedural languages like most other programming languages. They can describe procedures in a relatively simple manner (big asterisk on that one, the simplicity of Lisp as a language is greatly overstated and conflated with the simplic…

I think it all depends on the shape of the problem. I love Prolog for its expressive power, sometimes. Complex simulation problems are really nice to model in OCaml or CLOS, and then again, maybe remodelling in Prolog brings some insights. And often writing a recursive function in Lisp is all you need to understand a complex system. It's all layers. An outer shell to prolog would be a theorem solver for example, beca…

> An outer shell to prolog would be a theorem solver for example, because Prolog is a very rudimentary one.

I think it's the wrong way to look at it. It's not that Prolog is a rudimentary theorem solver, it's that theorem provers are a specialized use-case of deductive proofs, so a computational foundation of FOL makes them trivial to write as programs. A pile of bricks and a jar of mortar isn't a rudimentary house, so to speak.

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

#157
post #68
post #58

Earlier quoted context omitted.

So you want to line the equals signs up or similar? let f = 9 fo = 10 foo = 123 in f+fo+foo vs. let f = 9 fo = 10 foo = 123 in f+fo+foo

No, the issue is if the first binding is on the same line as the `let`, you are required to write, e.g.: someValue = let f = 9 fo = 10 foo = 123 in f+fo+foo rather than: someValue = let f = 9 fo = 10 foo = 123 in f+fo+foo I think it used to be the case that it had to be indented past the `=` or the `let` even if it was't on the same line. Note also that `in` has to be indented past `someValue`, but doesn't need to be…

In Haskell, you can do, if you prefer,

    someValue = let {f = 9;
      fo = 10;
      foo = 123 }
      in f+fo+foo
it will just look a little out of place.

Edited to add that this is also OK:

    someValue = let 
      f = 9
      fo = 10
      foo = 123
      in f+fo+foo

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

#158

Earlier quoted context omitted.

M-expressions were never implemented and never used.

Actually, variations on M-expressions have been created many times in the Lisp world. (Look what you can do with macros!) So far, none of them has caught on. The latest attempt for Scheme is SRFI-266, which creates a very nice infix expression sublanguage. If I were working on a team, I would encourage them to use this, but I don't know if it has enough traction to become widespread.

It's a common mistake to think that the syntax of Lisps are a problem. People solving the supposed problem then discover it wasn't something that needed to be solved.

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

#160

Earlier quoted context omitted.

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…

> [...] who thought it was okay to yell at people about [...] That society as a whole accepts this kind of abuse, no matter industry or circumstances, is beyond me. It's an abuse of power. If anybody did this to anyone, the only appropriate response should be to walk and never come back. Nobody would want to accept this kind of crap from family and friends, so why is it ok in a professional setting? Because of the mo…

I had the "good fortune" to lose everything I owned in an flood shortly after that incident. The insurance payout paid off all my debts. I was single and had no material attachments to the world. I suddenly felt no compunction to suffer any disrespect anymore.

Got fired shortly thereafter for basically refusing to commit timesheet fraud. That's when I went on my "programming language walkabout." It was an amazing time.

Now I have a wife and kids and a mortgage. But also now I'm the boss, working hard to not inflict the same bullshit on my people that was inflicted upon me.

Post reply on HN