[HN Gopher] Wisp: Whitespace to Lisp
       ___________________________________________________________________
        
       Wisp: Whitespace to Lisp
        
       Author : signa11
       Score  : 49 points
       Date   : 2022-08-08 06:51 UTC (16 hours ago)
        
 (HTM) web link (www.draketo.de)
 (TXT) w3m dump (www.draketo.de)
        
       | spogbiper wrote:
       | Wisp already triggers me to think of wireless internet service
       | providers, written information security plans, windows ink
       | services platform, and the Wisconsin investigators of
       | supernatural phenomenon
        
       | Decabytes wrote:
       | The Racket folks are trying to create a parens light language
       | called Rhombus that allows for easily creating
       | macros/dsls/languages like lisps normally have. Some of the ideas
       | proposed are indentation/white space based though I think they
       | have settled on something similar to honu recently
        
       | jwilk wrote:
       | In the other direction (Python with Lisp syntax):
       | 
       | https://hylang.org/
        
         | bjoli wrote:
         | You should check python-on-guile. It compiles Python to
         | (unidiomatic) Scheme. The resulting code uses delimited
         | continuations and mutation EVERYWHERE, and still manages to
         | beat python on all my old project Euler solutions.
        
         | gilch wrote:
         | Or go full circle: Whitespace to Lisp to Python.
         | 
         | https://github.com/gilch/hebigo
        
       | gibsonf1 wrote:
       | I like parenthesis - simple nested containers. All other syntax
       | adds unneeded bug inducing complexity.
        
       | jwilk wrote:
       | I thought it was going to be about the whitespace programming
       | language:
       | 
       | https://en.wikipedia.org/wiki/Whitespace_(programming_langua...
       | 
       | "Indentation to Lisp" would be more accurate.
        
         | klyrs wrote:
         | Whitespace to forth would be less daunting...
        
       | whalesalad wrote:
       | cool experiment, but whitespace is a terrible delineator.
       | ironically one of the most disliked parts of lisp by newcomers,
       | the parens, ends up becoming its greatest strength once you have
       | grokked things.
        
         | dismantlethesun wrote:
         | I'm used to whitespace as a delineator thanks to python. If
         | used judiciously it can be a great benefit.
         | 
         | I do admit it would be nice if it were optional so you could
         | have more complicated expressions than you can easily write
         | with paired brackets/braces/parentheses.
        
           | [deleted]
        
           | kazinator wrote:
           | If used judiciously, it doesn't find its way into a
           | programming language design.
        
         | zackoverflow wrote:
         | I used to feel the same way, but after learning Haskell I think
         | whitespace is particularly suited for functional programming
         | languages.
        
           | seabrookmx wrote:
           | Works well in F# too!
        
       | thelazydogsback wrote:
       | Parinfer hits the sweet-spot for me -- you still get the benefits
       | of the parens, but the indentation is still enforced to match,
       | and changing either one causes the other to be updated
       | accordingly
        
       | [deleted]
        
       | Fellshard wrote:
       | Wisp is an addictive /idea/, even if the net benefit ends up not
       | being terribly strong. But combined with some other changes in
       | assumptions, there might be some interesting insights. I've
       | tinkered with this idea for a bit.
       | https://gist.github.com/armstnp/bb2a88bcb053d2195f42c60a0cf1...
       | 
       | Heading this direction, things almost start to smell point-free.
       | Functions begin to be designed to take elements likely to be
       | recursive as their last argument. And a placeholder ('[?]') could
       | be used to select the recursive slot otherwise.
        
       | loxias wrote:
       | I want something like this, except the opposite.
       | 
       | Python, except with braces instead of whitespace. (Syntactically
       | significant whitespace kills me.)
       | 
       | Or a tool which makes reading easier by adding parens where they
       | would otherwise be implied.
        
         | justsomehnguy wrote:
         | PowerShell?
         | 
         | I have a very little experience writing Python, but PS and P.
         | are extremely similar.
        
           | epr wrote:
           | PowerShell and Python have very little in common
        
       | stcredzero wrote:
       | I remembers, almost a decade ago, I got into an argument with
       | someone here, who thought that significant whitespace languages
       | were somehow SO fundamentally different, that they couldn't be
       | translated back and forth to a bracket delimited language. (This
       | is one of the hazards of not getting a formal education, or of
       | not having enough curiosity to self educate at a deep enough
       | level.)
        
         | taeric wrote:
         | There probably is something to the point that whitespace
         | languages need more context to know what is going on? Moving
         | code, in particular, is a bit more tedious with it. That said,
         | I'm curious why anyone would think it can't be just as
         | "mechanical."
        
       | drcode wrote:
       | Part of the formative process of every true Lisp programmer is at
       | some point to spend 2 months creating a parens-free lisp dialect,
       | and then abandoning it.
        
         | anothernewdude wrote:
         | I'm not alone!
        
         | gilch wrote:
         | See https://www.reddit.com/r/whitespaceLisp/ for more examples.
        
           | Akronymus wrote:
           | Wow, reddit is HOSTILE to non app, no account users. "this
           | community is available in the app" previously it used to be
           | only nsfw thar gets locked.
           | 
           | Well, back to old.reddit.
        
           | herewulf wrote:
           | https://libredd.it/r/whitespaceLisp/
           | 
           | .. if the page demands that you use the app on mobile (and I
           | find this site's layout far superior).
        
         | hinkley wrote:
         | I suspect the person who came up with
         | 
         | (((((((((((((((((((((( In Stereo, Where Available
         | )))))))))))))))))))))))))))
         | 
         | had prior experience/trauma with Lisp.
         | 
         | And one of you fuckers is going to tell me that there are more
         | closing parens than open ones. I did that on purpose, and
         | you've fallen into my trap.
        
         | mtlmtlmtlmtl wrote:
         | Including the the inventor himself(look up M-expressions)!
         | 
         | Part 2 is spent wailing in misery that not all languages use
         | the clearly superior S-expression syntax
         | 
         | Part 3 is spent making a macro to write your favourite language
         | as S-expressions, from a lisp environment.
         | 
         | Finally, part 4 is accepting that we can't have nice things.
        
           | Akronymus wrote:
           | Part 5 is writing macros to make certain things parens free
        
             | giancarlostoro wrote:
             | Correct me if I'm wrong but isn't that part of what Arc
             | did? I don't recall specifics. I'm also reminded of the old
             | PHP hack of using arrays as an ORM for queries.
        
           | rakoo wrote:
           | Aka the 5 stages of grief
        
       | bloppe wrote:
       | This is a great idea. Of course, it's not new. Looks like Wisp
       | was first described in 2013, the same year SRFI 110 [1]
       | describing largely the same idea was also published. That SRFI
       | helpfully includes a "related" section describing prior art and
       | more detailed raionale / tradeoff analysis that some might find
       | interesting.
       | 
       | [1]: https://srfi.schemers.org/srfi-110/srfi-110.html
       | 
       | Everybody seems to want to describe these ideas as "Python-like".
       | I personally think the JSON / YAML distinction is a more apt
       | comparison, since the latter is a backwards-compatible "superset"
       | of the former, and it's also a nod to the duality of data / code
       | in Lisp :)
        
         | kazinator wrote:
         | Attempts to have some alernative syntax for Lisp go back to the
         | orignal Lisp project. In addition to the abandoned
         | M-expressions, there is a reason why the updated version of
         | Lisp was Lisp 1.5.
         | 
         | There was a Lisp 2 in the 1960's: a project which added Algol-
         | like syntax and semantics on top of Lisp, with faster numeric
         | processing.
         | 
         | https://en.wikipedia.org/wiki/LISP_2
         | 
         | In the 1970's, there was CGOL, which the Wikipedia article says
         | "may be regarded as a more successful incarnation of some of
         | the essential ideas behind the earlier LISP 2 project".
         | 
         | https://en.wikipedia.org/wiki/CGOL
         | 
         | Fast forwarding to modern times, in addition to Wisp and the
         | SRFI, there are also David Wheeler's Sweet Expressions and
         | other things of that ilk.
        
       | martinflack wrote:
       | A cool project... but instead I suggest to everyone who uses
       | Lisp, just set your editor's syntax highlighter to make the
       | parentheses fade into the background color almost completely.
       | They're still there, for correctness, structured editing, and
       | ease of sharing with others; but they don't stand out.
        
         | retrac wrote:
         | Lisp also really benefits from an editor that colourizes ( ) in
         | matching pairs. Even C benefits from colour-matching {} in my
         | experience. I'm surprised it's not more common.
        
           | azeirah wrote:
           | I believe Jetbrains IDEs do this by default for certain
           | languages, I know HTML for sure.
           | 
           | That, or I have a plugin running in the background for years
           | without me noticing.
        
           | [deleted]
        
           | mtlmtlmtlmtl wrote:
           | I got used to Lisp before I knew rainbow-parens were a thing.
           | Then I tried it and found it added nothing. I'm sure it would
           | be helpful as a learning tool though.
           | 
           | What I really can't recommend enough is paredit. It ensures
           | balanced parens by always creating a close to an open. Typing
           | a close just jumps you past the nearest close after the
           | cursor. Along with the thing where the cursor momentarily
           | jumps to the open paren when going past a close paren.
           | 
           | When I need to add another expression to a scope, I just hit
           | close paren until I see the jump to the relevant open paren
           | then hit enter.
           | 
           | I do know some older(than me) Lisp programmers who even find
           | paredit excessive though.
           | 
           | Eventually, I found that when reading lisp I almost never
           | actually look at the parens at all, only the indentation.
        
       | substation13 wrote:
       | Could probably use an F# syntax-highlighter without modification.
        
       ___________________________________________________________________
       (page generated 2022-08-08 23:01 UTC)