On Mon, Dec 6, 2010 at 2:57 AM, Benny Tsai benny.t...@gmail.com wrote:
When I saw the part about traversing an arbitrarily nested collection,
I immediately thought of clojure.walk (http://clojure.github.com/
clojure/clojure.walk-api.html). I ended up with this:
(use 'clojure.walk)
(defn
On Mon, Dec 6, 2010 at 2:59 AM, Benny Tsai benny.t...@gmail.com wrote:
Always nice to see a fellow Neal Stephenson fan!
On Dec 5, 10:26 pm, Ken Wesson kwess...@gmail.com wrote:
On Mon, Dec 6, 2010 at 12:14 AM, Miki miki.teb...@gmail.com wrote:
Have you looked at Incanter?
What is the difference between rest and next?
This has to do with lazyness. I wrote an answer to that on
stackoverflow.
http://stackoverflow.com/questions/4288476/clojure-rest-vs-next
Should answer everthing.
I'm confused, should I use empty? or not? when to use it?
Why Clojure decided to
On Mon, Dec 6, 2010 at 4:02 AM, nickik nick...@gmail.com wrote:
The easy (and good) solution is to pass the running result onlong the
way. This can be done in diffrent ways.
First the CL Style where you creat a new function in you function that
then does all the work. (from
Ken Wesson)
I have looked at incanter and like it very much, but these are all
things that incanter can't currently do.
--Robert McIntyre
On Mon, Dec 6, 2010 at 3:15 AM, Saul Hazledine shaz...@gmail.com wrote:
On Dec 6, 12:27 am, Robert McIntyre r...@mit.edu wrote:
I'm trying to use clojure for scientific
I didn't expect my question would initiate such a wonderful
discussion, I'm speechless.
Thank you all guys, you are amazing.
Alex, your posts killed in a very good way :)
It was really helpful to morph the code and transform it.
On Dec 6, 11:14 am, Ken Wesson kwess...@gmail.com wrote:
On Mon,
Then you didn't look close enough of my first message :)
Granted, I omitted large parts of the code in it but it showed my
evaluate function with pruning attached.
Here's my evaluate function, with debugging code cleaned:
(defn- evaluate-with-minmax
Evaluates given game state with
Hi,
Am 06.12.2010 um 10:14 schrieb Ken Wesson:
Then we could use arity functions. (Alex Osborne)
(defn list-length
([coll] (list-length coll 0))
([coll n] (if-let [s (seq coll)]
(recur (rest s) (inc n))
n)))
This is nice style in
On Mon, Dec 6, 2010 at 5:19 AM, Meikel Brandmeyer m...@kotka.de wrote:
Hi,
Am 06.12.2010 um 10:14 schrieb Ken Wesson:
Then we could use arity functions. (Alex Osborne)
(defn list-length
([coll] (list-length coll 0))
([coll n] (if-let [s (seq coll)]
On Dec 6, 11:40 am, Ken Wesson kwess...@gmail.com wrote:
Won't that make the internal recursive call fail though?
And even if not -- ugly IMO. :)
Agree. Why make something slower and more ugly?
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To
Archive search nth seq hickey:
http://groups.google.com/group/clojure/browse_thread/thread/ffa3f56c3bb32bc3/773b23a34e88acab?lnk=gstq=nth+seq+hickey#773b23a34e88acab
Stu
On Sun, Dec 5, 2010 at 4:14 PM, jweiss jeffrey.m.we...@gmail.com wrote:
That's totally different than nth for a set being
On Mon, Dec 6, 2010 at 8:24 AM, Stuart Halloway
stuart.hallo...@gmail.com wrote:
Archive search nth seq hickey:
http://groups.google.com/group/clojure/browse_thread/thread/ffa3f56c3bb32bc3/773b23a34e88acab?lnk=gstq=nth+seq+hickey#773b23a34e88acab
Interesting. But that was years ago, Hickey no
Robert McIntyre r...@mit.edu writes:
I'm wondering if people have had experience with java libraries of
that sort and might have some recommendations.
Anyone use clojure for scientific data analysis? What do you find
helpful to use?
I'm still just evaluating clojure for scientific data
tree-seq makes this pretty simple:
(defn nested-vals [key coll]
(for [x (tree-seq coll? seq coll) :when (contains? x key)]
(get x key)))
This works with any type of key and all associative Clojure
structures. It could be made compatible with Java structures by
swapping out the 'coll?'
Clojure's Java interop is extremely impressive and straightforward --
to someone who is somewhat familiar with Java. I don't know Java, but
I've learned to work with it pretty well just by using Clojure. When I
started out, it was extremely difficult, because I couldn't read
javadocs and didn't
+1
Lazy is better.
Personally, I would have used filter and map instead of for, but this
is probably clearer.
Thanks,
Alyssa
On Dec 6, 10:30 am, Justin Kramer jkkra...@gmail.com wrote:
tree-seq makes this pretty simple:
(defn nested-vals [key coll]
(for [x (tree-seq coll? seq coll) :when
Nice! I knew there had to be a nicer way of traversing nested
collections :) Thank you for this.
On Dec 6, 8:30 am, Justin Kramer jkkra...@gmail.com wrote:
tree-seq makes this pretty simple:
(defn nested-vals [key coll]
(for [x (tree-seq coll? seq coll) :when (contains? x key)]
(get
Hi,
Am 06.12.2010 um 11:40 schrieb Ken Wesson:
Won't that make the internal recursive call fail though?
No. Because the metadata is just documentation.
And even if not -- ugly IMO. :)
Tastes vary. I prefer this over a second toplevel function named foo-aux or the
like. I also prefer it
On 06.12.2010, at 16:02, Johann Hibschman wrote:
(Konrad Hinsen had started some work on multiarrays in Clojure, but I've
not been following his progress.)
There hasn't been much, unfortunately. I haven't found much time for serious
Clojure hacking for a few months. But the project is not
You can not extend them, as they are marked final.
Another point to consider is clojure-in-clojure. If that is ever going
to happen, one needs to be able to implement Atom as well. It is also
generally better to code to an interface rather than to an
implementation.
Alter and send also work
On Dec 6, 8:36 am, Ken Wesson kwess...@gmail.com wrote:
Furthermore, the comment (not made by Hickey) that map order may be
unstable is more than a little puzzling in light of the fact that the
maps in question are immutable. :)
In general, Rich has been careful not to promise things that
+1
There is no STM integration with atoms. That's not a concern.
Just write your own Clojure core with your change. I did for durable
identities. shamelessPluggit://github.com/kwanalyssa/clojure.git/
shamelessPlug
Seriously though, just use protocols.
Thanks,
Alyssa
On Dec 6, 5:24 am,
Yes, but why isn't persistence of emclosures/em generating more
interest. ;)
Persistence is solved, if you're OK with not being truly ACID...
Seriously though, everyone has their own backends. I don't think
anyone wants to be tied to BDB JE.
Would there be interest in lazy-loading and
On Mon, Dec 6, 2010 at 1:09 PM, Alyssa Kwan alyssa.c.k...@gmail.com wrote:
Yes, but why isn't persistence of emclosures/em generating more
interest. ;)
Persistence is solved, if you're OK with not being truly ACID...
Seriously though, everyone has their own backends. I don't think
anyone
On Mon, Dec 6, 2010 at 1:05 PM, Stuart Sierra
the.stuart.sie...@gmail.com wrote:
On Dec 6, 8:36 am, Ken Wesson kwess...@gmail.com wrote:
Furthermore, the comment (not made by Hickey) that map order may be
unstable is more than a little puzzling in light of the fact that the
maps in question
On Mon, Dec 6, 2010 at 11:45 AM, Konrad Hinsen
konrad.hin...@fastmail.net wrote:
On 06.12.2010, at 16:02, Johann Hibschman wrote:
Maybe I'm not reading the right news, but I've not seen all that much on
using Java for scientific work for a while now. The NIST JavaNumerics
guys seem to have
On Mon, 6 Dec 2010 16:30:10 -0500
Ken Wesson kwess...@gmail.com wrote:
On Mon, Dec 6, 2010 at 1:05 PM, Stuart Sierra
the.stuart.sie...@gmail.com wrote:
On Dec 6, 8:36 am, Ken Wesson kwess...@gmail.com wrote:
Furthermore, the comment (not made by Hickey) that map order may be
unstable is
Great! I'll give it a try for sure :)
On Dec 6, 4:55 pm, Rayne disciplera...@gmail.com wrote:
Clojure's Java interop is extremely impressive and straightforward --
to someone who is somewhat familiar with Java. I don't know Java, but
I've learned to work with it pretty well just by using
On Mon, Dec 6, 2010 at 4:44 PM, Mike Meyer
mwm-keyword-googlegroups.620...@mired.org wrote:
On Mon, 6 Dec 2010 16:30:10 -0500
Ken Wesson kwess...@gmail.com wrote:
On Mon, Dec 6, 2010 at 1:05 PM, Stuart Sierra
the.stuart.sie...@gmail.com wrote:
On Dec 6, 8:36 am, Ken Wesson
Thanks for earlier help on (not) using MacPorts leiningen.
Having installed leiningen as per site instructions, I also followed
site instructions for installing swank-clojure using leiningen. These
instructions reference a SNAPSHOT build of swank-clojure.
After install, `lein
On Mon, 6 Dec 2010 17:07:15 -0500
Ken Wesson kwess...@gmail.com wrote:
On Mon, Dec 6, 2010 at 4:44 PM, Mike Meyer
mwm-keyword-googlegroups.620...@mired.org wrote:
On Mon, 6 Dec 2010 16:30:10 -0500
Ken Wesson kwess...@gmail.com wrote:
On Mon, Dec 6, 2010 at 1:05 PM, Stuart Sierra
On Dec 6, 2010, at 4:07 PM, Ken Wesson wrote:
Perhaps. But under those circumstances seq itself has the same problem
you're using to excuse not supporting nth, yet seq is supported. And
so is (nth (seq x)) on these things; if the implementation changed its
innards while you were walking the
On Mon, Dec 6, 2010 at 5:43 PM, Michael Gardner gardne...@gmail.com wrote:
On Dec 6, 2010, at 4:07 PM, Ken Wesson wrote:
Perhaps. But under those circumstances seq itself has the same problem
you're using to excuse not supporting nth, yet seq is supported. And
so is (nth (seq x)) on these
sorry to jump in this weird conversation, but it seems to me that you are on
parallel discussion without acknowleding it.
To me, the only thing which makes sense is that saying that seq promises no
deterministic ordering on sets and maps is not about calling seq on the same
java instance of a set
On Dec 6, 2010, at 5:35 PM, Ken Wesson wrote:
Who was relying on the order? If you merely relied on seeing 5 or 6,
or on not seeing 3 or 4 twice, you were screwed.
Ah, I misunderstood what you wrote. Obviously (seq) should hand you each item
in the collection exactly once, but that's at a
Hello, I'm a long-time Java programmer who's tired of mutability
getting in my way. I've been largely enjoying the pervasive use of
closures in JavaScript, and though I'd check out Clojure.
So far so good. It installed easily and the REPL is easy to use. I've
watched the screencasts and have
1. Isn't the world actually imperative? And mutable?
If you're a determinist, then no. Life is a function (albeit a multivariable
function), just like sine.
2. 'Side-effects' are treated almost as a bad word by most functional
programming advocates. And yet, aren't ALL programs executed
1. Isn't the world actually imperative? And mutable? Collaboration
*is* a messy proposition in real life. It's hard to fix your car, and
even harder to have lots of people fix your car. I find the it models
the real world better justification for functional programming rather
confusing.
I've played a bit with the code and now namespaces behave. There's
even a set-ns! function to set the current namespace to what you want.
On Nov 30, 9:07 am, Constantine Vetoshev gepar...@gmail.com wrote:
On Nov 29, 2:25 pm, Miki miki.teb...@gmail.com wrote:
Yeah, it uses load-string which
On Mon, 6 Dec 2010 16:50:40 -0800 (PST)
javajosh javaj...@gmail.com wrote:
1. What is the justification for using a map as a function? I find
this to be very confusing.
The same as using a keyword for a function - it lets you write shorter
code.
2. In practice, I find myself wincing when
+1
On Fri, Dec 3, 2010 at 10:25 PM, ka sancha...@gmail.com wrote:
I'm also stuck with the same issues: 1. no option to get string keys
2. I don't understand, why do libs go through the trouble of
downcasing ?
Having said that I totally agree with the point Ryan makes: A
greater feature of
On Dec 6, 5:40 pm, Stuart Halloway stuart.hallo...@gmail.com wrote:
The world is a series of immutable states, and the future is a function of
the past.
See http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey.
My philosophy questions are the most interesting to people, ha!
Neat
Hello Miki,
I'm writing a simple Clojure editor based on jSyntaxPane. I'm trying
to intern a function (it's defined on live-processing.editor, and I
want to redefine it with (eval (read-string ...))). Any help?
Thanks.
2010/12/6 Miki miki.teb...@gmail.com:
I've played a bit with the code and
1. What is the justification for using a map as a function? I find
this to be very confusing.
In math, a function is a mapping from one set to another, so from that
perspective it makes good sense for a clojure-map to be a function
from its set of keys to its set of values. The justification here
On 21 November 2010 22:57, Miki miki.teb...@gmail.com wrote:
Usage is simple - add EVIL definition to your application
defroutes:
(defroutes app
(GET / [] Nothing here! (try /evil))
(EVIL /evil)
(route/not-found Dude! I can't find it.))
Comments/criticism/improvements welcomed.
@javajosh You're speaking of the Turing description of computation,
you might be interested in Church's lambda calculus description which
works just as well and doesn't use mutability to describe computation,
--Robert McIntyre
On Mon, Dec 6, 2010 at 9:08 PM, javajosh javaj...@gmail.com wrote:
It's working! I'm using load-string instead of read-string.
Sorry about the noise.
2010/12/7 Vilson Vieira vil...@void.cc:
Hello Miki,
I'm writing a simple Clojure editor based on jSyntaxPane. I'm trying
to intern a function (it's defined on live-processing.editor, and I
want to redefine it
On Mon, Dec 6, 2010 at 7:10 PM, Michael Gardner gardne...@gmail.com wrote:
On Dec 6, 2010, at 5:35 PM, Ken Wesson wrote:
Who was relying on the order? If you merely relied on seeing 5 or 6,
or on not seeing 3 or 4 twice, you were screwed.
Ah, I misunderstood what you wrote. Obviously (seq)
This happens in both Clojure 1.2 and 1.3-latest:
user= (require 'clojure.contrib.core)
nil
user= (clojure.contrib.core/-? 1 inc)
2
user= (clojure.contrib.core/-? 1 inc inc)
CompilerException java.lang.Exception: Unable to resolve symbol: -?
in this context, compiling:(NO_SOURCE_PATH:3)
I assume
On Dec 6, 2010, at 9:02 PM, Ken Wesson wrote:
I'll try this one more time. You suggested the innards, and with them
the seq order of the elements, might get rearranged.
I suggested no such thing; perhaps you are confusing me with Mike Meyer? I
referred more generally to the possibility of two
Do the standard libraries contain a function to map a function over a map?
(mapmap inc {:a 1 :b 2}) = (2, 3)
--
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
Oops. I meant:
(mapmap inc {:a 1 :b 2}) = { :a 2 :b 3)
Sorry about that.
Alex
--
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
Hi Alex,
(clojure.contrib.generic.functor/fmap inc {:a 1 :b 2}) = {:a 2 :b 3}
The above is probably what you want.
HTH
Sunil.
On Tue, Dec 7, 2010 at 9:26 AM, Alex Baranosky
alexander.barano...@gmail.com wrote:
Oops. I meant:
(mapmap inc {:a 1 :b 2}) = { :a 2 :b 3)
Sorry about that.
Thanks Sunil.
On Mon, Dec 6, 2010 at 11:00 PM, Sunil S Nandihalli
sunil.nandiha...@gmail.com wrote:
Hi Alex,
(clojure.contrib.generic.functor/fmap inc {:a 1 :b 2}) = {:a 2 :b 3}
The above is probably what you want.
HTH
Sunil.
On Tue, Dec 7, 2010 at 9:26 AM, Alex Baranosky
On Mon, Dec 6, 2010 at 10:27 PM, Jason Wolfe jawo...@berkeley.edu wrote:
This happens in both Clojure 1.2 and 1.3-latest:
user= (require 'clojure.contrib.core)
nil
user= (clojure.contrib.core/-? 1 inc)
2
user= (clojure.contrib.core/-? 1 inc inc)
CompilerException java.lang.Exception:
This is also very easy to implement:
(into {}
(for [[k v] the-map]
[k (f v)]))
e.g.
user= (into {}
(for [[k v] {:a 3 :b 7}]
[k (inc v)]))
{:a 4, :b 8}
user=
and to encapsulate as a function:
(defn fmap [f m]
(into {}
(for [[k v] m]
[k (f v)])))
--
You received this
On Mon, Dec 6, 2010 at 10:45 PM, Michael Gardner gardne...@gmail.com wrote:
On Dec 6, 2010, at 9:02 PM, Ken Wesson wrote:
I'll try this one more time. You suggested the innards, and with them
the seq order of the elements, might get rearranged.
I suggested no such thing; perhaps you are
Sorry for asking here, but I think it's at least a little relevant to
Clojure since I for one wouldn't be installing emacs if it wasn't for
Clojure and Slime. Getting prompts about what the function arguments
are seems like a HUGE benefit when learning this langauge. I imagine
other non-emacs
Way I have [:a 1:b 2] and I want to convert it to {:a 1 :b 2}
What's the idiomatic way to do this in Clojure?
Thanks for the help,
Alex
--
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
I think it will be fun to come up with a solution that will work with n
maps:
(defn multi-fmap [f maps]
...)
i.e.
(multi-fmap #(+ %1 %1 %2 ) {:a 1 :b 2} {:a 3 :b 4}) = {:a 5 :b 8}
(multi-fmap #(+ %1 %2 %3 ) {:a 1 :b 2} {:a 3 :b 4} {:a 5 :b 6}) = {:a 9 :b
12}
--
You received this message
On Mon, Dec 6, 2010 at 2:13 PM, Philip Hudson phil.hud...@iname.com wrote:
Now, in emacs, after doing `M-x slime-connect' and accepting the default
prompt values, I get the fancy slime animation, but swank-clojure
1.3.0-SNAPSHOT immediately throws:
unreadable message: (:emacs-rex
On Tue, Dec 7, 2010 at 10:31 AM, Alex Baranosky
alexander.barano...@gmail.com wrote:
Way I have
(apply hash-map [:a 1:b 2])
and I want to convert it to {:a 1 :b 2}
What's the idiomatic way to do this in Clojure?
Thanks for the help,
Alex
--
You received this message because
ah, I had tried hash-map without apply, but yours actually works. :)
Thanks.
On Tue, Dec 7, 2010 at 12:06 AM, Sunil S Nandihalli
sunil.nandiha...@gmail.com wrote:
On Tue, Dec 7, 2010 at 10:31 AM, Alex Baranosky
alexander.barano...@gmail.com wrote:
Way I have
(apply hash-map [:a
On Mon, Dec 6, 2010 at 9:00 PM, javajosh javaj...@gmail.com wrote:
Sorry for asking here, but I think it's at least a little relevant to
Clojure since I for one wouldn't be installing emacs if it wasn't for
Clojure and Slime. Getting prompts about what the function arguments
are seems like a
Here is the code I'm working on. The first function is wanted. The second
is not. (and the duplication is waiting to be factored out somehow...)
Is there an idiomatic Clojure way to use map-of-distances on the Line of
Note below, instead of map-of-distances* ?
Thanks for all your help.
(defn
On 06.12.2010, at 22:35, Ken Wesson wrote:
I'd say what Java needs is not complex numbers as a value type, but a way to
define additional value types. Complex numbers are just one applications.
Another one is points (2D or 3D) for geometry and graphics.
Unfortunately the problem is not
On Tue, 7 Dec 2010 00:44:52 -0500
Alex Baranosky alexander.barano...@gmail.com wrote:
Here is the code I'm working on. The first function is wanted. The second
is not. (and the duplication is waiting to be factored out somehow...)
Is there an idiomatic Clojure way to use map-of-distances on
On 10-12-07 12:44 AM, Alex Baranosky wrote:
Here is the code I'm working on. The first function is wanted. The
second is not. (and the duplication is waiting to be factored out
somehow...)
Is there an idiomatic Clojure way to use map-of-distances on the Line
of Note below, instead of
On Tue, Dec 7, 2010 at 12:04 AM, Alex Baranosky
alexander.barano...@gmail.com wrote:
I think it will be fun to come up with a solution that will work with n
maps:
(defn multi-fmap [f maps]
...)
i.e.
(multi-fmap #(+ %1 %1 %2 ) {:a 1 :b 2} {:a 3 :b 4}) = {:a 5 :b 8}
(multi-fmap #(+ %1 %2
On Tue, Dec 7, 2010 at 12:58 AM, Konrad Hinsen
konrad.hin...@fastmail.net wrote:
On 06.12.2010, at 22:35, Ken Wesson wrote:
I'd say what Java needs is not complex numbers as a value type, but a way
to define additional value types. Complex numbers are just one
applications. Another one is
Hello Alexandre,
This code makes my tests pass:
(defn distances [origin locations]
(map #(dist-in-miles origin %) locations))
(defn map-of-distances [origin locations]
(apply hash-map (interleave locations (apply distances origin
locations
Thanks for the inspiration!
--
You
On 10-12-07 01:37 AM, Alex Baranosky wrote:
Hello Alexandre,
This code makes my tests pass:
(defn distances [origin locations]
(map #(dist-in-miles origin %) locations))
(defn map-of-distances [origin locations]
(apply hash-map (interleave locations (apply distances origin
Hello,
http://www.theregister.co.uk/2010/12/07/apache_google_vote_no_oracle_roadmap/
http://news.ycombinator.com/item?id=1977720
Does this mean anything for Clojure (on the JVM)?
Regards,
BG
--
Baishampayan Ghose
b.ghose at gmail.com
--
You received this message because you are subscribed
On Dec 6, 9:16 pm, Phil Hagelberg p...@hagelb.org wrote:
On Mon, Dec 6, 2010 at 9:00 PM, javajosh javaj...@gmail.com wrote:
Sorry for asking here, but I think it's at least a little relevant to
Clojure since I for one wouldn't be installing emacs if it wasn't for
Clojure and Slime.
On Dec 6, 6:24 pm, Robert McIntyre r...@mit.edu wrote:
@javajosh You're speaking of the Turing description of computation,
you might be interested in Church's lambda calculus description which
works just as well and doesn't use mutability to describe computation,
Thanks, I'll look into that.
On Dec 6, 6:01 pm, Mike Meyer mwm-keyword-googlegroups.
620...@mired.org wrote:
good stuff snipped
Mike and I have had a nice off-line conversation where we enumerated
the possible things that can come after open-parens. I listed 7, he
added 3:
1. A value (if the paren has a tick '( )
2. A
(defmacro defchunk [name tps]
`(def ~name (quote ~tps)))
(defmacro let-chunk [vname name val-vec body]
(let [chunk-def @(resolve name)
types (map first chunk-def)
part-names (map (comp symbol (partial str vname !) second) chunk-def)]
`(let [~vname ~val-vec
Standard way, definitely no. As others have pointed out, Incanter is
The Clojure Math Tool, but strongly biased towards statistics and
linear algebra, and outside those fields you'll need other tools.
Apache Commons Math (http://commons.apache.org/math/) is one of the
better self-contained Java
On Tue, Dec 7, 2010 at 2:15 AM, javajosh javaj...@gmail.com wrote:
Mike and I have had a nice off-line conversation where we enumerated
the possible things that can come after open-parens. I listed 7, he
added 3:
1. A value (if the paren has a tick '( )
2. A function.
3. A map - which is a
79 matches
Mail list logo