Re: Coercing a map to a record

2010-05-21 Thread Meikel Brandmeyer
Hi, user=> (defrecord Bar [x]) user.Bar user=> (into (Bar. nil) {:x 1 :y 2}) #:user.Bar{:x 1, :y 2} One still has to know, that Bar takes an argument, but one could provide and API function which takes care of that. user=> (defrecord Bar [x]) user.Bar user=> (defn empty-bar [] (Bar. nil)) #'user

Re: No string?

2010-05-21 Thread Allan Moore
Great. Thanks James. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group

Re: No string?

2010-05-21 Thread James Reeves
clojure.contrib.string is part of Clojure-Contrib 1.2, whilst you're using 1.1. I believe clojure.contrib.str-utils is the equivalent 1.1 library. (also, clojure.contrib.string was designed to be "require"d, rather than "use"d). - James On May 22, 2:58 am, Allan Moore wrote: > Okay, this is pr

Coercing a map to a record

2010-05-21 Thread James Reeves
Hi folks, I've been experimenting with the new type system in Clojure 1.2, but I've hit something of a problem. If I define a record: user=> (defrecord Foo []) user.Foo Then I can coerce a map into a type Foo like so: user=> (def m {:x 1, :y 2}) #'/user/m user=> (Foo. {} m) #:user.Foo{:x 1, :y

No string?

2010-05-21 Thread Allan Moore
Okay, this is probably a stupid question, but I have these three lines at the top of my file: (use 'clojure.contrib.duck-streams) (use 'clojure.contrib.classpath) (use 'clojure.contrib.string) I get the error message: java.io.FileNotFoundException: Could not locate clojure/contrib/ s

API in Clojure for Java folklore

2010-05-21 Thread ka
Hi all, I've written an API in Clojure to be consumed by people working in the Java world. Now most of these people haven't even heard of Clojure; but all they care about is 1) a working API and 2) with nice documentation. 1) Something about the API - I tried out various things, types, records,

InternalReduce doesn't handle array of shorts

2010-05-21 Thread Dharkael
There doesn't appear to be an implementation for InternalReduce to handle an array of shorts. It also looks like ArraySeq_short is missing from ArraySeq.java Since there's one for the other java primitives I'm guessing this is an oversight -- You received this message because you are subscribed t

Re: Clojure on Android

2010-05-21 Thread Jimmy
Android 2.2 will have a JIT added to the VM which is reportedly improving performance anywhere between 2x to 5x. Lets hope Clojure get this type of speed improvement on Android. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, s

Clojure and Comet

2010-05-21 Thread Jimmy
Hi all, Is any one aware of a Clojure web framework that has built in support for Comet or BOSH? Thanks, Jimmy -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new membe

Server LISP-paper

2010-05-21 Thread Thomas Larsen
I have written/am writing a small paper, basically describing an implementation of a LISP-like language ("Server LISP") aimed at client-server/cloud- based systems, incorporating persistence by object-storage/object-oriented databases. Besides the "normal" use of LISP as a programming-language, the

How I learned to stop worrying and love condp

2010-05-21 Thread John Williams
I was in to process of writing a rant against condp when I realized I had been thinking about it all wrong. Here is what I wanted at first: (defmacro casep [pred & clauses] `(condp #(%2 %1) ~pred ~...@clauses)) In other words, I want to be able to specify a unary predicate instead of a binary

Re: Clojure on Android

2010-05-21 Thread Remco van 't Veer
On 2010/05/20 23:50, Mike Meyer wrote: > Clojure on Android isn't hard to set up, but performance isn't very > good. IIRC, there are two issues: both reflection and GC - which > Clojure tends to use heavily - are slow on Dalvik. Possibly Froyo will > help with that. Froyo will include JIT for dal

Re: Is Advanced Destructuring Considered Idiomatic?

2010-05-21 Thread Meikel Brandmeyer
Hi, On May 21, 9:35 am, Laurent PETIT wrote: > I would bet on: meant as examples for demonstrating the possible > combinations, as well as the recursive nature of the patterns. Yes. I second that. I hardly ever needed (or saw in other code) more than {:keys [a b c]} or [a b & c]. In the sequenc

Re: Simlpe style question

2010-05-21 Thread edlich
Dear freinds, > I would be interested in your feedback now that you've read all the > different proposed alternatives ? Thanks a lot for all these fruitful answers! I am very grateful. Especially the examples of Laurent and Islon where very impressive. I think this should be a major aspect in bo

Re: Is Advanced Destructuring Considered Idiomatic?

2010-05-21 Thread Laurent PETIT
2010/5/21 Stefan Rohlfing > This site http://paste.lisp.org/display/97057 shows various examples > of destructuring in Clojure ranging from basic to advanced. I managed > to follow the more basic examples, but then got quickly lost when I > looked at this one: > > (let [ [{a :a b :b c :c :as m :o

Is Advanced Destructuring Considered Idiomatic?

2010-05-21 Thread Stefan Rohlfing
This site http://paste.lisp.org/display/97057 shows various examples of destructuring in Clojure ranging from basic to advanced. I managed to follow the more basic examples, but then got quickly lost when I looked at this one: (let [ [{a :a b :b c :c :as m :or {a 100 b 200}} [p q r & s] ] [{:a 5 :