5 ms·
Is this just trolling? Why a let and "hello0"? Is that just to make it look weird on purpose? (define (hello) (displayln "Hello, World!")) (
by jcromartie 11y ago
Is this just trolling? Why a let and "hello0"? Is that just to make it look weird on purpose?
(define (hello)
(displayln "Hello, World!"))
(hello)
- ahoge 11y agohttps://en.wikipedia.org/wiki/Scheme_%28programming_language%29#Input.2Foutput https://en.wikipedia.org/wiki/Scheme_%28programming_language...
- thechao 11y agoI used to program in a LISP (the language predates Lisp) derivative called "Boot". (It booted a computer algebra system.) It added two rules to LISP: unparenthesized expressions bind "to the function call", using dynamic lookup to determine arity, and failing if the binding wasn't unambiguous; and, ';' to delimit expressions. It's been a decade since I used the language, but it would look something like this: define (hello) displayln "Hello, World!"; hello; The boot 'compiler' only did name resolution and parenthesization, then it kicked everything back to an underlying LISP. (In this case, SBCL, which rocked!) The second level language built on Boot was Spad, which used a slightly friendlier syntactic top-form: e : t = x With compact forms: e := x e = x e : t e Which lets you uniformly parse packages, modules, domains, categories, functions, annotations, etc. etc. For instance, we had a Spad-lite syntax: Monoid : Domain = public : _* : (y : Monoid), (x : Monoid) _0 : Monoid Then you could assert membership: assert(Integer, Monoid) := _* : (y : Integer), (x : Integer) = (_*:Integer)(x, y) _0 = (0:Integer) An implementation would be: Monoid : Domain = public : -- see above. = implements : -- implementations.
- agumonkey 11y agoQuite a beautiful addition to sexps. I've seen implicit rules about top-level expression being implicitely wrapped in parens you one can write defun fact (n) (cond .. ..) which makes lisp so much more bearable to parensophobic people.