I agree with number 2: it would be very nice to have this in contrib.
I needed it last month and rolled my own (less clean) version.
Thomas
On Sep 10, 10:26 pm, Matt Smith m0sm...@gmail.com wrote:
problem: convert a collection [1 2 0 1 2 3 0 1 2 3 0 0 1 2] into
partitions like:
((1 2) (0 1 2
On Sep 16, 4:10 pm, Nicolas Oury nicolas.o...@gmail.com wrote:
The logged function would have to be already a generic method, no?
Yes, and in idiomatic Common Lisp that's not particularly common
(pardon the pun). Generic functions are typically only used when
dynamic dispatch is actually needed.
I'm able to eval forms and strings defined at the root of a clojure file
(example below). Then I extended this pattern to records and protocols.
Q: Is this idiomatic clojure? Is there a better pattern for
encapsulating data/code in clojure?
Q: How would one guard against the brittleness of
Finished is a predicate which designates when the seed is exhausted.
Because seed is not necessary a sequence, finished is not always
empty?.
For instance:
= (unfold (fn [x] [(* x x) (inc x)]) #( % 10) 0)
(0 1 4 9 16 25 36 49 64 81 100)
Or the zipmap (zip2) example from the wikipedia
On Thu, Sep 16, 2010 at 07:53, Laurent PETIT laurent.pe...@gmail.com wrote:
2010/9/16 Meikel Brandmeyer m...@kotka.de
Hi Laurent,
On 16 Sep., 15:54, Laurent PETIT laurent.pe...@gmail.com wrote:
you don't like my one-liner ? :-)
I saw your message only after I sent mine. :)
(update-in
(loop [data (sorted-map)
collection newData
meeting (first collection)]
(def key ( ))
As a general rule, def should only be used at the top level. You
probably want (let [key ...] (if ...) here.
Hey, thanks for pointing this out - I was actually just trying to
Meikel,
(recur (cond (not (nil? (data key)))
(true? true)
*ieeck* Please do (cond ... :else default-clause). Not true, or (true?
true) or other stuff.
Wow, I somehow missed the :else option in cond? I've got that (true?
true) stuff scattered all over my code - going to
Thanks for replying,
Would definterface be the right thing to do in this case? I'm trying
to understand how best to solve similar problems and not this one in
particular.
sincerely
Sidhant
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to
On Fri, Sep 17, 2010 at 08:50, Alessio Stalla alessiosta...@gmail.com wrote:
On Sep 16, 4:10 pm, Nicolas Oury nicolas.o...@gmail.com wrote:
Note also that the OP's original example does not require anything
more than what defmacro already provides. And turning function calls
into macro calls
On 17 September 2010 00:56, Michael Ossareh ossa...@gmail.com wrote:
Meikel,
(recur (cond (not (nil? (data key)))
(true? true)
*ieeck* Please do (cond ... :else default-clause). Not true, or (true?
true) or other stuff.
Wow, I somehow missed the :else option in cond?
While debugging tests (hudson only failures) in pallet, I noticed that
there was some interaction between my tests, as if they were running in
parallel. To solve the issues I added binding calls inside each test
case, which solved my issues.
The c.c.logging test cases failures look
[L... is an array of ..., so it looks like you need to create a Java
array to give it.
Oh, dear, i could have expected something like that :)
But i spent a lot of time, just being clueless.
Thank you a lot for your help!
and big shout outs to everyone making this language possible!
JonnyB
I was just saying that not returning something that is a pair, for
example nil, is good enough.
(unfold (fn [x] (when (= x 10) [(* x x) (inc x)])) would work.
Both function can be written with each other anyway.
And they don't have the same number of args so they are compatible
with each
(defn unfold
([grow seed]
(lazy-seq
(if-let [[elt next-seed] (grow seed)]
(cons elt (unfold grow next-seed)
([grow finished? seed]
(unfold #(when (not (finished? %)) (grow %)) seed)))
(unfold (fn [x] [(* x x) (inc x)]) #( % 10) 0)
(0 1 4 9 16 25 36 49 64 81 100)
On 17 Set, 17:34, Doug Philips douglas.phil...@gmail.com wrote:
On Fri, Sep 17, 2010 at 08:50, Alessio Stalla alessiosta...@gmail.com wrote:
On Sep 16, 4:10 pm, Nicolas Oury nicolas.o...@gmail.com wrote:
Note also that the OP's original example does not require anything
more than what
Hi all,
I'm having a problem that may or may not be Compojure specific, so I
thought I'd try this group since the answer is probably easy- I am
just stuck.
I am reading the string through a simple form
(defn view-input []
(view-layout
[:h2 Enter one datum:]
[:form {:method post :action /}
On Fri, Sep 17, 2010 at 08:58, Michael Wood esiot...@gmail.com wrote:
On 17 September 2010 00:56, Michael Ossareh ossa...@gmail.com wrote:
Meikel,
(recur (cond (not (nil? (data key)))
(true? true)
*ieeck* Please do (cond ... :else default-clause). Not true, or (true?
My *guess* it's somehow connected to the code of view-layout since
it shows the representation of the function str.
Can place the full code (including view-layout) somewhere?
On Sep 17, 12:35 pm, Victor bluestar...@gmail.com wrote:
Hi all,
I'm having a problem that may or may not be Compojure
Greetings,
I'm trying to use appengine-clj (http://github.com/r0man/appengine-
clj) datastore and having a problem. This is probably not a bug but
something I'm missing.
I'm trying the following:
(defentity User ()
((id)
(phone)))
(save-entity (user {:id 1 :phone 2}))
(count (select
Found it, should be user (singular)
On Sep 17, 2:56 pm, Miki miki.teb...@gmail.com wrote:
Greetings,
I'm trying to use appengine-clj (http://github.com/r0man/appengine-
clj) datastore and having a problem. This is probably not a bug but
something I'm missing.
I'm trying the following:
I'm new to clojure, so sorry if this is a dummie question.
Studyng clojure I can understand the syntax and so onbut I would
like a real example comparing clojure and java.
Do you know some benchmark using first just java and than showing the
best results with clojure ?
--
You received this
I second faenvie's request for applications of Clojure books,
especially on AI. AI is the reason I started looking at a Lisp in the
first place. I'd also like to see Clojure become *the* language for
statistics, though I understand that R statisticians aren't so fond of
Lisps.
I just bought
I highly recommend using redis for this. There is even a clojure redis client.
http://github.com/ragnard/redis-clojure
On Fri, Sep 17, 2010 at 9:00 PM, David McNeil mcneil.da...@gmail.com wrote:
Is there a disk-backed memoize available? I have an application where
I would like the cache of
On Fri, Sep 17, 2010 at 10:49 AM, Nicolas Oury nicolas.o...@gmail.com wrote:
I was just saying that not returning something that is a pair, for
example nil, is good enough.
The implement is equivalent, most languages I know that has unfold use
your approach(i.e. return Maybee,s or None).
This
See http://clojure.pastebin.com/ncaULRbU (works for me).
I've changed the POST handler to use *params* and I also think you're
not closing the :h2 in view output.
On Sep 17, 3:11 pm, Victor Olteanu bluestar...@gmail.com wrote:
Sure, here it is:
(defn view-layout [ content]
(html
Hi,
I'd like to suggest a version trim for clojure.string that
can accept a specific character to be trimmed::
(defn ^String ctrim
Removes a character from the left side of string.
[char ^CharSequence s]
(let [slen (.length s)
index-left (loop [index (int 0)]
On Sep 17, 11:18 pm, Martin Blais bl...@furius.ca wrote:
I'm still new here... what is the common procedure for
outsiders to contribute? Fork on github and send link to
branch? Like this? Let me know.
Never mind this bit; I found the relevant info on the Clojure website.
(Still interested in
Hello,
In the following contrived example, I get an error when macroexpanding (defn
foo ...):
(defmacro special-fn-spec []
'([bar baz] (println bar baz)))
(defn foo
([bar] (foo bar :default))
(special-fn-spec))
The error is:
Parameter declaration special-fn-spec should be a vector
28 matches
Mail list logo