On Sep 20, 12:08 pm, Alan wrote:
> A few days ago I was thinking about how different it would be to write
> flip-map* in Java vs Clojure. A very simple, small program, but easy
> to see how Clojure can be more expressive.
>
> public static Map flipMap(Map map)
> {
> Map result = new HashMap(ma
On Sep 9, 11:47 am, Mike Meyer wrote:
> On Thu, 9 Sep 2010 16:28:48 +0100
>
> Edmund Jackson wrote:
> > Hi Mike,
>
> > Could you perhaps present a counter-example of greater simplicity ?
>
> $ cat - > /usr/local/www/apache22/cgi-bin/hello-world.sh
> #!/bin/sh
>
> echo 'Content-type: text/pla
Beautiful. I think this should become the official community place for
Clojure docs. Now who wants to integrate my :examples defn attribute
code :)
-John
On Jul 9, 4:32 am, zkim wrote:
> Hi All,
>
> I'll try to keep this short.
>
> I've gotten a lot out of Clojure: I can honestly say that learni
I've whipped up a proof-of-concept of how to implement built-in
examples for functions and macros. The general idea is to add an
attribute to the var that contains a list of docstrings and arg lists
or code that illustrate common usage.
Let me know what you think: http://gist.github.com/466743
It
This is precisely what 'for' is for in clojure.
For example:
(for [x (range 10) y (range 10)] [x y])
... produces a sequence of the coordinates in a 10x10 grid. You can
then consume the sequence for whatever purpose. The position of each
matrix coord in the seq produced would match up with the
I feel like the type hints should be left out until you really need
them, since they kind of clobber the routine's readability.
-John
On May 28, 9:07 am, Laurent PETIT wrote:
> (reduce
> (fn [#^String s [#^CharSequence what #^CharSequence with]]
> (.replace s what with))
> "Foo12 Bar130
The link to the example code for clojure.contrib.sql is broken. It was
very helpful to me, and it might be useful to other people new to both
Clojure and JDBC.
http://code.google.com/p/clojure-contrib/source/browse/trunk/src/clojure/contrib/sql/test.clj
(Linked from http://richhickey.github.com/cl
I know this isn't a direct answer to your question, but may I suggest
SWT (unless you already have some investment in Swing or have a
particular technical reason to use it) instead? In my experience SWT
is more lightweight and responsive, especially in the repl.
As for "hot swapping" of logic... t
This also means that the source code for clojure.core/format is a good
study on how to make use of Java vararg methods:
(defn format
"Formats a string using java.lang.String.format, see
java.util.Formatter for format
string syntax"
{:tag String}
[fmt & args]
(String/format fm