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

lame as fuck

Name: Anonymous 2009-08-12 10:30

Wow this thread is lame as fuck. Its filled with the same guy posting to keep his thread alive. Fuckin pathetic.

Name: Anonymous 2009-08-13 2:57

Time to make this thread more /prog/ related:

Mr. UMH memesmith, I found that the UMH meme is a suitable test case for a toy program I've written, so I'll post it here:


;;; SPLIT-SEQUENCE package is required
(asdf:oos 'asdf:load-op 'split-sequence)

(defun split-by-delims (delims str &rest rest)
  (apply #'split-sequence:split-sequence-if #'(lambda (x) (member x delims)) str rest))

(defun string->char-list (str)
  (loop for char across str
       collect char))

(defun split-by-delim-string (delims str &rest rest)
  (apply #'split-by-delims (string->char-list delims) str rest))

(defun sort-chars (str)
  (sort (copy-seq str) #'char<))

(defun find-anagrams (s)
  (let ((words (split-by-delim-string " :,.!" s :remove-empty-subseqs t))
    (sorted-words (make-hash-table :test #'equal)) ; string compare
    result-list)
    (mapc #'(lambda (x) (pushnew x (gethash (sort-chars (string-upcase x))
                        sorted-words)
                 :test #'string-equal)) ; case insensitive
      words)
    (maphash #'(lambda (key val)
         (declare (ignore key))
         (unless (< (length val) 2)
           (push (nreverse val) result-list)))
         sorted-words)
    (nreverse result-list)))

(find-anagrams "Hello there, OLLEH! How have you been doing lately?
                > my dof... ish dead ;_;
                U MENA HASKALL!?
                > Yes, sir. I mean Haskell.")
;=>(("Hello" "OLLEH") ("MENA" "mean"))


The FIND-ANAGRAMS function is supposed to find anagrams in the input string and return a list of groups (lists) of all the instances of these anagrams: identical anagrams belong to the same group.

It'd be interesting to see a Haskell implementation of this, I wonder if it would be more succinct.

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