Clojure at JavaOne

35 views
Skip to first unread message

Rich Hickey

unread,
May 18, 2009, 8:36:59 AM5/18/09
to Clojure
I'll be doing two sessions involving Clojure at JavaOne this June. One
is a traditional talk (TS-4164), the other is as a participant in the
Script Bowl 2009: A Scripting Languages Shootout (PAN-5348).

The 'script' bowl is a friendly competition, basically a place to show
off your language and seek audience acclaim.

"Scripting language gurus returning from 2008 are Groovy, JRuby,
Jython, and Scala. This year there is also a new kid on the block:
Clojure."

There are two very brief rounds, 4 minutes per language each round .

round 1: Core language and libraries round (show something really cool
with the core language and libraries)

round 2: Community round (show some significant community
contributions)

Note there is no comparative aspect, each language presenter talks up
their own language and the audience decides, so it's not an
opportunity to draw contrasts explicitly. It's about being pro-
Clojure, not anti- anything else.

The audience is Java developers, many of whom will have never seen
Clojure or any Lisp.

I'd appreciate some suggestions *and help* preparing demos for the
Script Bowl. What (that could be demonstrated in 4 minutes) would make
you think - 'Clojure looks cool, I need to look into it'? What
community contribution(s) should we showcase?

Thanks,

Rich

Andrew Wagner

unread,
May 18, 2009, 8:53:24 AM5/18/09
to clo...@googlegroups.com
I can only speak from my experience, but the thing that really got my attention was the idea of 'code as data'. In particular, for me, looking through Koza's Genetic Programming book blew my mind. It would be cool to come up with a nice GP demo.

Mark Volkmann

unread,
May 18, 2009, 9:06:43 AM5/18/09
to clo...@googlegroups.com

I think this should be a demo of the basic use of Refs and STM. The
tough part is keeping this simple enough to explain and demo in 4
minutes. The bank example at
http://java.ociweb.com/mark/clojure/article.html#ReferenceTypes is too
long. Maybe a simplified version of that can be created.

> What community contribution(s) should we showcase?

I think this should be a simple demo of Compojure. I have one at
http://java.ociweb.com/mark/clojure/article.html#WebApps that you are
welcomed to use.

--
R. Mark Volkmann
Object Computing, Inc.

Laurent PETIT

unread,
May 18, 2009, 9:12:03 AM5/18/09
to clo...@googlegroups.com
As a general idea, I would say :

specific to lisp:
the possibility to get rid of "boiler plate code", such as the one
involved in each and every (re)implementation of some GOF design
patterns.

This could be either a demonstration of the power of higher order
functions or macros (the first with higher order functions *can* be
done in java, but it is such a pain in the ass to do this right with
anonymous functions that it is rarely done in practice, some spring
framework frameworks let apart)

specific to clojure:
a demonstration of the ease of use of concurrent/parallel programming
constructs.

2009/5/18 Rich Hickey <richh...@gmail.com>:

Laurent PETIT

unread,
May 18, 2009, 9:23:47 AM5/18/09
to clo...@googlegroups.com
2009/5/18 Mark Volkmann <r.mark....@gmail.com>:
I fear demonstrating "compojure" might be interpreted just as "yet
another web framework" (mean "yet another solution to a well-known
problem - a problem which already has good solutions in each and every
language, including java -> wicket, GWT, webworks, etc.).
And then people will just focus on this "yet another web framework"
thought, and not be open to see where the power of clojure comes into
play in compojure.

In the other hand, I don't have a better idea yet, but what about
clojure.contrib.walk (to demonstrate that it is possible to define
very generic algorithms that can then be applied to almost every other
clojure datastructure) ?

John Newman

unread,
May 18, 2009, 9:30:26 AM5/18/09
to clo...@googlegroups.com
I believe it was the presentation you gave on the ants simulation, where you updated the program while it was running.  I'm not sure if the other languages in the shootout can do that, but I thought that was pretty awesome.
 
I think a display of building an application while it's running in front of you (be that a web app or a desktop app) is flashy and compelling.  Not sure how far you could go with that though.
 
2 cents.
 
Regards,

--
John

verec

unread,
May 18, 2009, 10:37:47 AM5/18/09
to Clojure
Whatever you chose, you probably ought to show its source with an IDE
(whichever you chose: NetBeans. Eclipse, IntelliJ) but should probably
forget about emacs: many (most?) Java developers won't even consider
anything that isn't at least partially integrated within some IDE.

Not sure how much work is involved with the existing inspector, but
showing how you can impose another hierarchy via multimethods on top
of the existing JComponent subclasses (JTree & JTable) and assorted
models was really something that blew me away.

Also, adding DnD support to that inspector window such that you could
drag and drop some moderately complex XML file, and show it leaves
appear as maps (within maps)* in the JTree would also be really cool.

My 2p :)

falcon

unread,
May 18, 2009, 10:46:06 AM5/18/09
to Clojure
I agree with John. For certain applications, the ability to modify
the code while it is running is very useful.

Many language comparisons turn into syntax comparisons. Clojure has
enough interesting concepts (concurrency model, code as data, macros)
that it should be made to stand out.

On May 18, 9:30 am, John Newman <john...@gmail.com> wrote:
> I believe it was the presentation you gave on the ants simulation, where you
> updated the program while it was running.  I'm not sure if the other
> languages in the shootout can do that, but I thought that was pretty
> awesome.
>
> I think a display of building an application while it's running in front of
> you (be that a web app or a desktop app) is flashy and compelling.  Not sure
> how far you could go with that though.
>
> 2 cents.
>
> Regards,
>
> On Mon, May 18, 2009 at 5:42 PM, Laurent PETIT <laurent.pe...@gmail.com>wrote:
>
>
>
>
>
> > As a general idea, I would say :
>
> > specific to lisp:
> > the possibility to get rid of "boiler plate code", such as the one
> > involved in each and every (re)implementation of some GOF design
> > patterns.
>
> > This could be either a demonstration of the power of higher order
> > functions or macros (the first with higher order functions *can* be
> > done in java, but it is such a pain in the ass to do this right with
> > anonymous functions that it is rarely done in practice, some spring
> > framework frameworks let apart)
>
> > specific to clojure:
> > a demonstration of the ease of use of concurrent/parallel programming
> > constructs.
>
> > 2009/5/18 Rich Hickey <richhic...@gmail.com>:

Ilya Sergey

unread,
May 18, 2009, 11:10:36 AM5/18/09
to clo...@googlegroups.com
Hi all.

One of the most important aspects which I would like to be emphasized is the ad-hoc interoperability with Java, such as invocation of Java classes and methods, proxies and compilation to Java class-files.
BTW, I will be at JavaOne staying most part of time on JetBrains booth, so if someone is interested in better IDE-support of Clojure I would be happy discuss it or show what we have for now in IntelliJ.

With best regards,
Ilya Sergey

2009/5/18 falcon <shah...@gmail.com>

Dan Larkin

unread,
May 18, 2009, 11:14:26 AM5/18/09
to clo...@googlegroups.com
I agree with Laurent. Every language has a web framework, probably
many; it's not very unique to clojure. I think something involving
runtime code modification and/or STM would be neat to show off.
Message has been deleted
Message has been deleted

bOR_

unread,
May 18, 2009, 11:49:43 AM5/18/09
to Clojure
Well, the ant demo does show java interoperability (the whole
graphics bit).

You could start with a world with the empty square, and a filled
square, start with one type of ant that is just lugging the food
from the filled to the empty square. This shows off agents.

Have four numbers being printed on the screen: food
in square 1, square 2, carried by ants, total.

Forbid the ants from entering the food area, the amount
of food in square 2 now stays constant,and the food
carried by the ants decreases.

Add a second type of ant (red ants), which can enter the food square,
and which as behaviour can pass the food to a neighbouring black
ant. This requires refs, and with the counters we can see the total
amount of food staying constant, and you changing the program as
it runs, calling java as you go :-).

Did I mention that as a biologist, I like ants? :).

On May 18, 5:14 pm, Dan Larkin <d...@danlarkin.org> wrote:
> On May 18, 2009, at 9:23 AM, Laurent PETIT wrote:
>
>
>
>
>
> > 2009/5/18 Mark Volkmann <r.mark.volkm...@gmail.com>:
>
> >> On Mon, May 18, 2009 at 7:36 AM, Rich Hickey <richhic...@gmail.com>  
> >>http://java.ociweb.com/mark/clojure/article.html#WebAppsthat you are

Mark Volkmann

unread,
May 18, 2009, 2:54:38 PM5/18/09
to clo...@googlegroups.com
I think time is the issue here. The Ant code may be too involved to
describe in the time allotted. I do think it's important though to
describe the use of Refs and STM. To me they are a very important
feature of Clojure.

On Mon, May 18, 2009 at 10:47 AM, bOR_ <boris....@gmail.com> wrote:
>
> Well, the ant demo does show java interoperability (the whole graphics
> bit).
>
> You could start with a world with the empty square, and a filled
> square, start
> with one type of ant that is just lugging the food from the filled to
> the empty
> square. This shows off agents.
>
> Have four numbers being printed on the screen: food
> in square 1, square 2, carried by ants, total.
>
> Forbid the ants from entering the food area, the amount
> of food in square 2 now stays constant,and the food
> carried by the ants decreases.
>
> Add a second type of ant (red ants), which can enter the food square,
> and which as behaviour can pass the food to a neighbouring black
> ant. This requires refs, and with the counters we can see the total
> amount of food staying constant, and you changing the program as
> it runs, calling java as you go :-).
>
>
> Did I mention that as a biologist, I like ants? :).
>
> On May 18, 5:14 pm, Dan Larkin <d...@danlarkin.org> wrote:
>> On May 18, 2009, at 9:23 AM, Laurent PETIT wrote:
>>
>>
>>
>>
>>
>> > 2009/5/18 Mark Volkmann <r.mark.volkm...@gmail.com>:
>>
>> >> On Mon, May 18, 2009 at 7:36 AM, Rich Hickey <richhic...@gmail.com>
>> >>http://java.ociweb.com/mark/clojure/article.html#WebAppsthat you are

Michael Wood

unread,
May 18, 2009, 3:36:37 PM5/18/09
to clo...@googlegroups.com
On Mon, May 18, 2009 at 8:54 PM, Mark Volkmann
<r.mark....@gmail.com> wrote:
>
> I think time is the issue here. The Ant code may be too involved to
> describe in the time allotted. I do think it's important though to
> describe the use of Refs and STM. To me they are a very important
> feature of Clojure.

They may be important, but is 4 minutes enough to show that are better
than just using threads and locking directly?

--
Michael Wood <esio...@gmail.com>

Mark Engelberg

unread,
May 18, 2009, 3:40:37 PM5/18/09
to clo...@googlegroups.com
For me, persistent vectors was the killer feature that drew me to
Clojure. Don't know how to convey the value of that in 4 minutes,
though.

Mark Volkmann

unread,
May 18, 2009, 3:51:01 PM5/18/09
to clo...@googlegroups.com

Yeah, 4 minutes is quite a restriction. It's just hard for me to
imagine having the task of trying to convince people of the goodness
of Clojure and not talking about STM.

e

unread,
May 18, 2009, 6:48:43 PM5/18/09
to clo...@googlegroups.com
i think destructuring is awesome, and loop-recur.... loop-recur is so handy in not having to have the public version of a function (entry point) versus the recursive inner version that often has extra parameters that the user shouldn't have to worry about.

other ideas:
closures as light-weight objects ... how ratios work in lisps ... I also like the suggestions about changing a running GUI and showing how macros can capture design patterns.

- Eli

AlamedaMike

unread,
May 18, 2009, 8:31:59 PM5/18/09
to Clojure
+1 for showing the Ant demo and modifying it while it's running.
Emphasize how easy it is to get RELIABLE concurrency using agents/STM.
As Steve Jobs has long known, eye candy counts, and Ants is an eye
candy way of seeing concurrency in action.

I would also keep a second REPL open and "test" out a simple code
change in it before integrating it into the running program.

Show how easy it is to call into Java and how they can test out Java
libraries from a REPL would be helpful. Some of them might want to
explore Clojure just to have a simple way to test ideas on the fly.
With that as a hook they might dig deeper later.

Drive home how immutability reduces bug counts.

Lower priority: Mention, without slamming the other languages, that
it's generally faster than all of the others, except Scala (perhaps).
Tricky, that last bit, and I think best done by comparing Clojure to
native Java and letting the audience work out the difference.

Key take-away: "Clojure makes JVM programming easier and more bug-free
than it's ever been."


On May 18, 3:48 pm, e <evier...@gmail.com> wrote:
> i think destructuring is awesome, and loop-recur.... loop-recur is so handy
> in not having to have the public version of a function (entry point) versus
> the recursive inner version that often has extra parameters that the user
> shouldn't have to worry about.
>
> other ideas:
> closures as light-weight objects ... how ratios work in lisps ... I also
> like the suggestions about changing a running GUI and showing how macros can
> capture design patterns.
>
> - Eli
>
> On Mon, May 18, 2009 at 3:51 PM, Mark Volkmann <r.mark.volkm...@gmail.com>wrote:

Konrad Hinsen

unread,
May 19, 2009, 4:39:47 AM5/19/09
to clo...@googlegroups.com
On 18.05.2009, at 14:36, Rich Hickey wrote:

> I'd appreciate some suggestions *and help* preparing demos for the
> Script Bowl. What (that could be demonstrated in 4 minutes) would make
> you think - 'Clojure looks cool, I need to look into it'? What
> community contribution(s) should we showcase?

For the first round, I'd try to prepare a modified version of the
ants demo:

1) simplify as much as possible

2) introduce a couple of macros, to show the power of syntax
abstractions (without going into any details, of course)

3) modify some parameter interactively

That should demonstrate

- concurrency without locks (again, no details in four minutes)
- the power of macros
- Java integration (the GUI)
- interactivity

The last point is the least important because the others have it as
well, but it's still good to see interactivity in practice.

The big missing points would be functional programming and immutable
data structures.

Konrad.

Michael Harrison (goodmike)

unread,
May 19, 2009, 11:18:28 AM5/19/09
to Clojure
Just my 2 cents, but the really killer part of the ant hill
demonstration for me happened when Rich brought up his computer's
process monitor and showed the simulation using > 100% of the CPU. In
other words, it was a proof moment -- look, multiple cores!

I think the audience would respect the demonstration that you don't
have to do anything onerous to execute your code on multiple cores.
Just use the built-in abstractions and STM takes care of the rest. I
think (most) Java folks won't be impressed with Lisp features.
Performance, on the other hand, appeals to every geek.

In any case, it's exciting to have Clojure at the table.
Congratulations, Rich.

Michael

Shantanu Kumar

unread,
May 19, 2009, 4:58:48 PM5/19/09
to Clojure


On May 18, 7:37 pm, verec <jeanfrancois.brouil...@googlemail.com>
wrote:
> Whatever you chose, you probably ought to show its source with an IDE
> (whichever you chose: NetBeans. Eclipse, IntelliJ) but should probably
> forget about emacs: many (most?) Java developers won't even consider
> anything that isn't at least partially integrated within some IDE.

WaterFront is written in Clojure, for Clojure with embedded REPL.
http://www.dzone.com/links/waterfront_the_clojure_ide_with_embedded_repl.html

This could be also showcased as an example.

tmountain

unread,
May 19, 2009, 9:04:59 PM5/19/09
to Clojure
I agree with some of the previous suggestions that something including
Java interop would be a good idea. That should give Java programmers
warm fuzzy feelings and at least pique their curiosity enough to give
Clojure a more detailed look later. Four minutes is such an extremely
short amount of time that it certainly makes this a challenge.

Most of the topics that make Clojure so interesting are also pretty
dense. That being said, it wouldn't be bad to hit things at a high
level and leave people hungry for more. I wouldn't pass up the
opportunity to mention STM and explain very briefly that it uses
similar technology to Oracle and Postgres to maintain consistency
across threads. Agents are also a huge feature that can be summarized
well enough in a few short sentences to make someone say, "COOL!". The
ants demo is incredibly cool, but my fear would be that an ultra-
condensed explanation wouldn't do it the justice it deserves (maybe
I'm wrong)? Something really easy for people to get might be, "you can
compile this to a class, distribute as a jar, and make it part of your
toolbox right now."

Having done a lot of Java programming, even simple features of Clojure
are really impressive and appealing. Having a language that can
outperform most interpreted languages and offer me heterogenous
sequences and type inference is a huge feature. Higher order functions
wouldn't be bad to mention either since Java doesn't have them. Macros
are incredibly powerful, but again, I fear that with the limited time,
quite a few in the audience might underestimate what they can provide.

One quick question: is anybody going to get this on video? I'd really
like to see how it turns out.

Travis

e

unread,
May 19, 2009, 9:12:17 PM5/19/09
to clo...@googlegroups.com
is there a risk that people have seen Rich's videos and thus the ant demo, already?  If so, that could turn into, "So it's a one trick pony?"  Not likely, but is there that risk?

mikel

unread,
May 21, 2009, 3:39:43 AM5/21/09
to Clojure
Show something that does a lot of visible work quickly with very
little code, where the code is still very readable and easy to
understand.

Show how to do something that Java programmers have to do pretty
often, and that requires many lines of code, but which requires very
few lines of code in Clojure, yet the code is still very
understandable.

Show how someone can look at a running demo and ask for a different
feature, and you can implement the feature and have it show up in the
running demo without needing to stop and restart it.

Show how you can run a demo with a bug in it, trigger the bug, to
cause a break, fix the bug while in the break, and resume the demo
with the corrected code.

Show how you can do all of this from a nice interactive session, but
also quickly and easily package the demo app as a jarfile that you can
deploy like any other jarfile.

Show how easy it is to look at the guts of any Java instance or class,
and how easy it is to instantiate and use classes and interfaces.

Take a concurrent Java example that exhibits hard-to-debug threading
issues (this should address pain that any server-side Java programmer
has felt), and show how they go away in the presence of Clojure's
safety guarantees.

Finally, show them that they don't lose performance by gaining these
features.

Rich Hickey

unread,
May 21, 2009, 7:42:29 AM5/21/09
to Clojure
And in the second 4 minutes? :)

Rich

Sean Devlin

unread,
May 21, 2009, 10:28:57 AM5/21/09
to Clojure
The duck streams library should give some examples the Java crowd will
be ready to appreciate. That, or maybe use the with-open macro.

My $.02

Chas Emerick

unread,
May 21, 2009, 10:38:17 AM5/21/09
to clo...@googlegroups.com
I'm guessing glitz and visual impact is what's going to wow the crowd,
especially in that environment, where it's likely that most people are
steeped in "business applications".

Perhaps using one of the clojure-processing wrappers to do some
outrageously-slick data visualization, and then showing how little
code is required to do it and how much leverage the language provides
when addressing changes in requirements? Maybe the slick visual
impact part can be merged with the "business application" mindset by
generating a report that includes the data visualization (I think PDF
generation is built into processing).

- Chas

Rich Hickey

unread,
May 21, 2009, 11:43:32 AM5/21/09
to Clojure


On May 21, 10:38 am, Chas Emerick <cemer...@snowtide.com> wrote:
> I'm guessing glitz and visual impact is what's going to wow the crowd,
> especially in that environment, where it's likely that most people are
> steeped in "business applications".
>
> Perhaps using one of the clojure-processing wrappers to do some
> outrageously-slick data visualization, and then showing how little
> code is required to do it and how much leverage the language provides
> when addressing changes in requirements? Maybe the slick visual
> impact part can be merged with the "business application" mindset by
> generating a report that includes the data visualization (I think PDF
> generation is built into processing).
>

Last year the JRuby demo was a fancy graphics thing that utilized the
motion sensor in the laptop + OpenGL or something. It really said
little about JRuby (IMO), other than that being on the JVM lets you
reach these libs, and perf was good enough.

I'd like to do something modest but distinguishing. I have a vague
notion of showing some Clojure data originating in some XML off the
web, being passed to some filtering/walking code, getting displayed,
stored in a DB, all without specific DOM/model/recordset APIs, a
couple of lines for each task. This demonstrating the difference of
not being OO - using generic abstract data types like maps everywhere.

Help wanted in implementing some demo code.

Rich

NarayanS

unread,
May 21, 2009, 11:48:39 AM5/21/09
to Clojure
Modifying the running Java application is definitely a big plus and
attraction.
Also, showing off the features in the mainstream IDEs tells the Java
developer that it is very easily approachable and participate in the
whole classpath and tight integration with Java. Telling them how Java
and Clojure can co-mingle as needed and inter-operate easily.

Netbeans is a very popular free IDE and Enclojure plugin adds a very
strong clojure support to it. Following blog post explains how the
application can have socket REPL and can be used easily through
Netbeans IDE to manipulate the running application in another JVM.
http://clojure101.blogspot.com/2009/05/creating-clojure-repl-in-your.html


On May 18, 10:46 am, falcon <shahb...@gmail.com> wrote:

Timothy Pratley

unread,
May 21, 2009, 12:09:59 PM5/21/09
to Clojure
I'd like to echo Laurent's words - getting rid of boiler plate code is
tops.
Quite an old example which I think demonstrates this well:
http://clojure.googlegroups.com/web/2c-calculator.clj
Most people are familiar with the code explosion that buttons and
action listeners usually involve.
[it needs some cleaning up - rset for example is not a good idea, and
looks better with default look and feel and layout love]

That being said ants is the best wow value obviously!

Ian Phillips

unread,
May 21, 2009, 1:30:00 PM5/21/09
to clo...@googlegroups.com
> I'd like to do something modest but distinguishing. I have a vague
> notion of showing some Clojure data originating in some XML off the
> web, being passed to some filtering/walking code, getting displayed,
> stored in a DB, all without specific DOM/model/recordset APIs, a
> couple of lines for each task. This demonstrating the difference of
> not being OO - using generic abstract data types like maps everywhere.


I agree that the uniform data structures are one of the really cool
things about Clojure, but it seems like a fairly subtle point to try
to get across in such a short amount of time; also, showing people a
language with loads of parentheses *and* saying it's not OO may just
scare people off ;-) Although to be fair, I haven't been to J1 so I'm
not sure what the audience is going to be like.

For me, 2 of the biggest things are:

* using macros to add new control structures and eliminating
boilerplate; and

* changing code at runtime.

However, given the time constraint I think that changing code at runtime
will have more of a 'wow' factor to it, and will also be easier to
demonstrate as you can, for example, have a app set up and running with
a known defect, that you could fix as a demo. For enterprise users who
value uptime this is going to be pretty cool (it's not that big a deal
for the folks who run web sites as you can basically roll out changes
across a server cluster by bouncing nodes already

One other tip: if you're going to show source code then set the editor
to highlight brackets in a very light colour so they don't stand out as
much, I've often been surprised at how big a deal people make about them
when coming from Algol family languages.

Cheers,
Ian.

#ifndef __COMMON_SENSE__ | Ian Phillips
#include <std_disclaimer> | ia...@ianp.org
#endif | http://ianp.org/

mikel

unread,
May 21, 2009, 8:51:06 PM5/21/09
to Clojure
:-)

Certainly you're under no obligation to do all (or any) of those. But
I'll bet that any of them you can do will work.

John Newman

unread,
May 21, 2009, 8:52:56 PM5/21/09
to clo...@googlegroups.com
Speaking of "walking/filtering code," what about walking _actual_ code?

The only thing off the top of my mind would be an example of, say, a "Hello World" function, but with the code represented as a JTree.  Say, in the function (pr (.toLowerCase "Hello World")), you'd see .toLowerCase as a node.  You'd click on the node to edit it and enter .toUpperCase.

After showing people the "HELLO WORLD," you could show them how the JTree used a zipper (or some similar walking tool) to edit the datastructure.  This shows how a textual .clj file is only one of the possible representations of the datastructure, code is data, data is code, etc. etc.

Even better, the JTree could be editing a live program... Or the program running the JTree itself! :)

This doesn't have to be the actually example used.  Someone else might be able to come up with something more practical, ideally implementing some of the xml stuff you were talking about.

However, I can tell you that from my perspective, this whole "code is data" thing was a bit of an epiphany for me when I realized it allowed for things like in the example above.  (And it's thanks to Clojure that I took the dive into lisp.)  I think something like this might have some jazz to it.  Not sure the other languages can play the same tune.  (correct me if I'm wrong)

Regards,
--
John

e

unread,
May 21, 2009, 11:09:54 PM5/21/09
to clo...@googlegroups.com

Show how you can run a demo with a bug in it, trigger the bug, to
cause a break, fix the bug while in the break, and resume the demo
with the corrected code.


You can do that?  What do "Fix the bug while in the break" mean?  I know you could do that in Common Lisp.  I'd love to know how that works in clojure.  What environment do I need?  In my environment, all I see is "NullPointerException" wiith no hint as to where it might have occurred.

- Eli

e

unread,
May 21, 2009, 11:13:45 PM5/21/09
to clo...@googlegroups.com


Quite an old example which I think demonstrates this well:
http://clojure.googlegroups.com/web/2c-calculator.clj


the fourth line can be combined with the third line for even more conciseness, no?

Adrian Cuthbertson

unread,
May 21, 2009, 11:38:53 PM5/21/09
to clo...@googlegroups.com
>... impact part can be merged with the "business application" mindset by
>generating a report that includes the data visualization (I think PDF
>generation is built into processing).

I've been doing some work with enlive and XHtmlRenderer - it's a
pretty awesome way of generating (business, media, etc) PDF docs from
html templates, css style sheets and clojure generated data. I could
post some examples if there's any interest.

Rgds, Adrian.

David Powell

unread,
May 22, 2009, 5:48:46 AM5/22/09
to Clojure

On Thu 21/05/09 17:43 , "Rich Hickey" richh...@gmail.com sent:


>
> I'd like to do something modest but distinguishing. I have a vague
> notion of showing some Clojure data originating in some XML off the
> web, being passed to some filtering/walking code, getting displayed,
> stored in a DB, all without specific DOM/model/recordset APIs, a
> couple of lines for each task. This demonstrating the difference of
> not being OO - using generic abstract data types like maps everywhere.

I think something like this is a good idea. It is very practical.

I can't share the code, but I am doing something similar - using clojure to build a pipeline that takes
different shaped queries as resultset-seqs, clusters related records into groups, and pushes the groups
through the pipeline using lazy-seq. I can also swap in literal datastructures in order to test the code
without depending on the database.

I guess there are lots of datasources that you could do something similar to resultset-seq with. Atom feeds
(particularly ones with history rel=next links), OpenSearch query results, queries to non-relational data-
stores, XMPP events...


Rich Hickey

unread,
May 22, 2009, 7:16:53 AM5/22/09
to Clojure


On May 21, 11:38 pm, Adrian Cuthbertson <adrian.cuthbert...@gmail.com>
wrote:
> >... impact part can be merged with the "business application" mindset by
> >generating a report that includes the data visualization (I think PDF
> >generation is built into processing).
>
> I've been doing some work with enlive and XHtmlRenderer - it's a
> pretty awesome way of generating (business, media, etc) PDF docs from
> html templates, css style sheets and clojure generated data. I could
> post some examples if there's any interest.
>

Sure, please do.

Rich

Rich Hickey

unread,
May 22, 2009, 7:33:39 AM5/22/09
to Clojure
Actually, let me extend that invitation - if anyone's got a small
(one-page-ish) Clojure program that does something interesting, and
are willing to have it demonstrated at JavaOne, please paste it
somewhere and post a note here.

Thanks,

Rich

Mark Derricutt

unread,
May 22, 2009, 7:35:50 AM5/22/09
to clo...@googlegroups.com
I did something similar the other week:


Using clj_web_crawler and XHtmlRenderer to make a PDF of a locally available book (in wiki format) on the history of the New Zealand Internet.  

Brian Doyle

unread,
May 22, 2009, 8:36:28 AM5/22/09
to clo...@googlegroups.com
I have a one pagish program that you pass in your screen resolution and it randomly picks out a new
desktop image from ftp.gnome.org, downloads the image and updates your desktop.  This assumes
your using Gnome. 

http://github.com/heyZeus/clojure-stuff/blob/0c81123fcb3dc4bafa0df94b6e32dc49729595d3/update-desktop-image.clj

Christophe Grand

unread,
May 22, 2009, 4:02:50 PM5/22/09
to clo...@googlegroups.com
Rich Hickey a écrit :

> Actually, let me extend that invitation - if anyone's got a small
> (one-page-ish) Clojure program that does something interesting, and
> are willing to have it demonstrated at JavaOne, please paste it
> somewhere and post a note here.
>

I'm dabbling with a quick and dirty IRC logger + HTTP server, maybe too
long (60 lines)
http://gist.github.com/116323

--
Professional: http://cgrand.net/ (fr)
On Clojure: http://clj-me.blogspot.com/ (en)


Reply all
Reply to author
Forward
0 new messages