Elektrine lite

← Feed

@simon_brooke@mastodon.scot

2026-04-23 05:53 UTC

@janneke@todon.nl @vnikolov@ieji.de @spook@pleroma.m68k.church No. The imperative style was very much frowned upon in all Lisps until Common #Lisp introduced SETF, which sold the pass. We had RPLACA and RPLACD in much the same way as #Prolog has the cut operator: ugly hacks, shameful to use, to get around the inadequacies of our machines. I still think it's best to think of Common Lisp as not Lisp at all but more Fortran-with-brackets. Modern Lisps like #Clojure use immutable data, which makes imperative style impossible.

Replies (5)

  • @simon_brooke@mastodon.scot 2026-04-23 06:03

    @janneke@todon.nl @vnikolov@ieji.de @spook@pleroma.m68k.church (#Scheme is a good #Lisp, though. And certainly a good first-introduction-to-Lisp Lisp).

    Open ##2906920

  • @janneke@todon.nl 2026-04-23 06:16

    @simon_brooke@mastodon.scot @vnikolov@ieji.de @spook@pleroma.m68k.church Ah, that makes so much sense; I've always wondered. So that's why so much "Lisp" code looks so terrible...How sad! Thanks for educating me.

    Open ##2906921

  • @simon_brooke@mastodon.scot @janneke@todon.nl @vnikolov@ieji.de @spook@pleroma.m68k.church Sounds like you haven’t programmed much in Common Lisp…

    Open ##2906923

  • @vnikolov@ieji.de 2026-04-23 07:05

    On the lesser topic. There are at least two notable things about `setf' (the first one smaller, the second one bigger). I. It eliminates the need for explicit setters. If you know how to write a form to get something, you automatically know how to write a form to set it. II. Modify macros become available. To illustrate with `incf': (let ((h (make-hash-table))) (incf (gethash 'foo h 0)) (gethash 'foo h)) works and evaluates to 1. (Does not fail trying to increment a non-existent element.) This is noticeably different from the typical operation of `+='. See also `define-modify-macro'. I'll leave the greater topic, mutability and immutability, for another day. _________ Disclosure I am a descendant of barbarians, who settled in the old Roman province of Thracia. Civis serdicensis sum. 🙂 #CommonLisp #Lisp @simon_brooke@mastodon.scot @janneke@todon.nl @spook@pleroma.m68k.church @pascal_costanza@functional.cafe

    Open ##2906924

  • @amszmidt@mastodon.social 2026-04-30 16:31

    @simon_brooke@mastodon.scot "The imperative style was very much frowned upon" It really was not. It was the normal way of writing code. Bunch of TAGBODY, GOTO and other things. SETF pre-dates Common Lisp by many years. Here is some old fun EH code: https://tumbleweed.nu/r/attic/sys46/file?ci=tip&name=lispm2/eh.316&ln=120-149 That uses SETF. @janneke@todon.nl @vnikolov@ieji.de @spook@pleroma.m68k.church

    Open ##2906938