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
[Thro
On Sep 17, 11:18 pm, Martin Blais 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 comments about
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)]
> I highly recommend using redis for this. There is even a clojure redis client.
>
> http://github.com/ragnard/redis-clojure
Thanks for the tip. It looks interesting, but in this case it is not
appropriate to add a separate process to the mix. I need to find a
good solution that is just a library.
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 wrote:
> Sure, here it is:
>
> (defn view-layout [& content]
> (html
> (doctype :xhtml-strict)
On Fri, Sep 17, 2010 at 10:49 AM, Nicolas Oury 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 Maybe or None).
This link use the unfold p f
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 wrote:
> Is there a disk-backed memoize available? I have an application where
> I would like the cache of values to survive resta
Is there a disk-backed memoize available? I have an application where
I would like the cache of values to survive restarts of the app.
Thank you.
-David McNeil
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to cloju
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 Prac
Sure, here it is:
(defn view-layout [& content]
(html
(doctype :xhtml-strict)
(xhtml-tag "en"
[:head
[:meta {:http-equiv "Content-type"
:content "text/html; charset=utf-8"}]
[:title "Datum"]]
[:body content]))
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
The abstracts for the talks at the first Clojure-conj have been
posted.
http://first.clojure-conj.org/speakers
Looking forward to seeing many of you there,
David
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to cl
Found it, should be "user" (singular)
On Sep 17, 2:56 pm, Miki 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:
>
> (defentity Us
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 "u
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 wrote:
> Hi all,
>
> I'm having a problem that may or may not be Compojure specific, so I
On Fri, Sep 17, 2010 at 08:58, Michael Wood wrote:
> On 17 September 2010 00:56, Michael Ossareh wrote:
>> Meikel,
>>
>>>
(recur (cond (not (nil? (data key)))
(true? true)
>>>
>>> *ieeck* Please do (cond ... :else default-clause). Not true, or (true?
>>> true) or othe
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 17 Set, 17:34, Doug Philips wrote:
> On Fri, Sep 17, 2010 at 08:50, Alessio Stalla wrote:
> > On Sep 16, 4:10 pm, Nicolas Oury 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
(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)
(unfol
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 othe
> "[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
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 similar
On 17 September 2010 00:56, Michael Ossareh 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? I
On Fri, Sep 17, 2010 at 08:50, Alessio Stalla wrote:
> On Sep 16, 4:10 pm, Nicolas Oury 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 is not a great idea; it won't cover the use
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 t
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 - goi
>> (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 t
On Thu, Sep 16, 2010 at 07:53, Laurent PETIT wrote:
> 2010/9/16 Meikel Brandmeyer
>>
>> Hi Laurent,
>>
>> On 16 Sep., 15:54, Laurent PETIT wrote:
>>
>> > you don't like my one-liner ? :-)
>>
>> I saw your message only after I sent mine. :)
>>
>> > (update-in coll [k] (fnil update-in *default-val
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 pa
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 en
On Sep 16, 4:10 pm, Nicolas Oury 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. However, you can achi
31 matches
Mail list logo