4 ms·
Maclisp goodness: (compress (reverse (explode x))) Elisp much improved: (defun explode (x) (if (symbolp x) (setq x (symbol-name x))) (string-to-l
by timonoko 2y ago
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))
- _yb2s 2y ago(upgrade (mail (change (trash (fix (break (use (buy it))))))))
- fuzztester 2y ago(learn (lisp) with fixnum parentheses) https://en.m.wikipedia.org/wiki/Teach_Yourself_Scheme_in_Fixnum_Days https://en.m.wikipedia.org/wiki/Teach_Yourself_Scheme_in_Fix...
- deleted 2y ago[deleted]
- _yb2s 2y agohttps://www.wikihow.com/Develop-a-Sense-of-Humor https://www.wikihow.com/Develop-a-Sense-of-Humor
- fuzztester 2y agohe 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.
- timonoko 2y agoI 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.
- g19205 2y agothis 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| |"|)