On Sat, 2009-10-24 at 10:07 -0400, John McKown wrote:
> 3) Clojure - a rather strange meld of LISP and Functional Programming.
> http://clojure.org
> [...] has
> anybody tried to run programs written in any of the above, other than
> Java itself of course, on a z?
Yes, I've been playing with Clojure on an irregular basis. The IBM JVM
is more strict than the Sun JVM, and rejects some invalid class names
generated by Clojure (see bug #104). As a practical matter, this means
that I can't use e.g. pprint from the contrib library today.
BTW, one of Clojure's selling points is its strong Java interop. Kirk
and Steve's JZOS Toolkit is the bees knees, and works well from Clojure
code. Here's a file-copy example to puzzle over:
(ns user
(:import com.ibm.jzos.ZFile)
(:import com.ibm.jzos.ZUtil)
(:import java.nio.ByteBuffer)
(:import java.nio.charset.Charset))
(ZFile/bpxwdyn "alloc dd(sysut1) dsn('temp.dba.print(all)') shr")
(ZFile/bpxwdyn "alloc dd(sysut2) sysout(a)")
(with-open [sysut1 (new ZFile "//DD:SYSUT1" "rb,type=record,noseek")
sysut2 (new ZFile "//DD:SYSUT2" "wb,type=record,noseek")]
(let [buffer (. (ByteBuffer/allocate (. sysut1 getLrecl)) array)]
(while (pos? (. sysut1 read buffer))
(. sysut2 write buffer))))
(map #(ZFile/bpxwdyn (str "free dd(" % ")")) '(sysut1 sysut2))
... which isn't very good Clojure code, considering that mutable buffer.
JVM startup time is a killer. Best use Clojure for long-running things.
--
David Andrews
A. Duda and Sons, Inc.
[email protected]
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html