Skip to content

Instantly share code, notes, and snippets.

@Liutos
Created February 3, 2013 02:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Liutos/4700314 to your computer and use it in GitHub Desktop.
Save Liutos/4700314 to your computer and use it in GitHub Desktop.
The code with optimization declaration may make SBCL to note some *unable to optimize* message.
(defun parse-params (s)
(labels ((aux (acc s)
(declare (optimize (speed 3)))
(let ((i1 (position #\= s))
(i2 (position #\& s)))
(cond (i1 (aux (cons (cons (intern (string-upcase (subseq s 0 i1)))
(decode-param (subseq s (1+ i1) i2)))
acc)
(and i2 (subseq s (1+ i2)))))
((equal s "") nil)
(t acc)))))
(nreverse (aux '() s))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment