by dgreensp · 11y ago · 0 comments
(define map
{ (A --> B) --> (list A) --> (list B) }
F [] -> []
F [ X | XS ] -> [(F X) | (map F XS)])
And this is one of the cases without any semicolons.Shen also uses the atrocious "curried form" of function types, where the function that adds two numbers has type number->number->number, and the reader must do the mental gymnastics to convert it to (number,number)->number (and good luck when it's more complicated than that).
I wonder if you took a language like Haskell and changed some of the syntax to look Lispy if it could masquerade as a Lisp? I'm not saying that's what's happening, it's just hard to wrap my head around a syntax like this that claims to be Lispy.
(defun map (f l)
(shen.map-h f l ()))
(defun shen.map-h (f l accum)
(cond ((= () l) (reverse accum))
((cons? l) (shen.map-h f (tl l) (cons (f (hd l)) accum)))
(true (shen.f_error shen.map-h))))