Gih's Blog

只言片语

这么玩 lisp,实在让人蛋疼!

2014-09-08 by gihnius, tagged as lisp

取个环境变量都要这么折腾:

(defun getenv (var)
  #+cmu (cdr (assoc (if (symbolp var)
                        var
                        (intern var :keyword))
                    ext:*environment-list*))
  #+sbcl (sb-ext:posix-getenv (string var))
  #+lispworks (hcl:getenv var)
  #+clisp (ext:getenv (string var))
  #+allegro (sys:getenv (string var))
  #-(or cmu sbcl lispworks clisp allegro)
  (error "GETENV not implemented for your Lisp platform."))