‹ BackHN Continuity

Thread

What makes Lisp difficult to read?

47 points · 81 comments · ibobev

  1. whartung · · focus · HN ↗
    The parentheses are large glyphs that distract the eye, and do not stand out (to the untrained eye) as delimiters.

    Consider:

      (defun split-line (line)
        (remove-if #'(lambda (word) (string= word ""))
                   (split-sequence:split-sequence #\Space line)))
    
    Now imagine if we had some "lower weight" glyph besides the paren.

      .defun split-line .line,
        .remove-if #'.lambda .word, .string= word "",,
                   .split-sequence:split-sequence #\Space line,,,
    
    Obviously a contrived example replacing () with ., but you can see how "heavy" the parens and how they can dominate what the eye sees.

    With experience, the parens vanish. The parens being large and common take control of the conversation more than they should.

    1. Avshalom · · focus · HN ↗
      this actually gets at the real problem. Lisps are wordy as hell. like jesus

        (split-sequence:split-sequence #\Space line)
      
      now imagine if that was

        (split-string " " line)
      
      image if the whole function was

        (defun split (line)
          (remove [\(word) (= "" word)] [split-string " " line]))
      
      or even

        (defun split (line)
          (remove "" [split-string " " line]))
      
      
      *using [] in place of rainbow parens for clarity of sub arguments
      1. Jtsummers · · focus · HN ↗

          (split-sequence:split-sequence #\Space line)
        
        Why would you do that? You could just use `uiop:split-string` and import the function symbol into your current namespace so you can call it as `split-string`.

          (split-string "a b c")
        1. Avshalom · · focus · HN ↗
          I mean ask OP, I don't know what's what in the Scheme rXrs or Common Lisp standard libraries.

          Although my general stance remains, most lisp code bases I've seen are remarkably verbose which leads to a glazing over far more than the lack of distinct symbols or prefix notation

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.