Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Your eli looks clunky to me.


Well, use something else.

And maybe ask yourself why you felt saying so was important to you.


    (the number (+ 35 7))
is a lot less clunky than

    (+ 35 7)@Numeric


One problem with Lisp is everything, including variable bindings, increases the nesting level making the code illegible. Last thing you want is for the type declaration to have their own nesting.


You'd love threading macros in Racket: https://docs.racket-lang.org/threading/index.html

It's like Unix pipes for functions:

  (~> "hello"
    (string-ref 1)
    (char->integer))


Obviously, also available in CL, in Serapeum library[1]. Racket is credited in the docstring (since it's ~> instead of ->). Also, `nest` works very well for unnesting forms[2]

[1] https://github.com/ruricolist/serapeum/blob/master/control-f...

[2] https://github.com/ruricolist/serapeum/blob/master/REFERENCE...


Aside from the points that others have raised already, this sort of deep nesting can be seen as a feature instead of as a bug, since it can force you to think about refactoring the code into being less nested.


The nesting level doesn’t necessarily impair legibility, it depends how it’s done. Nesting levels in homoiconic & referentially transparent languages have an impact more comparable to nesting levels in yaml or json than nesting levels in a language like python or javascript. The tradeoff weighs in a completely different way.

First you will usually want to write small chunks of code, instead of a large soup.

Second, you can make intentional decisions with your use of newlines in order to highlight specific aspects of the code.

I find clojure more readable than most other languages… However, bad code stands out horribly (which is actually great if you have at least one experienced engineer in the team- I’d argue there’s nothing worse than bad code that looks normal). Just like anything else, writing good lisp takes some skill.

Your specific editor and its configuration will also have a big impact on your experience.


If you hate nesting, just do this

    (defun foo (&aux bar baz)
      (setq bar (quux)
            baz (xyzzy))
      ...)


This is not necessarily true, you can pretty easily implement just about any syntax you want


That's your opinion, I don't agree. And the other reason is I can use the same syntax wherever I want type checking.


Opinions aside, it is objectively an increase in syntactical complexity, and many people who love lisp enjoy its relative syntactical simplicity.

Whatever is gained in exchange for this additional syntactical complexity may not be valued in the same way by everyone.

So that almost certainly explains that reaction.


Yes, and a lot of people recognize the value of having a little bit of syntax in their Lisp.


Yup. Somehow, I prefer[1]:

    (funcall #~s:gi/abc/def/ "Testing abc testing abc")
to the five lines of the equivalent made with macros, function calls, and keyword arguments.

I know all the problems with reader extensions, really. I understand being cautious. But at some point, you gotta wonder: what's the point of the programmable reader when you're unwilling to add programs to it?

[1] Let over Lambda: https://letoverlambda.com/index.cl/guest/chap4.html


I'm reasonably happy with:

  1> (regsub #/abc/ "def" "Testing abc testing abc")
  "Testing def testing def"




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: