←back to thread

Hofstadter on Lisp (1983)

(gist.github.com)
372 points Eric_WVGG | 8 comments | | HN request time: 0.205s | source | bottom
1. timonoko ◴[] No.41865389[source]
Maclisp goodness:

  (compress (reverse (explode x)))
Elisp much improved:

  (defun explode (x)
    (if (symbolp x) (setq x (symbol-name x)))
    (string-to-list x))
  (defun compress (x) (concat x))
replies(3): >>41865620 #>>41865873 #>>41869520 #
2. UniverseHacker ◴[] No.41865620[source]
(upgrade (mail (change (trash (fix (break (use (buy it))))))))
replies(1): >>41866887 #
3. timonoko ◴[] No.41865873[source]
I was wrong: It was "implode" in Maclisp.

  (compress (reverse (explode 'ABC)))
  ;COMPRESS UNDEFINED FUNCTION OBJECT

  (implode (reverse (explode 'ABC)))
  CBA
The point being that I never learn any fancy string-processing commands. I just implement explode and compress.
4. fuzztester ◴[] No.41866887[source]
(learn (lisp) with fixnum parentheses)

https://en.m.wikipedia.org/wiki/Teach_Yourself_Scheme_in_Fix...

replies(2): >>41869421 #>>41869617 #
5. ◴[] No.41869421{3}[source]
6. g19205 ◴[] No.41869520[source]
this is how explode behaves on a lisp machine:

    (defun explode (x)
       (mapcar (lambda (x)
          (intern (char-to-string x)))
        (string-to-list (prin1 x))))
turning character into symbol seems natural, because then you are reducing your needed function space even more. I'm surprised the original operated on prin1 output, not sure what the logic behind that is. on a lisp machine (zl:explode "foo") gives me '(|"| |f| |o| |o| |"|)
7. UniverseHacker ◴[] No.41869617{3}[source]
https://www.wikihow.com/Develop-a-Sense-of-Humor
replies(1): >>41873557 #
8. fuzztester ◴[] No.41873557{4}[source]
he he. good one.

but you may have misunderstood what I meant.

I wasn't criticizing you.

it was just a joke related to that scheme book.