On 8 Lis, 08:11, pmf phil.fr...@gmx.de wrote:
Hmm, someone else has made another closure available :).
http://googlecode.blogspot.com/2009/11/introducing-closure-tools.html
There's also Clozure Common Lisp [1], which is conceptually closer to
Clojure.
There's also a web browser written
Hello I have such data
[ [ tom 23 ] [ ann 4434 ] [ tom 1234 ] [mike 34 ] ]
I would like to sort these data so finally i got
[ [ ann 4434 ] [mike 34 ] [ tom 23 ] [ tom 1234 ] ]
note that i don't care the order between tom keys (1234 can be
before 23)
I have seen sort-by but I can't find
Hi All,
I have been watching Clojure for about 6 months. I finally sat down
and tried to code a non-trivial task with it. I come from Java and
have dabbled in LISP but never for something significant.
So I am asking if you would look at the following code and provide
feedback on how it can be
OK. I have figured it out. I just looked into core.clj and noticed that
keyfn is a function which know how to get a value from an element in a
collection. That value is just compared with other.
2009/11/7 Michael Jaaka michael.ja...@googlemail.com
Hello I have such data
[ [ tom 23 ] [ ann
Hi! How would you solve such problem:
I have a collection of pairs (key, value) -
[ [ tom 32 ] [ tom 2333 ] [ anne 12 ] [ anne 55 ] ]
As you can see keys can occur more than once, also that collection is very
large so it should be evaluated lazily (for example the collection cames
from stream
Hi Alex,
Wow! Thank you so much for this excellent explanation! It totally
makes sense now :-)
S.
On 2009-11-07, at 9:46 PM, Alex Osborne wrote:
Stefan Arentz wrote:
I must admin that I don't fully understand the difference between foo
and #'foo. That is probably why I'm making this
I've started reading SICP and I came across the Fermat primality test
implemented an Scheme. I reimplemented it in Clojure and was able to
switch the recursive call in fast-prime to TCO/recur, but I was unable
to do the same for the exp-mod function.
(defn exp-mod [base exp m]
(cond
(zero?
One correction: after playing with the functions a bit I noticed I
screwed up, putting sqrt where I needed square.
On Sun, Nov 8, 2009 at 4:43 PM, Robert Campbell rrc...@gmail.com wrote:
I've started reading SICP and I came across the Fermat primality test
implemented an Scheme. I
Hint: Use an accumulator.
http://htdp.org/2003-09-26/Book/curriculum-Z-H-39.html#node_chap_31
In fact, you may want to consider reading How to Design Programs before SICP.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Hi,
Am 08.11.2009 um 13:33 schrieb Michael Jaaka:
Hi! How would you solve such problem:
I have a collection of pairs (key, value) -
[ [ tom 32 ] [ tom 2333 ] [ anne 12 ] [ anne 55 ] ]
As you can see keys can occur more than once, also that collection
is very large so it should be
Can any imperative code be transformed to functional equivalent?
(Give an answer in terms of the same way I can answer on recursion and
loops)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to
You have a bug:
(defn exp-mod [base exp m]
(cond
(zero? exp) 1
(even? exp) (mod (Math/sqrt (exp-mod base (/ exp 2) m)) m)
:else (mod (* base (exp-mod base (inc exp) m)) m)))
should be
(defn exp-mod [base exp m]
(cond
(zero? exp) 1
(even? exp) (mod (Math/sqrt (exp-mod
On Sun, Nov 8, 2009 at 8:41 AM, Michael Jaaka
michael.ja...@googlemail.com wrote:
Can any imperative code be transformed to functional equivalent?
(Give an answer in terms of the same way I can answer on recursion and
loops)
Short answer: Yes.
Long answer: Yes, but sometimes the
On Sun, Nov 8, 2009 at 7:33 AM, Michael Jaaka
michael.ja...@googlemail.comwrote:
Hi! How would you solve such problem:
I have a collection of pairs (key, value) -
[ [ tom 32 ] [ tom 2333 ] [ anne 12 ] [ anne 55 ] ]
As you can see keys can occur more than once, also that collection is very
Mark: that looks a lot like the collector I learned about in The
Little Schemer. I actually do have How to Design Programs, but I
wanted to finish Seasoned Schemer first. I was poking around in SICP
because of a Project Euler problem. Thanks for the tip!
John: good catch. Can you confirm the
It's one thing to try to protect the programmer from accidentally
shooting himself on the foot, but I don't think it is as necessary for
a language to prevent him from doing it on purpose.
On 8 nov, 02:59, John Harrop jharrop...@gmail.com wrote:
user= (def q 'G__723)
#'user/q
user= (def r
On Sun, Nov 8, 2009 at 1:39 PM, Robert Campbell rrc...@gmail.com wrote:
John: good catch.
Thanks.
Can you confirm the difference between my original
defn and your letfn? Both work, but as I understand it from the
documentation, defn would actually define that local function
globally,
I have this Compojure code that works fine:
(defroutes my-routes
(GET /api
(my-code request)))
I want this code to be generated by a macro. My real code is more
complex but the error is the same.
(defmacro mydefroutes []
`(defroutes my-routes
(GET /api
(my-code
Try
(defmacro mydefroutes []
`(defroutes my-routes
(GET /api
(my-code ~'request
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to
On 2009-11-08, at 3:40 PM, Richard Newman wrote:
Try
(defmacro mydefroutes []
`(defroutes my-routes
(GET /api
(my-code ~'request
Brilliant! I learn something new every day :-)
S.
--~--~-~--~~~---~--~~
You received this message because
On Nov 4, 9:07 pm, Lauri Oherd lauri.oh...@gmail.com wrote:
With this patch, the trailing whitespace characters in clojure file
buffer will be deleted automatically before each save if custom
parameter 'clojure-mode-cleanup-whitespace' is set.
This is based on the js2-mode where similar
Wilson MacGyver wrote:
Does Clojure have a function like Haskell's group?
In Haskell,
Input: group [1,2,2,1,1,1,2,2,2,1]
Output: [[1],[2,2],[1,1,1],[2,2,2],[1]]
(use 'clojure.contrib.seq-utils)
(partition-by identity [1 2 2 1 1 1 2 2 2 1])
= ((1) (2 2) (1 1 1) (2 2 2) (1))
ah, thank you for the help!
On Mon, Nov 9, 2009 at 1:57 AM, Alex Osborne a...@meshy.org wrote:
Wilson MacGyver wrote:
Does Clojure have a function like Haskell's group?
In Haskell,
Input: group [1,2,2,1,1,1,2,2,2,1]
Output: [[1],[2,2],[1,1,1],[2,2,2],[1]]
(use
23 matches
Mail list logo