2010/4/23 Luc Préfontaine :
> Is there a Dutch version of Clojure ?!?!?! I want one in French then :
> (Laurent you just said you like to be bashed didn't you ? :)))
Well, I still think there could be value in creating examples with
good vars, args, etc. names.
So I propose the following add
When it comes to naming factory functions—functions that create things—
clojure.core gives four precedents:
1. Name it exactly what the new object is called. vector, hash-map,
set.
2. Name it a shortened version of #1. vec.
3. Prefix #1 with "make-". make-hierarchy, make-array.
4. Prefix #1 with "
Minor errata barely worth mentioning:on the page: http://clojure.org/datatypes
employeee.getName()
employeee needs just 2 'e' characters.
Cheers.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegro
Ah, great! And of course the piece I as missing is that nil and
Object get supported via extend. Makes sense now given that that was
the section of the doc, but it didn't click the first time through.
On Apr 22, 2:54 pm, Stuart Halloway wrote:
> A good place to look for examples is protocols.cl
We store routing rules in a database as Clojure code and get these to be
loaded dynamically and run according to some variable configuration.
Of course we make sure the code forms are stringent in the database and
we wrap execution of these things with proper error handling code :)))
That's one of
Is there a Dutch version of Clojure ?!?!?! I want one in French
then :
(Laurent you just said you like to be bashed didn't you ? :)))
Luc
On Thu, 2010-04-22 at 15:09 +0200, Laurent PETIT wrote:
> Could I still take a look at it, to see the kind of examples you
> provided (are the source cod
+1, I am also using this feature of the old deftype.
On Apr 22, 12:15 pm, Konrad Hinsen wrote:
> On 22.04.2010, at 18:53, Rich Hickey wrote:
>
> > Feedback and errata welcome as always,
>
> One feature in the deftype/defrecord split that I regret is that defrecord no
> longer allows the redefini
On Apr 19, 2010, at 7:52 , Heinz N. Gies wrote:
> Hi phil,
> thanks for the answer many good points there. So just to be sure, if I don't
> add a :gen-class (which I don't need to in my case) I can use the lib with
> both 1.1 and 1.2 w/o problems (save for the named ones) so the lein jar jar's
A good place to look for examples is protocols.clj and gvec.clj in
clojure itself. protocols.clj includes an example of implementing a
protocol on nil.
Stu
On protocols:
- doc string coming after the arg vecs seems odd. I'm used to putting
them after the "name" of whatever I'm working on.
On protocols:
- doc string coming after the arg vecs seems odd. I'm used to putting
them after the "name" of whatever I'm working on.
On protocols doc:
- "You can implement a protocol on nil ... Object": could you
elaborate on how these work and/or provide examples? I think this will
solve the one
A foolish idea out of my head :
For qualified keywords, e.g. :ns.part/name-part, check, *if the
current ns does not correspond to ns.part, that the keyword already
exist. And / or add a directive to explictly "declare" a qualified
keyword (that is, without having the compile-time check exception
t
On 22.04.2010, at 18:53, Rich Hickey wrote:
> Feedback and errata welcome as always,
One feature in the deftype/defrecord split that I regret is that defrecord no
longer allows the redefinition of equals and hashCode. Any attempt to override
those results in an error message about duplicate met
Hi Istvan,
I've run into this a fair bit too. To catch such problems (at
runtime), I sprinkle my code with (safe-get m :key) in key places,
rather than (:key m) or (m :key) or (get m :key). safe-get:
(defmacro lazy-get
"Like get but lazy about evaluating default"
[m k d]
`(if-let [pair#
Hi!
In general, what to give greater attention if I'm getting lots of
runtime errors due to mistyped keywords? (eg. I'm referencing a map
where the keyword is non-existent and this nil value goes deep down into
my code where it is very hard to see that this was caused by a
non-existing map en
I tried using deftype relatively recently, but realized it wouldn't
work for my needs because serialization via *print-dup* wasn't yet
implemented. I'd recommend including this with the 1.2 release (or is
there a new recommended way to serialize Clojure data?)
--
You received this message becaus
I have been doing some work cleaning up the design and implementation
of datatypes and protocols in preparation for the 1.2 release. Some
notable changes for those who have been working with the earlier
versions:
deftype/reify now take an explicit 'this' argument in method sigs.
The :as option is
I really hate how GMail line wraps without giving you a chance to
preview before sending.
Here's a version of parse that shouldn't line wrap. It also more
closely parallels unparse by using for instead of map:
(defn parse [file]
(let [r (reader file)]
(for [line (take (Integer/parseInt (.re
You'll want to take a look at the docs for c.c.string[1], so have that
open in another tab. Anyway, let's assume you have the data in a file
mytext.txt
First, load the raw data with the slurp fn
user=>(def raw-string (slurp "mytext.txt"))
Next, you'll want to use the split-lines fn to create a
How about this?
(use 'clojure.contrib.str-utils 'clojure.contrib.duck-streams)
(defn parse [file]
(let [r (reader file)]
(map (fn [line] (map #(Integer/parseInt %) (.split line " ")))
(take (Integer/parseInt (.readLine r)) (repeatedly
#(.readLine r))
(defn unparse [xss file
Oh wow... totally would have :)
On Apr 21, 8:16 pm, Harvey Hirst wrote:
> > (defn rotate [n s]
> > (let [[front back] (split-at (mod n (count s)) s)]
> > (concat back front)))
>
> Don't forget (mod n 0) is an ArithmeticException.
>
> Harvey
>
> --
> You received this message because you are s
Hi!
I'm learning Clojure and trying some Google Code Jam exercises.
I am more or less satisfied with the style of algorithms I write, but
I would like to know how to do input/output. I want it to be Clojure
style (terse/functional/efficient) not just rewriting the usual
loops...
Take a look at simp
I thought there might be a performance reason in there. Thanks for the
pointer to clj-time. Looks like a huge improvement over java date/calendar.
BTW: love the book. Mine is already getting dog eared.
On Apr 21, 2010 8:24 AM, "Stuart Halloway"
wrote:
The built-in Java comparison operators don'
> (defn rotate [n s]
> (let [[front back] (split-at (mod n (count s)) s)]
> (concat back front)))
Don't forget (mod n 0) is an ArithmeticException.
Harvey
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to cloju
OK. Thanks everyone for your help.
Neal
On Apr 21, 8:11 am, Alex Osborne wrote:
> Hi Neal,
>
> Neal writes:
> > I'm trying to use duck-streams, but it is missing from the clojure-
> > contrib JAR file (at least in build #81). I have listed the contents
> > of the JAR file and confirmed that i
Stu,
Good book!
It was pretty clear to me that it was a snapshot. It was really a
user error on my part. Now that I have made that error, I won't make
it again.
Thanks,
Neal
On Apr 21, 9:31 am, Stuart Halloway wrote:
> The second level header tells you the branch (e.g. master). On the
> l
Alex,
Yes. I was using the snapshot. My bad.
Neal
On Apr 21, 8:11 am, Alex Osborne wrote:
> Hi Neal,
>
> Neal writes:
> > I'm trying to use duck-streams, but it is missing from the clojure-
> > contrib JAR file (at least in build #81). I have listed the contents
> > of the JAR file and con
On Apr 22, 2010, at 14:28 , Douglas Philips wrote:
> eval can be a dangerous thing to use, you have to be very careful about where
> the source has come from, in terms of trusting that the code your programs
> 'eval's will not be malicious or dangerous in some way. There are no absolute
> rules
I would choose the one with glassfish which includes the web app things that
even though you may not need immediately(if compojure comes with embedded
jetty) will be very likely in the future when you use other app
containers(be it GAE or tomcat etc.)
I picked the base Java SE version and needs to
Douglas Philips writes:
> Looking at the clojure.org front page, there is no "roadmap" link, or
> anything that seems to be like that, to know what is on the radar,
There's no formal roadmap as such, most open-source projects just don't
tend to work that way.
Working notes and ideas are often p
Could I still take a look at it, to see the kind of examples you
provided (are the source code examples in english ?)
2010/4/22 Laurent PETIT :
> 2010/4/22 Joop Kiefte :
>> I made one simple and short one for beginners, I think to your liking, but
>> in Dutch...
>
> too bad I don't speak Dutch :-(
2010/4/22 Joop Kiefte :
> I made one simple and short one for beginners, I think to your liking, but
> in Dutch...
too bad I don't speak Dutch :-(
>
> 2010/4/22 Laurent PETIT
>>
>> Oh, really no answer ? :'(
>>
>> 2010/4/21 Laurent PETIT :
>> > Hello,
>> >
>> > I've consulted a lot of already ma
I made one simple and short one for beginners, I think to your liking, but
in Dutch...
2010/4/22 Laurent PETIT
> Oh, really no answer ? :'(
>
> 2010/4/21 Laurent PETIT :
> > Hello,
> >
> > I've consulted a lot of already made presentations of clojure.
> > They are great, but I guess they may not
Oh, really no answer ? :'(
2010/4/21 Laurent PETIT :
> Hello,
>
> I've consulted a lot of already made presentations of clojure.
> They are great, but I guess they may not suit my needs because it
> seems to me that either:
> * they are more 1 1/2 to 2 hours talks than 45 minutes
> * they assume
Thank you all!
I knew there was something simple that i was missing!
On Apr 22, 7:28 am, Douglas Philips wrote:
> On 2010 Apr 22, at 8:17 AM, Base wrote:
>
> > say i have a string that contains a form:
>
> > "(+ 1 1)"
>
> > I want to actually execute this. How do you do this? I thought that
>
On 2010 Apr 22, at 8:17 AM, Base wrote:
say i have a string that contains a form:
"(+ 1 1)"
I want to actually execute this. How do you do this? I thought that
eval would be able to handle this but apparently am misunderstanding
what eval does.
Well, eval is the second half of what you want
On Thursday 22 April 2010 14:17:15 Base wrote:
Hi!
> say i have a string that contains a form:
>
> "(+ 1 1)"
>
> I want to actually execute this. How do you do this? I thought that
> eval would be able to handle this but apparently am misunderstanding
> what eval does.
`eval' evals a form, s
Hi,
On Thu, Apr 22, 2010 at 20:17, Base wrote:
> say i have a string that contains a form:
>
> "(+ 1 1)"
>
> I want to actually execute this. How do you do this? I thought that
> eval would be able to handle this but apparently am misunderstanding
> what eval does.
You need to read the string
Hi all -
say i have a string that contains a form:
"(+ 1 1)"
I want to actually execute this. How do you do this? I thought that
eval would be able to handle this but apparently am misunderstanding
what eval does.
Thanks!
Bassel
--
You received this message because you are subscribed to th
38 matches
Mail list logo