gui repl

23 views
Skip to first unread message

Kevin Downey

unread,
Jan 3, 2010, 7:09:08 PM1/3/10
to clo...@googlegroups.com
I have been playing with a gui repl for clojure: http://github.com/hiredman/Repl
instructions are light, but you can check it out, and use lien to jar
it up, it is gen-class'ed (but does not require AOt'ing) and has a
-main function so you can run it from an uberjar.

http://www.thelastcitadel.com/images/Screenshot-Repl.png is a
screenshot of me playing with incater

the repl is built around swing and jcomponents, so it is possible to
display a button in the repl and attach an action listener to it and
do neat stuff.

I have a sort little video clip of fooling around with the repl
http://www.thelastcitadel.com/lab/repl.m4v
(http://www.thelastcitadel.com/lab/repl.ogv same video)

Anyhoo, it seems like there is an interest in this sort of thing so I
wanted to make this available

--
And what is good, Phaedrus,
And what is not good—
Need we ask anyone to tell us these things?

Albert Cardona

unread,
Jan 4, 2010, 2:42:22 AM1/4/10
to clo...@googlegroups.com
I built a Swing REPL for clojure some time ago, it's part of Fiji.
Launch from "Plugins - Scripting - Clojure Interpreter" menu command.

http://pacific.mpi-cbg.de

Code here:

http://pacific.mpi-cbg.de/cgi-bin/gitweb.cgi?p=fiji.git;a=blob;f=src-plugins/Clojure/Clojure_Interpreter.java;hb=HEAD

Albert
--
Albert Cardona
http://albert.rierol.net

Kevin Downey

unread,
Jan 4, 2010, 10:12:18 AM1/4/10
to clo...@googlegroups.com
ah, well, the differences are:

a. this repl is written in Clojure

b. this repl can "print" arbitrary jcomponents, not just text. for
example in the screenshot a ChartPanel from JFreeChart is rendered in
the repl

> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com
> Note that posts from new members are moderated - please be patient with your first post.
> To unsubscribe from this group, send email to
> clojure+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

Brian Goslinga

unread,
Jan 4, 2010, 3:17:36 PM1/4/10
to Clojure
Nice. This reminds me of some of the things you can do in CLIM.

Marc Downie

unread,
Jan 4, 2010, 4:42:57 PM1/4/10
to clo...@googlegroups.com

Well, if people are in the mood for fun, hybrid, Clojure REPLs... 

The latest version of Field (a mac-only open source IDE for digital art) secretly supports Clojure as one of its embedded languages (screenshot here, more information about Field here). This means you can write:

# these lines are Python (strictly, Jython)
xxx =15
vv = Vector3(1.2,0,1) # Vector3 is actually Java Class

// start-clojure

(defn asum [#^floats xs]
(areduce xs i ret (float 0)
(+ ret (aget xs i))))

(println (asum (float-array [xxx (.x vv) 3])))

// end-closure

# back to Python, in beta 11
_clojure.asum(array('f', [1,2,3]))

-------

Installation instructions upon request: it's just an undocumented hack right now, but it's a working hack. You can use it to write code against the Field's OpenGL graphics system or Processing libraries. If anybody is excited (rather than repulsed or outraged) by this we could use some Clojure hacking talent to make it real.

best,

Marc.

On Mon, Jan 4, 2010 at 2:17 PM, Brian Goslinga <quickba...@gmail.com> wrote:
Nice.  This reminds me of some of the things you can do in CLIM.

Joseph Smith

unread,
Jan 7, 2010, 9:29:07 PM1/7/10
to clo...@googlegroups.com
This is very interesting, but I cannot seem to get Clojure code to execute in it. I have it installed and field thinks it is installed. Do I need to somehow switch modes?


---
Joseph Smith




Reply all
Reply to author
Forward
0 new messages