On Sat, Jul 25, 2009 at 4:40 PM, atucker agjf.tuc...@googlemail.com wrote:
I wonder if any of the Clojurians on here might like to describe how
one might write the factorial function as a parallel one? Taking
advantage of the associativity of multiplication, along the lines of
16! =
On Wed, Jul 22, 2009 at 5:17 PM, mmwaikar mmwai...@gmail.com wrote:
So if this is the intended behavior of apply, which function should I
use in this case? Is there anything in Clojure where I can apply any
user-defined function to each and every element of a list one-by-one?
Use map:
user=
On Mon, Jul 20, 2009 at 4:31 PM, Moses mosesam...@gmail.com wrote:
I come primarily from a perl programming background, but am trying
to learn Clojure.
I'm looking for a clojure equivalent to the following.
Perl:
my $nestedDS = [ foo, { hi = there, hello = [buddy] }, hi]
my $foo
On Fri, Jul 17, 2009 at 11:52 PM, Rowdy Rednose rowdy.redn...@gmx.netwrote:
How can I lexically bind names like let does in a macro, when names
and values for those bindings are passed in?
This here works fine when I pass a literal collection:
(defmacro let-coll
[coll body]
`(let
On Sat, Jul 18, 2009 at 1:22 AM, Meikel Brandmeyer m...@kotka.de wrote:
Using eval is not really a solution.
(def foo '[a 1 b 2])
(let-coll foo ...)
will probably work with eval, but
(let [foo '[a 1 b 2]]
(let-coll foo ...))
will not.
No, for that you need to make the macro
On Fri, Jul 17, 2009 at 11:31 AM, Stephen C. Gilardi squee...@mac.comwrote:
It looks like somehow you're seeing a very old REPL or it's not the default
REPL you get from launching Clojure via clojure.main.
I can confirm the described behavior for the enclojure REPL.
On Fri, Jul 17, 2009 at 4:41 PM, Mark Engelberg mark.engelb...@gmail.comwrote:
On Fri, Jul 17, 2009 at 1:32 PM, samppirbysam...@gmail.com wrote:
Is there a function in clojure.core or clojure.contrib so that:
(and (mystery-fn '(a b c d) '(a b))
(not (mystery-fn '(a b c d) '(a b
On Thu, Jul 16, 2009 at 11:34 AM, Dragan draga...@gmail.com wrote:
Thanks for the tip, I meant something else.
Let's say that I want to write a function do-something. There could be
2 implementations: do-something-quickly and do-something-elegantly.
The parameters are the same and there are
On Wed, Jul 15, 2009 at 11:39 AM, B Smith-Mannschott
bsmith.o...@gmail.comwrote:
An explicit loop with some type hints is faster, though likely not as
fast as Java:
(defn sum-of-range-4 [range-limit]
(loop [i (int 1) s (long 0)]
(if ( i range-limit)
(recur (inc i) (+ s i))
On Wed, Jul 15, 2009 at 4:53 AM, hosia...@gmail.com hosia...@gmail.comwrote:
http://www.engineyard.com/blog/2009/programming-contest-win-iphone-3gs-2k-cloud-credit/
Has anyone got access to hundreds of thousands of machines that I
could borrow for 30 hours ? ;)
Don't know any botnet
On Wed, Jul 15, 2009 at 12:58 PM, Mark Engelberg
mark.engelb...@gmail.comwrote:
It looks like stack-rot is going to be the bottleneck in your app
since it requires traversing the whole vector to build the new one,
but I think the list-based implementation would be a bit worse, so I
think your
On Mon, Jul 13, 2009 at 3:11 PM, Morgan Allen alfred.morgan.al...@gmail.com
wrote:
It's a shame about the lack of official support for java-side
invocation- the bulk of my code is still implemented in java (largely
for efficiency reasons), so it would be handy to be able to initiate
things
On Thu, Jul 9, 2009 at 10:29 PM, J. McConnell jdo...@gmail.com wrote:
You can try with-local-vars. I'm not sure of the performance
characteristics of this versus using an atom, but it certainly feels
more imperative:
It's slow. I suspect it (and binding) uses Java's ThreadLocal, which is
It would be useful to have a *math-context* or similar that had a sensible
default and could be set with binding to affect bigdec calculations within
the temporal scope of said binding.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to
On Fri, Jul 10, 2009 at 9:22 AM, Rich Hickey richhic...@gmail.com wrote:
On Jul 10, 9:01 am, Chouser chou...@gmail.com wrote:
On Fri, Jul 10, 2009 at 7:14 AM, John Harropjharrop...@gmail.com
wrote:
It would be useful to have a *math-context* or similar that had a
sensible
default and
This is odd:
user= (/ 1.0 0.0)
#CompilerException java.lang.ArithmeticException: Divide by zero
(NO_SOURCE_FILE:0)
Shouldn't it be Double/POSITIVE_INFINITY?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Clojure
On Thu, Jul 9, 2009 at 11:10 AM, tmountain tinymount...@gmail.com wrote:
I just finished watching the Bay Area Clojure Meetup video, and Rich
spent a few minutes talking about the possibility of Clojure in
Clojure. The prospect of having Clojure self-hosted is incredibly
cool, but it brought
On Wed, Jul 8, 2009 at 3:42 AM, Frantisek Sodomka fsodo...@gmail.comwrote:
If result is a vector v, then from these 4 cases:
(let [v [1 2 3]]
(let [[a b c] v] a b c)
(let [a (v 0) b (v 1) c (v 2)] a b c)
(let [a (nth v 0) b (nth v 1) c (nth v 2)] a b c)
(let [x (first v) r1 (rest v) y
On Wed, Jul 8, 2009 at 5:14 AM, Robert Campbell rrc...@gmail.com wrote:
Thanks Daniel, that makes perfect sense, especially about having
random - and forgotten - code in the image. I have a lot of this
during my exploration sessions.
Perhaps instead of saving an image, it should be able to
On Wed, Jul 8, 2009 at 9:11 AM, Mike cki...@gmail.com wrote:
One of the things that drew me to Clojure was the fact that it's
homoiconic (and my previous lisp [Scheme] was not necessarily), which
means code is data, macro writing is easy etc. etc.
What I'm missing is why I can't print a
Interesting. How are these timings affected if you add in the time taken to
pack the list or vector in the first place, though? I have the feeling it
may be slightly cheaper to unpack a vector, but noticeably cheaper to pack a
list...
--~--~-~--~~~---~--~~
You
On Wed, Jul 8, 2009 at 1:57 PM, Robert Campbell rrc...@gmail.com wrote:
If it's okay, could somebody explain the difference between what's
happening here:
user (def my-func (list + 1 2))
#'user/my-func
user (my-func)
; Evaluation aborted.
and here:
user (def my-func (list + 1 2))
On Wed, Jul 8, 2009 at 4:57 PM, Frantisek Sodomka fsodo...@gmail.comwrote:
So far it seems that vectors win in Clojure:
(timings 3e5
(let [v (vector 1 2 3) a (nth v 0) b (nth v 1) c (nth v 2)] (+ a b
c))
(let [lst (list 1 2 3) a (nth lst 0) b (nth lst 1) c (nth lst 2)] (+
a b c)))
=
On Mon, Jul 6, 2009 at 7:50 PM, Richard Newman holyg...@gmail.com wrote:
Since it's not apparently a simple bug in my function above, but
something about a combination of that version of that function and
some other part of my code, I can't think of a way to track the
cause down short of
On Mon, Jul 6, 2009 at 11:25 PM, John Harrop jharrop...@gmail.com wrote:
On Mon, Jul 6, 2009 at 7:50 PM, Richard Newman holyg...@gmail.com wrote:
Have you tried simpler things like splitting the offending function
into a separate namespace, or seeing what happens with (or without)
AOT
On Tue, Jul 7, 2009 at 9:30 AM, Stephen C. Gilardi squee...@mac.com wrote:
On Jul 7, 2009, at 5:51 AM, John Harrop wrote:
Somehow, code that is treated as valid when compiled a function at a time
is treated as invalid when compiled all at once. That pretty much proves
it's
Problem: Passing primitives from an inner loop to an outer loop efficiently.
Here is what I've found.
The fastest method of result batching, amazingly, is to pass out a list and:
(let [foo (loop ... )
x (double (first foo))
r1 (rest foo)
y (double (first r1))
r2 (rest r1)
z (double (first r2))]
On Mon, Jul 6, 2009 at 8:53 AM, Chouser chou...@gmail.com wrote:
On Sun, Jul 5, 2009 at 3:51 PM, John Harropjharrop...@gmail.com wrote:
This is frankly quite baffling. The changes to the function are
innocent from a large-literal or pretty much any other perspective.
Both your functions
Or if you really do need a list:
(for [x [1 2 3]] (cons 'some-symbol (list x)))
Why not
(for [x [1 2 3]] (list 'some-symbol x))
?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this
On Mon, Jul 6, 2009 at 3:58 PM, Emeka emekami...@gmail.com wrote:
(defn- subexpressions-of-sum** [[n p] terms]
(let-print [sum (cons '+ (map #(factor-term % n p) terms))
prod (rest (make-product* n p))]
(cons sum
(map #(cons '* (cons sum (rest %)))
(concat prod
I had this:
(defn- subexpressions-of-sum** [[n p] terms]
(let-print [sum (cons '+ (map #(factor-term % n p) terms))
prod (rest (make-product* n p))]
(concat [sum] (subexpressions-of-product (cons sum prod)
in a source file with other definitions. Load-file worked. I then
that large from a number being changed.
This is frankly quite baffling. The changes to the function are
innocent from a large-literal or pretty much any other perspective.
On 7/5/09, Stephen C. Gilardi squee...@mac.com wrote:
On Jul 5, 2009, at 2:01 AM, John Harrop wrote:
and got
301 - 332 of 332 matches
Mail list logo