Hi,
On 24 Aug., 03:08, gary ng wrote:
> (map #(for [s %2] (map * %1 s)) target signal)
>
> Though personally I still think the %2 %1 is a bit confusing.- Zitierten Text
> ausblenden -
If you don't like it, don't use it.You can always give things
meaningful names.
(for [[signals target] (map v
I hear you --- I got excited about this too, and implemented the fannuchredux
algorithm, only to be thwarted by an undocumented "checksum" each
program is also
supposed to calculate. This checksum depends heavily on the exact
order in which
a set of permutations are traversed. And of course, they
I think the re? definition might belong around line 447 of core with
the rest of the more normal looking
instance? functions.
On Mon, Aug 23, 2010 at 1:27 PM, Sean Devlin wrote:
> Be very careful when copying the style of clojure.core. There are a
> lot of non-standard practices in there, becaus
It's never been clear to me exactly what the code is supposed to be
do. For example, the "spec" for the binary-tree test is so wholly
lacking in any details that I'm left to infer that one is supposed to
copy an implementation used previously, though without any indication
as to which is the canoni
Going from Java to Clojure isn't quite as easy as going the other way,
as @brweber2 demonstrated at the local Clojure meetup. Here's the code
he used in the presentation, might send him a direct message on
Twitter for more info:
http://github.com/brweber2/javacallclj
On Aug 22, 7:48 pm, Robert M
There may be some value in the intellectual exercise to try something like your
solution, but I think this is far more tractable if you use meaningful variable
names:
(map (fn [group scalars] (map (fn [trial] (map (fn [signal scalar] (* signal
scalar)) trial scalars)) group)) signal target)
You
On Mon, Aug 23, 2010 at 5:41 PM, Randy Hudson wrote:
> Well, #(<= lo % hi) is to my mind much more readable than (fn [x] (<=
> lo x hi)), especially embedded in another form or two (as it would
> be).
>
that may be true. though this IMO is partly due to the (<=)
construct's argument order. This i
On Mon, Aug 23, 2010 at 8:26 AM, Glen Rubin wrote:
> I am trying to write a fn to correlate 2 signals using 3 nested map
> fn. I have 2 collections of data. THe first group of signals called
> target looks something like this.
>
>
> target:
> ( (1,2,3,4) (2,3,4,5) ...)
>
>
> The second collectio
Transforming the data after it comes out of the parser can be
cumbersome with complex data structures though, it would be nice to
have a way for the parser to return the data in the desired format.
I updated clojure.contrib.json with the ability to add custom
deserializers:
(def *deserializers* (
Well, #(<= lo % hi) is to my mind much more readable than (fn [x] (<=
lo x hi)), especially embedded in another form or two (as it would
be).
On Aug 23, 11:48 am, gary ng wrote:
> On Mon, Aug 23, 2010 at 8:31 AM, Luka Stojanovic wrote:
> > It's not about nested maps, but about nested anonymous f
I thought that much of the driver behind protocols and records were to
support the Clojure-in-Clojure effort.
Can anyone confirm?
Thanks,
Daniel
On Aug 23, 3:59 am, nickikt wrote:
> I think he talkes about automatic detection where memoization would be
> good for performence. I don't think it i
The difference is not HUGE, but in a critical section it might be a
valid micro-optimization. I'd also be interested to know why, but I
bet you're assumption of apply being thrown in the mix is probably
pretty close to true.
user=> (time (dotimes [_ 1e6] (doall (map #(filter even? %) (for [i
(rang
Yes the 1.0 was a slip on my part, and I agree that I should have used
the class/staticMembers syntax; at the time I was simply trying to fit
in.
Regardless, here is the updated patch with those two comments fixed:
http://github.com/cpulsford/bitops/blob/logical-assumption/unsigned-right-shift.pat
Really? I would be interested to hear why; is it maybe because partial
has to take any number of arguments and then (apply even? args)?
I've taken to using partial when I can, precisely because of the
difficulty of nesting anonymous functions, and while performance isn't
a big deal for me I'm curi
Without commenting on the usefulness of this (it doesn't really
interest me), there are a couple style things I would change.
First, :added ought to be 1.3 (maybe 1.2?), not 1.0. Second, the
newsgroup seems to think that if you're changing clojure.core you
might as well update from (. staticMember
Hey all, I had an itch this weekend... so I scratched it.
I was doing some bit twiddling stuff and needed the Java >>> operator.
I had written some workarounds but they were overly-complicated and
slower than I would have hoped, so I dug directly into core and added
it as a first class citizen nex
Again with the bad examples but...
(map #(even? %) coll) is faster than
(map (partial even?) coll)
So it's at least got that going for it.
(I know this SHOULD be written as (map even? coll))
On Aug 23, 1:59 pm, Michael Gardner wrote:
> On Aug 23, 2010, at 11:13 AM, Luka Stojanovic wrote:
>
>
On Aug 23, 2:51 pm, Konrad Hinsen wrote:
> Or is there any simple way to make a jar containing only the source code
> files?
Ys, the maven assembly plugin can do this. Ill work on it when I get
back later this week.
-S
--
You received this message because you are subscribed to the Google
Gr
On Aug 22, 2:39 am, Legilimens wrote:
> Would people be interested in a patch that replaces all of the older
> static calls using . to the newer method using / ?
I personally don't mind the leftovers of old syntax in core. However,
the question of "why is it being used" comes up every couple of
m
On 20 Aug 2010, at 16:22, Stuart Sierra wrote:
*** For clojure-contrib developers:
Each library has its own directory under the "modules" directory at
the top level of clojure-contrib. Each module directory contains a
pom.xml file specifying the name, version number, and dependencies of
that l
> Rather than
> creating the JavaFX language they would have done so much more for the
> community to just focus on this scenegraph library, animation, etc...
I agree. I'm not interested in the JavaFX language, but am interested
in doing Flash-like user interfaces and animations from Clojure.
--
On Aug 23, 2010, at 11:13 AM, Luka Stojanovic wrote:
> On Mon, 23 Aug 2010 18:01:13 +0200, Joop Kiefte wrote:
>
>> bad example =/
>>
>> Yes, it is
>>
>> but you get the gist I hope
>>
>> better example: #(first (sort %)) ;)
>>
>
> (comp first sort)
>
> and #(some-fn x %) can be written as
On Mon, 23 Aug 2010 18:01:13 +0200, Joop Kiefte wrote:
bad example =/
Yes, it is
but you get the gist I hope
better example: #(first (sort %)) ;)
(comp first sort)
and #(some-fn x %) can be written as
(partial some-fn x)
which leaves #(some-fn % x) as case not trivial with other syntax
Benny is right. This problem is *much* easier if you break it up and
do it in baby steps. You can start very simply, get it working, and
then factor as you like. For example, in Scheme notation (I'm not a
clojure guy yet):
(map * '(1 2 3) '(1 2 3))
-> (1 4 9)
(map (lambda (x) (map * '(1 2 3) x)) '
Now Clojure 1.2 has been released, Clojure programs will be included
in the Computer Language Benchmarks Game.
If you'd like to contribute Clojure programs, please follow the step-
by-step
http://shootout.alioth.debian.org/help.php#contribute
--
You received this message because you are subscri
Be very careful when copying the style of clojure.core. There are a
lot of non-standard practices in there, because Rich is bootstrapping
the language. For example, defn doesn't work like we're all used to
in core until about 80% of the way through.
Follow these style guidelines instead:
https:
Sure, I was just copying the style of the existing predicate functions
in core.clj to keep it consistent.
-Jeff
On Aug 23, 5:25 pm, James Reeves wrote:
> Why use def? You could just place re? after the definition of defn,
> and write it:
>
> (defn re?
> "Return true if x is a regular expressio
On Mon, Aug 23, 2010 at 9:01 AM, Joop Kiefte wrote:
> bad example =/
>
> Yes, it is
>
> but you get the gist I hope
>
> better example: #(first (sort %)) ;)
>
Yes, though I think it is still cleaner if it is expressed as:
(map (comp first sort) [[3 2] [4 5]])
In other words, if it is a single ar
bad example =/
Yes, it is
but you get the gist I hope
better example: #(first (sort %)) ;)
2010/8/23 gary ng :
> On Mon, Aug 23, 2010 at 8:50 AM, Joop Kiefte wrote:
>> uses like #(first %) keeps the code cleaner
>>
> Is that the same as just 'first' like :
>
> (map first [[1 2] [3 4]])
>
> (ma
On Mon, Aug 23, 2010 at 8:50 AM, Joop Kiefte wrote:
> uses like #(first %) keeps the code cleaner
>
Is that the same as just 'first' like :
(map first [[1 2] [3 4]])
(map #(first %) [[1 2] [3 4]))
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To
uses like #(first %) keeps the code cleaner
on the other hand, for more complicated things I would really not
recommend the short form
2010/8/23 gary ng :
> On Mon, Aug 23, 2010 at 8:31 AM, Luka Stojanovic wrote:
>> It's not about nested maps, but about nested anonymous functions: if you
>> nest
Ah, so this is the context for your previous thread about multiplying
lists. Re-using some of the code from that thread:
(def target [[1 2 3 4] [2 3 4 5]])
(def signal [[[1 2 3 4] [2 3 4 5] [3 4 5 6]] [[2 3 4 5] [3 4 5 6] [4 5
6 7]]])
(defn correlate [target signal]
(let [mult-lists (fn [x y]
On Mon, Aug 23, 2010 at 8:31 AM, Luka Stojanovic wrote:
> It's not about nested maps, but about nested anonymous functions: if you
> nest anonimous functions you must use (fn [] ...) like:
>
> (map (fn [t s] (map #(map * %1 %2) t s)) target signal)
>
This has me question, how useful the #(...) fo
This is fascinating—I too am interested in Clojure-JavaFX interaction.
Thanks a lot for putting this up!
On Aug 21, 8:43 pm, Sam Griffith wrote:
> Hello group,
>
> I'd replied a long time ago to one of the posts about JavaFX and
> Clojure working together... I've now finally gotten back to puttin
On Mon, 23 Aug 2010 17:26:44 +0200, Glen Rubin wrote:
I am trying to write a fn to correlate 2 signals using 3 nested map
fn. I have 2 collections of data. THe first group of signals called
target looks something like this.
target:
( (1,2,3,4) (2,3,4,5) ...)
The second collection is calle
I am trying to write a fn to correlate 2 signals using 3 nested map
fn. I have 2 collections of data. THe first group of signals called
target looks something like this.
target:
( (1,2,3,4) (2,3,4,5) ...)
The second collection is called signal and looks like this:
signal:
( ((1,2,3,4)(2,3,4,
Why use def? You could just place re? after the definition of defn,
and write it:
(defn re?
"Return true if x is a regular expression"
{:added "1.3"}
[x]
(instance? java.util.regex.Pattern x))
- James
On 23 August 2010 16:17, Jeff Rose wrote:
> It looks like regular expressions are the
The elisp side of swank-clojure is deprecated. You just need clojure-mode
and slime-repl on the Emacs side. Then launch a swank server with your build
tool. See the swank-clojure readme.
On Aug 23, 2010 6:21 AM, "Rising_Phorce" wrote:
> Hi:
>
> I'm using Ubuntu and emacs 23 with elpa to manage cl
It looks like regular expressions are the only type with built-in
syntax that don't have a predicate function. How about:
(def
^{:arglists '([x])
:doc "Return true if x is a regular expression
(java.util.regex.Pattern)"
:added "1.3"}
re? (fn re? [x] (instance? java.util.regex.Pattern x)))
On Aug 22, 4:28 pm, Robert McIntyre wrote:
> oh yes -- please don't do it manually for anything "production"
>
> But, it's good to know what's actually going on behind the scenes,
> especially when things stop working :)
For my simple needs -
java -cp .:clojure.jar -Dclojure.compile.path=
Hi Shawn.
This kind of thing always bothers me. It makes me a bit unsure wether the
installation was done correctly; hence the question. But I'll regard that
menu entry as not existent then anyway from now on.
Thanks!
Arie
2010/8/23 Shawn Hoover
> It's because slime-compile-file (C-c M-k) doe
Oops,
s/create an instead/create an instance/
:)
On Mon, Aug 23, 2010 at 10:03 AM, Allen Johnson wrote:
>> (:1 Should the clojure source files intermingle with the java source files,
>> each according to it's relavance to the problem, or should there be a top
>> level separation between them?)
> (:1 Should the clojure source files intermingle with the java source files,
> each according to it's relavance to the problem, or should there be a top
> level separation between them?)
IMO, they should be separated. Since the project was started with Java
I'd continue treating it as the top-lev
I started using the scenario scenegraph library from JavaFX to create
GUI elements in project Overtone, but it seems development has stopped
on the project (at least in the public repository) and we are weary of
becoming dependent on a dead or closed source library. It's really
too bad, because th
hi sam,
thanks for the demo.
looks like there's mounting interest in javafx and clojure.
good to know. see this thread:
http://groups.google.com/group/clojure/browse_thread/thread/35aabe2fa9302aff#
i'm hard at work and should release shortly.
_c
On Aug 21, 8:43 pm, Sam Griffith wrote:
> Hell
It's because slime-compile-file (C-c M-k) doesn't do anything unless the
optional load parameter is true, and when you run the function from the
keyboard shortcut, it doesn't get set. C-c C-k ends up calling that function
with load=true. The distinction between to the two is false in Clojure
anyway
Hi:
I'm using Ubuntu and emacs 23 with elpa to manage clojure-mode, paren-
edit, slime, slime-repl and swank-clojure. ELPA doesn't like list
swank-clojure 1.2 yet. Can I upgrade manually?
It looks like ~/.swank-clojure contains the clojure and clojure
contrib jar files. But this directory is a
Hi,
maybe work is of interest to you:
http://measuringmeasures.com/blog/2010/8/16/clojure-workers-and-large-scale-http-fetching.html
Sincerely
Meikel
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@google
>> This seemed to be in clojure.parallel, but parallel is deprecated. Why is
>> it deprecated,
>> and what's the replacement for it?
>
> I'd like to know that as well!
I am not sure, so don't believe this blindly.
I think it is due to changes in the plan for Java 7 and JSR266y.
Some of the depe
Alright, thanks, it works! :-)
Kind regards,
Henrik
On Aug 18, 7:39 pm, Nicolas Oury wrote:
> You can create a new project, even if you don't use it:
>
> lein new experiments
>
> inside it will create a project.clj.
>
> Checks the dependencies look like that:
>
> :dependencies [[org.clojure/c
On 23.08.2010, at 04:45, nchubrich wrote:
> I have a simulation program that runs a Number of random Simulations
> and then Averages them. It basically looks like this:
>
> (reduce Average (repeatedly Number Simulate))
I guess that Simulate is a function and that Average calls functions and
And it's usage is far less generalised than macros in LISP.
It is not an usual solution to write acamlp4 preprocessor.
On Mon, Aug 23, 2010 at 1:06 PM, Meikel Brandmeyer wrote:
> Hi,
>
> On 23 Aug., 14:03, Nicolas Oury wrote:
>
>> If the AST of LISP were more complicated, this kind of program wo
Hi,
On 23 Aug., 14:03, Nicolas Oury wrote:
> If the AST of LISP were more complicated, this kind of program would
> be more complicated.
eg. see OCaml's camlp4. I found it complicated compared to Lisp style
macros.
Sincerely
Meikel
--
You received this message because you are subscribed to t
On Mon, Aug 23, 2010 at 3:45 AM, Victor Olteanu wrote:
> Some examples to illustrate this would be very welcome.
>
Any macro is an example of that.
For example, from clojure/core.clj
(defmacro ->
"Threads the expr through the forms. Inserts x as the
second item in the first form, making a lis
I have a simulation program that runs a Number of random Simulations
and then Averages them. It basically looks like this:
(reduce Average (repeatedly Number Simulate))
What is the best way of making this parallel? I noticed there was no
parallel version of repeatedly. I suppose I could pma
oh yes -- please don't do it manually for anything "production"
But, it's good to know what's actually going on behind the scenes,
especially when things stop working :)
--Robert McIntyre
On Sun, Aug 22, 2010 at 7:05 PM, Wilson MacGyver wrote:
> On Sun, Aug 22, 2010 at 2:39 PM, Isaac Gouy wrot
Some examples to illustrate this would be very welcome.
On Aug 22, 2010, at 9:17 AM, Nicolas Oury wrote:
> On Sun, Aug 22, 2010 at 11:30 AM, Belun wrote:
>> why does everything have to be a data structure ? like (operation
>> parameter parameter ...)
>
> Because it makes really easy to do me
Let's say my group has a fairly large java project on which ~20 people
are working.
We want to start using clojure with our existing code.
Specifically, we want to have clojure classes that provide functions
for our java classes, and vice versa.
Two questions on the best way to do this:
(:1 Shou
I think he talkes about automatic detection where memoization would be
good for performence. I don't think it is done ATM but I would surly
be a intressting topic.
The Clojure compiler is still in Java. I think befor someone does a
big project with the compiler it should be translated to clojure.
On 22 Aug 2010, at 17:48, Belun wrote:
does clojure take advantage of my multicore processor ? if i write a
program (not using multiple threads) that is going to take 1 day in a
java environment, then will my program run 4 times faster on my 4 core
processor if i build it in clojure ?
No. No c
Memoization is implemented at language-leve. The function is called memoize.
(It's a three-liner or so)
On Sun, Aug 22, 2010 at 11:45 PM, Sreeraj a wrote:
> What about automatic memoization?
> Does clojure already implement memoization?
> is adding auto memoization to the compiler a good idea?
>
61 matches
Mail list logo