Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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))


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.


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| |"|)


(upgrade (mail (change (trash (fix (break (use (buy it))))))))




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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: