Live data from Hacker News

Common Lisp as a Scripting Language, 2015 Edition

fare.livejournal.com

21–30 of 42 posts

Re: Common Lisp as a Scripting Language, 2015 Edition

#21
post #7

I 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.

Have you released the source for it?

Re: Common Lisp as a Scripting Language, 2015 Edition

#22

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…

Is clojure any "better" in real-world use ?

Re: Common Lisp as a Scripting Language, 2015 Edition

#23

Earlier 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!

It isn't clojure compatible, it is like clojure.

Re: Common Lisp as a Scripting Language, 2015 Edition

#25

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…

Nitpick, but Clojure's startup time isn't JVM startup time it's clojure.core startup time

This appears to be true, eg:

  cat  Hello.java
  public class Hello {
    public static void main(String[] args) {
      System.out.println("Hello, world!"); }}
  eof

  javac Hello.java
  echo "Main-Class: Hello" > manifest.mf
  jar cvfm hello.jar manifest.mf Hello.class
  time java -jar hello.jar 
  Hello, world!

  real    0m0.153s
  user    0m0.132s
  sys     0m0.020s
vs:

  lein new hello
  cd hello
  # Pesty s-expressions, so hard to work with... ;-)
  cat  src/hello/core.clj
  (ns hello.core
    (:gen-class))
  (defn -main 
    "I don't do a whole lot."
    []
    (println "Hello, World!"))
  eof

  lein uberjar
  
  time java -jar target/hello-0.1.0-SNAPSHOT-standalone.jar 
Hello, World!

  real    0m1.060s
  user    0m1.400s
  sys     0m0.040s
(Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz, SSD drive)

Re: Common Lisp as a Scripting Language, 2015 Edition

#26
post #7

I 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.

Have you released the source for it?

Nah, because given I've never even tried most of the mature alternatives then it would be a faux pas to sell other people on why they should use it.

Re: Common Lisp as a Scripting Language, 2015 Edition

#27
post #12

Earlier quoted context omitted.

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…

> Wanted to put my article-gleaned understanding of lisp to the test 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 -s

IMHO the nicest Scheme for UNIX scripting is scsh. Its APIs are really well thought out and represent a lot of design work that hasn't ever been replicated by another Scheme (at least that I've seen).

Some good examples of scsh scripting (some by the author, Olin Shivers) can be found at

http://scsh.net/resources/scripts.html

The manual is also very good:

http://scsh.net/docu/html/man.html

Re: Common Lisp as a Scripting Language, 2015 Edition

#28
post #8

Earlier quoted context omitted.

There is also scsh (scheme shell - http://scsh.net/ ) although not being maintained anymore.

There's a plan to do some work on it (including trying to port it to 64 bit) this summer.

An updated version by Roderic Morris can be installed as a library atop the latest version of Scheme 48. It's on github: https://github.com/scheme/scsh

I think it's 64-bit (?). Most of the time it hasn't mattered for me, at least when writing scripts.

You can also just build the "old" version (0.6.7) with the `-m32` GCC flag, and it works fine on 64-bit Linux and OS X. It's very stable in my experience, and works fine.

Re: Common Lisp as a Scripting Language, 2015 Edition

#29
post #25

Earlier quoted context omitted.

Nitpick, but Clojure's startup time isn't JVM startup time it's clojure.core startup time

This appears to be true, eg: cat Hello.java public class Hello { public static void main(String[] args) { System.out.println("Hello, world!"); }} eof javac Hello.java echo "Main-Class: Hello" > manifest.mf jar cvfm hello.jar manifest.mf Hello.class time java -jar hello.jar Hello, world! real 0m0.153s user 0m0.132s sys 0m0.020s vs: lein new hello cd hello # Pesty s-expressions, so hard to work with... ;-) cat src/hell…

Kawa:

  wget ftp://ftp.gnu.org/pub/gnu/kawa/kawa-2.0.jar
  wget ftp://ftp.gnu.org/pub/gnu/kawa/kawa-2.0.jar.sig
  gpg --recv-key D269E756
  gpg --verify kawa-2.0.jar.sig

  echo '(format #t "Hello, world!\n")' > hello.scm
  # Not sure how to bundle up a scheme script with kawa
  # to a stand-alone jar...
  java -jar kawa-2.0.jar --main -C hello.scm 
  time java -cp kawa-2.0.jar:. hello
  Hello, world!

  real    0m0.284s
  user    0m0.296s
  sys     0m0.020s

Re: Common Lisp as a Scripting Language, 2015 Edition

#30
post #26

Earlier quoted context omitted.

Have you released the source for it?

Nah, because given I've never even tried most of the mature alternatives then it would be a faux pas to sell other people on why they should use it.

Perhaps. But even if it sucks: if it does at least one thing right, the other mature alternatives can learn another trick.
Post reply on HN