6 ms·
Wisp: Whitespace to Lisp
- jiyinyiyong 4y agoI made Calcit http://calcit-lang.org/ http://calcit-lang.org/ it's also using indentations to implement S-Expressions. The syntax part is called Cirru http://text.cirru.org/ http://text.cirru.org/ , just using very similar ideas.
- jwilk 4y agoI thought it was going to be about the whitespace programming language: https://en.wikipedia.org/wiki/Whitespace_(programming_language) https://en.wikipedia.org/wiki/Whitespace_(programming_langua... "Indentation to Lisp" would be more accurate.
- klyrs 4y agoWhitespace to forth would be less daunting...
- deleted 4y ago[deleted]
- whalesalad 4y agocool 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 4y agoI’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 4y ago[deleted]
- kazinator 4y agoIf used judiciously, it doesn't find its way into a programming language design.
- Phiwise_ 4y agoI'mremindedofthehistoricalobservationthattheRomanswroteandreadlatinwithnospaces,makingCaesaralinguisticgeniusforthefeatofeasilyreadingletterswithoutspeakingoutloud,whenIreadabsolutistcommentsonwhitespacelikethis. Editor fonts which replace spaces and tabs with what are essentially the appropriate periods or similar make this not a merely hypothetical or anachronistic point.
- ArneBab 4y agoYou can do that in wisp: Inside parentheses (and strings), whitespace processing is halted. define : proc display (string-append "foo" "bar" (format #f "foo~a" 2) ) ; is valid wisp (it would be valid wisp without the indentation in the parentheses, but it would look weird) (empty lines added to prevent hn from stripping newlines)
- zackoverflow 4y agoI used to feel the same way, but after learning Haskell I think whitespace is particularly suited for functional programming languages.
- seabrookmx 4y agoWorks well in F# too!
- thelazydogsback 4y agoParinfer 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
- drcode 4y agoPart 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.
- gilch 4y agoSee https://www.reddit.com/r/whitespaceLisp/ https://www.reddit.com/r/whitespaceLisp/ for more examples.
- Akronymus 4y agoWow, 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 4y agohttps://libredd.it/r/whitespaceLisp/ 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).
- mtlmtlmtlmtl 4y agoIncluding 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.
- jwilk 4y agoIn the other direction (Python with Lisp syntax): https://hylang.org/ https://hylang.org/
- gilch 4y agoOr go full circle: Whitespace to Lisp to Python. https://github.com/gilch/hebigo https://github.com/gilch/hebigo
- bjoli 4y agoYou 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.
- stcredzero 4y agoI 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 4y agoThere 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."
- sedachv 4y agoLanguages where blocks are indicated by indentation are not context-free (you have to keep the current and previous line indentation level as state). Everything about them is more tedious because you can't do structured editing.
- taeric 4y agoApologies if I was unclear, but this is what I meant. In whitespace languages, you have to see the context. That said, you can probably make dinner structural editing work roughly the same. Might benefit from highlighting to indicate current scope.
- ArneBab 4y agoDo you mean highlighting like this? https://www.draketo.de/software/wisp-mode-highlighting-semantic-background-color-interactive-current-line.ogv https://www.draketo.de/software/wisp-mode-highlighting-seman... Many parts of structural editing (but not all) become simple indentation shifting with indentation-sensitive languages.
- martinflack 4y agoA 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 4y agoLisp 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 4y agoI 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 4y ago[deleted]
- mtlmtlmtlmtl 4y agoI 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.
- harperlee 4y agoI was surprised with the lukewarm reception parinfer (which ties indentation with parens, in an automated way, and is compatible with paredit actions) had on the lisp world. I found it invaluable, especially for newcomers. It completely takes out parens-as-a-risk out of the question, effectively turning lisps into formally indentation-based languages, a la python (which is to some extent how everybody reads lisp).
- spogbiper 4y agoWisp 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 4y agoThe 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
- ArneBab 4y agoThere’s also a wisp-derivative for Racket called Wraith: https://github.com/cwebber/racket2-rfcs/blob/wraith/wraith/wraith.md https://github.com/cwebber/racket2-rfcs/blob/wraith/wraith/w...
- Fellshard 4y agoWisp 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/bb2a88bcb053d2195f42c60a0cf15a65 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 4y agoI 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 4y agoPowerShell? I have a very little experience writing Python, but PS and P. are extremely similar.
- epr 4y agoPowerShell and Python have very little in common
- munk-a 4y agoThere are clearly quite a few other differences - but this is one of the reasons I love PHP... a completely sane approach to parenthesis quantity as well as whitespace sensitivity. (It is occasionally whitespace sensitive but only in the places you really want it to be). Also, I think it's a pretty sane comparison language for Python - except with more structure * ducks *.
- drekipus 4y ago> Python, except with braces instead of whitespace There's Hy lang, which is python powered lisp. It'll be good to get some extra attention. https://github.com/hylang/hy https://github.com/hylang/hy
- gilch 4y agoDon't forget Hissp!
- deleted 4y ago[deleted]
- substation13 4y agoCould probably use an F# syntax-highlighter without modification.
- gibsonf1 4y agoI like parenthesis - simple nested containers. All other syntax adds unneeded bug inducing complexity.
- bloppe 4y agoThis 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 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 4y agoAttempts 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 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 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.
- bloppe 4y agoInteresting. For the record, that SRFI is David Wheeler's Sweet Expressions :) I feel like your use of the word "attempts" implies these ideas were unsuccessful, but I would disagree. Perhaps Lisp in general has not "succeeded" in that its original purpose (AI research) has entirely abandoned it, but I think the problem of low general-purpose adoption is overstated. In particular, since Lisp does not play nicely with the C calling convention, it's ability to integrate into polyglot systems has always been problematic, but I have confidence that the future will be better for FFI's in general, perhaps starting with WASM, which hopes to create a "universal ecosystem" of libraries (components). In theory, any program written in Lisp, or Rust, or Javascript, could import any package from PyPI by means of a WASM component. If this becomes reality, Lisp would be much more appealing to people currently put off by the languishing ecosystem and lack of integration, and may yet even have a fighting chance of reclaiming it's AI research credentials, simply by importing numpy :)
- jacknews 4y agoLOL, I'm sure it's a personal taste thing, but to me, significant white-space is the absolute worst feature of python, and other languages that use it. IMHO the IDE is the place to smooth over syntax you don't like.
- djhaskin987 4y agoThis looks like Haskell, and it is just as difficult to tell program structure here as with Haskell. I seriously have to stare at any 3 to 5 lines of Haskell for about 30 seconds before I get anything about what they're saying and I have that same feeling here. Maybe Haskell should use less dollar signs and more parentheses.
- gilch 4y agoHaskell can use brackets, people just don't.