I've been playing with matlab, and I'm liking it... the built in
documentation on the language is actually excellent, and the language
itself is pretty clean if you're used to java/c/algol type languages.
I like especially the built in syntax for matrix and tensor
operations, and the fact that ope
On Jun 18, 2:00 am, Konrad Hinsen wrote:
> The July/August issue of the IEEE magazine "Computing in Science and
> Engineering" has an introduction to functional programming for
> scientists that uses Clojure for the examples. It is already
> available (a bit in advance of the paper issue) a
Wrexsoul, please mate, these are good guys. Remember the beauty and
tradition of the language you're learning. It's a lisp and gives you
the power to effortlessly create almost any abstraction you can
imagine. Not being convinced of the beauty of this, open you mind a
bit and humble yourself some
I'm sorry, folds are catamorphisms, while stuff like (repeatedly f) or
(repeat n x) are anamorphisms, and can certainly be lazy.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, s
> A lazy right fold[1] allows short-circuiting, so here's one attempt:
Wow, that made my head explode.
Some points:
1) That's not exatly foldr, as (foldr + 0 [range 100]) ought to work
2) Foldr is not tail recursive nor can you really call an anamorphism
lazy
3) Never the less you did it, thr
On Jun 14, 5:04 am, Max Suica wrote:
> (defn interesting? [pixels in-range? count]
> (let [p-count (reduce-bail (fn [c p] (if (in-range? p) (inc c) c))
> (partial > count) 0 pixels)]
> [( = count yummy-pix-count) p-count]))
Shoot: s/[( = count yummy-pix-count) p-count]))/[(
Laurent, I think this is a close variant of the early exiting reduce
function you proposed:
(defn reduce-bail [f pred? val col]
(let [s (seq col)]
(if s
(if (pred? val)
(recur f pred? (f val (first s)) (next s))
val)
val
Oh! Sweet : )
On Jun 4, 6:29 pm, "Stephen C. Gilardi" wrote:
> On Jun 4, 2009, at 5:56 PM, Max Suica wrote:
>
> > But
> > (-> x identity) => (identity x) => x, so what our friend ozzi suggest
> > sounds pretty on the level.
> > If (identity
But
(-> x identity) => (identity x) => x, so what our friend ozzi suggest
sounds pretty on the level.
If (identity x) is not equivalent to evaluating x, then, well, that's
not the identity function :)
--~--~-~--~~~---~--~~
You received this message because you are s
I'm not sure how you're compositing your colors, but the function
you're using is not associative or commutative (I checked at lunch,
mmm), so I don't think you can reverse order.
It's:
a + b = (b1 + a1 (1 - b2), a2)
Your function might need to be something like
a + b = (b1*(1 - a2) + a1 (1 -
people in math discussions raise their eyebrow at my new comma-less
tuple and set notation:
(a_1 a_2 ... a_n a_(n+1) .. ) in R^|N|
{1 2 3 4 5} = {a in N+ | a < 6}
Haskel hated it that time I wrote:
fold:: (b a b) b [a]
or
sum x y & zs = fold (+) 0 x:y:zs, where:
sum 1 2 3 4 5 6 7 => haskell
On May 31, 1:55 am, Daniel Lyons wrote:
> On May 30, 2009, at 7:25 PM, kinghajj wrote:
>
>
>
> > On May 30, 1:19 pm, Daniel Lyons wrote:
> >> You can't have both partial application and variable arity functions.
>
> > Uh, yeah you can. Haskell can have variadic functions, like
> > Text.Printf.
Bleh, I've been completely wrong about what currying does. Here's a
correct definition:
(defn curry [f]
(fn [a]
(fn [b] (f a b))
So curry basically takes a fn f that normally operates on a pair, and
creates an fn that "partially applies" f to an argument. That function
in turn will complet
Hey, here's a hacked together curry function that does it somewhat
like haskell, in pseudo-code. Can you guys help me correct it?
(defn curry [f & args1]
(cond (= (arity f ) (count args)) (apply f args1)
(fixed? (arity f) (fn [& args2] (curry (apply partial f
args1) args2)
I think you could do a hack using macros and eval at runtime in order
to expand them into your code, but I think one of the fellas in the
chat room said to be wary if that's the only approach I can see to a
problem, because it's easy to screw up, and not entirely good
practice.
Btw, does clojure
Hey, is there such a wiki/doc for core clojure? The wiki for clojure-
contrib's project page is so nice, but clojure's wiki has very little.
Heh, I've been using clj-doc to make my own reference for it, but the
wiki is a lot prettier. It would be nice to generate one for core.
I've looked at the r
16 matches
Mail list logo