Hi,
On Sat, Feb 27, 2010 at 06:52:28PM -0500, David Nolen wrote:
> > ? http://richhickey.github.com/clojure-contrib/dataflow-api.html
> >
> There is no official Cells code. There is a only a gist of some work in
> progress.
I think this is a misunderstanding. There is a "Cells" implementation in
If anything, the defprotocol and deftype stuff that's on the way is
more along the lines of an abstract class because you can define a
protocol, acting a sort of modularized interface, and then you can
compose types by grouping together functions that implement one ore
more protocols. Anyway, I do
Hi,
I'm trying to write a java class in clojure, and then call it from
java. But I keep getting IllegalArgumentExceptions.
file hello.clj:
(ns hello
(:gen-class
:methods [ [fooMeth [] String]])
)
(defn -fooMeth [] "fooMeth")
file TestIt2.java:
public class TestIt2 {
public st
Hi, all:
I'm learning Clojure through porting Magick4J to clojure, I call it
rinzelight. I'm having problems to port the display method (
http://github.com/Serabe/RMagick4J/blob/master/Magick4J/src/magick4j/MagickImage.java#L271
).
http://github.com/Serabe/rinzelight/blob/master/src/rinzelight/di
Ahhh thanks that did the trick!
On Feb 25, 9:57 am, Adrian Cuthbertson
wrote:
> Try including [*print-dup* true] in the binding;
>
> (defn write-nick-sets [file-name obj]]
> (with-open [w (FileWriter. (File. file-name))]
> (binding [*out* w *print-dup* true] (prn obj
>
> You can read it
Let's say I want to write a function that takes as an argument a list
of n numbers, and returns 4 lists, a list of odd numbers that are
multiples of 5, a list of even numbers that are multiples of 5, a list
of odd numbers that are not multiples of 5, and a list of even numbers
that are not multiple
Someone will have an elegant solution, but what comes to my mind is a
(somewhat) brute force "loop-recur" ... not not that much different from
what you suggested. It would pass the "under construction" return lists to
itself and a dwindling amount ("rest") of the original list. Add "first"
from t
How about reducing it?
Something along the limes of: (not tested)
(reduce (fn [lists number]
(update-in lists [
(if (odd? number)
(if (= 0 (mod number 5) :odd-5 :odd)
(if (= 0 (mod number 5) :even-5 :even)] (fn [l] (conj l number))
numbers)
Regards,
Heinz
Hi Dan, you need to include an arg for "this" in -fooMeth, i.e
(defn -fooMeth [this] "fooMeth")
or
(defn -fooMeth [_] "fooMeth")
- Rgds, Adrian
On Sun, Feb 28, 2010 at 12:06 AM, Dan Becker wrote:
> Hi,
>
> I'm trying to write a java class in clojure, and then call it from
> java. But I keep get
On Feb 28, 4:03 pm, "Heinz N. Gies" wrote:
> How about reducing it?
>
> Something along the limes of: (not tested)
>
> (reduce (fn [lists number]
> (update-in lists [
> (if (odd? number)
> (if (= 0 (mod number 5) :odd-5 :odd)
> (if (= 0 (mod number 5) :even-
Mark,
Thank you! I argued for this for months, but everyone kept insisting
on keywords by default. Now you just have to convince the other 2
people who actually use clojure.contrib.json.
-SS
On Feb 27, 3:55 pm, MarkSwanson wrote:
> Hello,
>
> Consider the following valid JSON:
>
> Clojure=>
I use c.c.json heavily in my project and I kind of agree, it should be strings
since in the json definition keys have to be strings, only problem is
serialization as in how to serialize a keyword them?
Regards,
Heinz
On Feb 28, 2010, at 15:36 , Stuart Sierra wrote:
> Mark,
>
> Thank you! I
Hi,
On Sun, Feb 28, 2010 at 06:29:13AM -0800, Jarkko Oranen wrote:
> 3) The reduce needs an empty map as an init value. Otherwise you get
> an exception (You might even want to populate it with empty vectors,
> but it's not necessary since conjing to nil produces a list)
Quiz time: What is the d
On Feb 28, 2:54 am, logan wrote:
> Let's say I want to write a function that takes as an argument a list
> of n numbers, and returns 4 lists, a list of odd numbers that are
> multiples of 5, a list of even numbers that are multiples of 5, a list
> of odd numbers that are not multiples of 5, and a
As a small note, according to http://clojure.org/reader, Clojure
keywords and symbols are allowed to contain only alphanumeric
characters, *, +, !, -, _, and ?. Spaces aren’t allowed, but the
keyword function allows them anyway because it doesn’t do any checking
for validity for performance. I’m to
Ah, thank you! I guess that makes sense. But it doesn't seem to be
documented directly anywhere, though the examples at
http://clojure.org/compilation
do show the need to do this.
Dan
On Feb 28, 7:10 am, Adrian Cuthbertson
wrote:
> Hi Dan, you need to include an arg for "this" in -fooMeth, i.e
Perhaps my choice of function names (abstract and concrete) for my
original post is not very appropriate. I did not mean to apply the OO
concept of abstract class, abstract methods, etc. Since it seemed
that my original post did not convey my query clearly, I would try to
depict it with some "co
Hi!
hmm...I don't understand why clojure when and if simultaneously? What
is the diffirences between them and when I should use one instead
another one?
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@goog
user> (when true
(println "line 1")
(println "line 2")
(println "line 3")
(println "there is no need to use #'do")
(println "there is nothing to evaluate when false and return nil"))
line 1
line 2
line 3
there is no need to use #'do
there is nothing to evalua
Perhaps my choice of function names (abstract and concrete) for my
original post is not very appropriate. I did not mean to apply the OO
concept of abstract class, abstract methods, etc. Since it seems that
my original post did not convey my query clearly, I would try to
depict it with some "conc
Here's a similar idea (also untested)
(defn which-list [number]
(let [by-5 (zero? (mod number 5))]
(cond
(and (odd? number) by-5) [:odd-5]
by-5 [:even-5]
(
Hello!
On 28 Feb., 18:08, Аркадий Рост wrote:
> Hi!
>
> hmm...I don't understand why clojure when and if simultaneously? What
> is the diffirences between them and when I should use one instead
> another one?
Besides the implicit do, which reynard mentioned, it's generally
idiomatic to use while
On Feb 28, 7:36 pm, reynard wrote:
> Perhaps my choice of function names (abstract and concrete) for my
> original post is not very appropriate. I did not mean to apply the OO
> concept of abstract class, abstract methods, etc. Since it seems that
> my original post did not convey my query cle
hmm...I don't understand why clojure when and if simultaneously? What
is the diffirences between them and when I should use one instead
another one?
Disregarding all of the practical benefits (such as an implicit do):
languages often incorporate apparently redundant constructs because
one of
On 28 February 2010 16:24, Dan Becker wrote:
> Ah, thank you! I guess that makes sense. But it doesn't seem to be
> documented directly anywhere, though the examples at
> http://clojure.org/compilation
> do show the need to do this.
Try Meikel Brandmeyer's post "gen-class – how it works and how
Richard Newman writes:
> There are more subtle clues that you'll pick up in certain people's
> styles, too -- I'm sure my use of when has a very different pattern to
> a Java guy's, colored by my Common Lisp experience.
I'm still undecided whether to shake this habit:
,
| (defmacro unless [
I'm still undecided whether to shake this habit:
,
| (defmacro unless [pred & body]
| `(when-not ~pred ~...@body))
`
Heh. I still think that "unless" is a better name than "when-not", but
I've migrated pretty easily.
This is an interesting point, though -- does "unless" communicat
I always thought unless is a very nice name for if-not... I'm
beginning to understand why we have if-not / when-not and no unless
out of the box. :-)
All best,
Michał
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email t
On Sun, 28 Feb 2010 14:18:50 -0800
Richard Newman wrote:
> This is an interesting point, though -- does "unless" communicate
> something slightly different to* "when not", despite being
> functionally identical? And is the distinction important enough to
> justify a move towards a confusing
Richard Newman writes:
> Incidentally, I initially didn't know about `when-not` -- I figured
> that `unless` had simply been omitted -- so I defined:
>
> (defmacro unless [pred & body]
> `(when (not ~pred) ~...@body))
I did the same, and then was frustrated enough to dig through the core
API d
On Feb 28, 10:34 am, joshua-choi wrote:
> As a small note, according tohttp://clojure.org/reader, Clojure
> keywords and symbols are allowed to contain only alphanumeric
> characters, *, +, !, -, _, and ?. Spaces aren’t allowed, but the
> keyword function allows them anyway because it doesn’t do
For an example outside of JSON: recently Compojure changed how it
works so the HTTP request properties are all converted to keywords by
default. I can see the appeal, but now anyone using Compojure has the
increased incidental complexity of possible keyword violations.
Imagine if you were integrat
Richard, I spent quite a bit of time thinking about what you said.
So I rewrote the whole kit and kaboodle. My understanding of your mail
led me to take the approach of defining functions who take as
arguments the invariant values and who output functions that take
variant values. For example:
(d
ok. Thanks.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send em
I've just recently begun to work with Clojure and I am finding it quite
gratifying. I am a long-time Lisper (several dialects) but my Java experience
is limited and largely in the sheltered environment of Processing
(processing.org).
Anyway, my first Clojure exercise has been a version of my P
Hello All,
Do you happen to know of any JavaScript syntax highlighting library,
alike http://code.google.com/p/syntaxhighlighter/ or
http://code.google.com/p/google-code-prettify/, supporting Clojure and
not just Lisp. I've been trying to find one to no avail.
Cheers,
Ivan.
--
You received this
>
> - When I run clj (from the most recent ClojureX) on the command line with -i
> and a source file it runs the file but then hangs. If I also specify -r then
> I get a REPL after the file runs, which is nice, but I was hoping that
> without -r it would terminate and return to a shell prompt w
On Sun, Feb 28, 2010 at 2:38 PM, Lee Spector wrote:
> On the development environment front: Is anyone contemplating creating a
> Mac OS X "Clojure in a Box"? I would be an enthusiastic user. If it could
> have roughly the feature set of the old Macintosh Common Lisp IDE then I
> would be ecstatic
Anyone has first hand experience? Thanks.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your
first post.
To unsub
On 28 Feb 2010, at 20:38, Lee Spector wrote:
that just published a special issue on parallel evolutionary
algorithms, so I know of a lot of options there! -- but for now I
just want the basic generational algorithm to be expressed as
naturally as possible in Clojure. There seem to be many o
So I rewrote the whole kit and kaboodle. My understanding of your mail
led me to take the approach of defining functions who take as
arguments the invariant values and who output functions that take
variant values. For example:
I'm not sure how much functional programming experience you have, bu
41 matches
Mail list logo