netzstaub

beatz & funkz

Wednesday, March 9, 2005

Utz utz das Technomuseum

Kam gerade in einer Mail, die mir der liebe Mrf gevorwärtst hat. Ursprünglich über die netaudio Mailingliste. Ein kleines Lisp Snippet hat das übrige erledigt.

Das Technomuseum


(defun load-techno-urls (file)
  (with-open-file (s file :direction :input)
    (loop for l = (read-line s nil 'eof)
	  with last-url = nil
	  with res = nil
	  until (eql l 'eof)
	  do (if (and (>= (length l) 7)
		      (string-equal (subseq l 0 7) "http://"))
		 (progn
		   (when last-url
		     (push last-url res))
		   (setf last-url (string-trim (list #\Space #\Tab #\Newline) l)))

		 (if (and (>= (length l) 1)
			  (eql (char l 0) #\Space))
		     (when last-url
		       (push last-url res)
		       (setf last-url nil))
		     (when last-url
		       (setf last-url (concatenate 'string last-url l)))))
	  finally (return (remove-duplicates (cons last-url res) :test #'string-equal)))))
posted by manuel at 10:32 am  

No Comments »

No comments yet.

RSS feed for comments on this post.

Leave a comment

Powered by WordPress