I used Common Lisp from the mid 1980s until about 5 years ago when my customers wanted Clojure, if they wanted Lisp development done. I have never seriously used CL as a scripting language but for a while I was using Gambit-C Scheme for small compiled apps and command line tools. Gambit-C is very good for this purpose. BTW, Clojure is "out" for command line tools because of the JVM startup time but I have thought abo…
Pixie[1] is also worth a look. It's Clojure-like scripting language written in RPython. [1] https://github.com/pixie-lang/pixie
Common Lisp as a Scripting Language, 2015 Edition
11–20 of 42 posts
Re: Common Lisp as a Scripting Language, 2015 Edition
#12I have my own scheme-esque language that I use for scripts. 16 of its 48 primitive procedures ~correspond to unix system calls (open, close, read, write, seek, select, stat, link, unlink, mkdir, lsdir, chdir, fork+exec, wait, sleep, exit). It was very instructive to work on, and using something I know inside out is a welcome relief from the uncertainty I feel when intuiting (ba)sh.
Any reason you don't use one of the existing scriptable scheme like guile's?
Here is a reimplementation of "cat" in it:
#!/usr/bin/env imp
(def copy-out (proc (x)
(let f (if (file? x) x (open x))
bytes (read default-chunk f)
(if bytes
(seq (write bytes stdout)
(recur f))
(close f)))))
(if (nil? script-args)
(copy-out stdin)
(each copy-out script-args))
Running external programs is a bit more verbose than normal shell, but there is some optional reader-macro sugar on top of fork+exec, e.g. the effect of the following is that /usr/bin/say gets run with those non-string args converted to strings and a voice comes out of my speaker. !(say hello there)
=> ((status : 0) (pid : 2945) (in : [File]) (out : [File]) (err : [File]))Re: Common Lisp as a Scripting Language, 2015 Edition
#13Earlier quoted context omitted.
Any reason you don't use one of the existing scriptable scheme like guile's?
Wanted to put my article-gleaned understanding of lisp to the test + get at the essence of what shebang-style unix scripting was about. Here is a reimplementation of "cat" in it: #!/usr/bin/env imp (def copy-out (proc (x) (let f (if (file? x) x (open x)) bytes (read default-chunk f) (if bytes (seq (write bytes stdout) (recur f)) (close f))))) (if (nil? script-args) (copy-out stdin) (each copy-out script-args)) Runnin…
fair enough!
> get at the essence of what shebang-style unix scripting was about
FWIW, although convoluted, you can do that with guile, with:
#!/usr/bin/guile \
-e main -s
Or simpler with chicken: #!/usr/bin/csi -sRe: Common Lisp as a Scripting Language, 2015 Edition
#14I used Common Lisp from the mid 1980s until about 5 years ago when my customers wanted Clojure, if they wanted Lisp development done. I have never seriously used CL as a scripting language but for a while I was using Gambit-C Scheme for small compiled apps and command line tools. Gambit-C is very good for this purpose. BTW, Clojure is "out" for command line tools because of the JVM startup time but I have thought abo…
Re: Common Lisp as a Scripting Language, 2015 Edition
#15Earlier quoted context omitted.
Pixie[1] is also worth a look. It's Clojure-like scripting language written in RPython. [1] https://github.com/pixie-lang/pixie
Indeed pretty cool, clojure implemented in rpython!
(import [sh [cat grep wc]])
(->
(cat "/usr/share/dict/words")
(grep "-E" "^hy")
(wc "-l"))Re: Common Lisp as a Scripting Language, 2015 Edition
#16I used Common Lisp from the mid 1980s until about 5 years ago when my customers wanted Clojure, if they wanted Lisp development done. I have never seriously used CL as a scripting language but for a while I was using Gambit-C Scheme for small compiled apps and command line tools. Gambit-C is very good for this purpose. BTW, Clojure is "out" for command line tools because of the JVM startup time but I have thought abo…
Re: Common Lisp as a Scripting Language, 2015 Edition
#17If you can cut the size of the core language's image in half with just a simple method like this, you could probably get impressive results using more sophisticated methods on images requiring a lot of libraries: https://gist.github.com/burtonsamograd/f08f561264ff94391300
Re: Common Lisp as a Scripting Language, 2015 Edition
#18I used Common Lisp from the mid 1980s until about 5 years ago when my customers wanted Clojure, if they wanted Lisp development done. I have never seriously used CL as a scripting language but for a while I was using Gambit-C Scheme for small compiled apps and command line tools. Gambit-C is very good for this purpose. BTW, Clojure is "out" for command line tools because of the JVM startup time but I have thought abo…
Nitpick, but Clojure's startup time isn't JVM startup time it's clojure.core startup time
Re: Common Lisp as a Scripting Language, 2015 Edition
#19Re: Common Lisp as a Scripting Language, 2015 Edition
#20I do have some compiled programs I use, but IMO they're a little too big to be called scripts.
An interesting idea would be the ability to dump a shared library of the core image, and then dump incremental changes as executable images that dynamically link to it.