newLISP Fan Club

Forum => newLISP newS => Topic started by: fdb on March 27, 2025, 06:36:37 AM

Title: Wisp to new lisp
Post by: fdb on March 27, 2025, 06:36:37 AM
Hi,
last week I got nerd-sniped when I saw an alternative to the 'parens-heavy' syntax of newlisp, wisp: https://www.draketo.de/software/wisp (https://www.draketo.de/software/wisp).

I've seen more alternative lisp syntaxes over the years (f.i. rhombus, shrubbery in Racket) but this is the first time that I can see this a viable alternative so I made a small newlisp module (indent.lsp) which you can download from https://github.com/luxint/wisp-newlisp (https://github.com/luxint/wisp-newlisp).


As an example this is wisp syntax:

define : factorial n
  if : zero? n
    . 1
    * n : factorial : - n 1

which gets then transpiled into:

(define (factorial n )
  (if (zero? n)
    1
    (* n (factorial (- n 1)))))


Have fun and let me know if you like it!




Title: Re: Wisp to new lisp
Post by: cameyo on June 07, 2025, 10:36:27 AM
Interesting, but I'm fond of parentheses. :)
Title: Re: Wisp to new lisp
Post by: itistoday on June 13, 2025, 04:44:12 PM
Yeah same here, parenthesis make everything easy to understand for me, I honestly don't get why anyone hates them.
Title: Re: Wisp to new lisp
Post by: rrq on June 13, 2025, 09:11:43 PM
Yes I like parentheses too 8) . I remember Interlisp having square brackets as "meta parentheses" so as to avoid strings of stopping parentheses; the two forms interoperated so that ']' closed all '(' to match prior balancing '[', and likewise ')' closed all '[' to match prior balancing '('.
One could then write for example the following
(define (factorial n)
    [if (zero? n)
        1
        (* n (factorial (- n 1 ] )
Perhaps it's clearer? But the reader has to know the syntax in any case.