Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

post you are run length encoding in lisp

Name: Anonymous 2014-10-05 3:18

critique mine pl0x:

(defun rle (str) ;run length encoding
(let ((i 0) c count out)
(while (< i (length str))
(if (eq c (elt str i))
(setq count (1+ count))
(when c
(setq out (append out (list (cons c count)))))
(setq c (elt str i))
(setq count 1))
(setq i (1+ i)))
(when c (setq out (append out (list (cons c count)))))
out))

Name: Anonymous 2014-10-11 21:52

>>60
Why bother checking the return value of malloc? If you're out of virtual memory, you might as well crash anyway, which the proceeding null pointer dereference will do for you. Half the point of UNIX was that it crashed quickly on error instead of trying to handle every silly error condition and bloating the fuck out of the code for little gain.

>>61
No shit, run-length encoding doesn't perform well on text files. Doooo yoouuuuu seeeee annyyyyy runnns offf characterrrrsss in regularrrr text?

You're not the real L.A. Calculus, go away.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List