sessions in Ring, Sandbar, Compojure, etc...

2011-05-10 Thread Shree Mulay
For the life of me, I can't get sessions to work, immaterial of which tutorial I try and get going??? Is there any tutorial out there that explicitly explains everything for a newb like me? After several round, I did successfully get form params to work! YEAH! But now, I'd like to create a login

Re: Creating instances of types not known at compile time

2011-05-10 Thread Meikel Brandmeyer
Hi, Am 10.05.2011 um 01:49 schrieb Simon Katz: Passing the class object does exactly what I want. Then passing a factory function will work, too—without reflection. Much more performance impact then checking a short string for a dot. Sincerely Meikel -- You received this message because

Re: sessions in Ring, Sandbar, Compojure, etc...

2011-05-10 Thread James Reeves
On 10 May 2011 07:24, Shree Mulay shreemu...@gmail.com wrote: For the life of me, I can't get sessions to work, immaterial of which tutorial I try and get going???  Is there any tutorial out there that explicitly explains everything for a newb like me? After several round, I did successfully

Re: ANN: A Clojure library for the Facebook Graph API - clj-facebook-graph

2011-05-10 Thread Max Weber
Hi Bojan, I've added a basic support to post something against the Facebook Graph API. The documentation for this new feature can be found under https://github.com/maxweber/clj-facebook-graph Best regards Max On 9 Mai, 20:22, Bojan Jovičić bojan.jovi...@gmail.com wrote: Hi Max, I have

Re: Ok, so code is data...

2011-05-10 Thread Bill Robertson
Thank you very much. On May 10, 1:32 am, Justin Kramer jkkra...@gmail.com wrote: 'read' and 'read-string' are what you're looking for. They each read a single Clojure object from an input source (PushbackReader for read, String for read-string). Alternatively, something like this can read

Re: A simulation of the Monty Hall Problem

2011-05-10 Thread Adam Burry
Ken: FYI, the best treatment of this problem I have seen is this one: http://www.cs.utoronto.ca/~hehner/PPP.pdf Adam -- 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

Aw: Ok, so code is data...

2011-05-10 Thread Stefan Kamphausen
Hi, from what you write I get the feeling, that you may be doing things in a too complicated manner. Maybe I am wrong. In any case, although it may not be Clojure but Common Lisp, you might want to take a look at the HTML generation in Peter Seibels excellent Practical Common Lisp: See

Re: Creating instances of types not known at compile time

2011-05-10 Thread Simon Katz
On May 10, 8:27 am, Meikel Brandmeyer m...@kotka.de wrote: Hi, Am 10.05.2011 um 01:49 schrieb Simon Katz: Passing the class object does exactly what I want. Then passing a factory function will work, too—without reflection. Much more performance impact then checking a short string for a

Re: Enlive update transformation

2011-05-10 Thread Thorsten Wilms
On 05/09/2011 10:15 PM, Thorsten Wilms wrote: I tried to turn that into a transformation: (defn substitute-token [ values] #(map (fn [m] (update-in m [:content] (fn [c] (apply (partial replace-str token %) c values)) Apparently I had my brain knotted, but raek and fliebel on IRC helped

Re: Ok, so code is data...

2011-05-10 Thread Jonathan Fischer Friberg
How do I actually just load code w/o evaluating it? mostly when you want something like this, you want a macro. Manipulating code is also done within macros. http://www.gigamonkeys.com/book/macros-standard-control-constructs.html http://www.gigamonkeys.com/book/macros-defining-your-own.html

Re: Ok, so code is data...

2011-05-10 Thread Timothy Baldridge
On Tue, May 10, 2011 at 10:26 AM, Jonathan Fischer Friberg odysso...@gmail.com wrote: How do I actually just load code w/o evaluating it? mostly when you want something like this, you want a macro. Manipulating code is also done within macros. Yeah, I would consider the whole code-is-data

Re: Reading clojure code of larger domain specific projects

2011-05-10 Thread Paul deGrandis
You might want to take a look at the clojars project: https://github.com/ato/clojars-web It's not quite to the scale you're looking for, but it's a start. Also keep in mind that a lot of business apps in Clojure look more like libraries (for a specific domain problem) than applications, so

Re: ANN: A Clojure library for the Facebook Graph API - clj-facebook-graph

2011-05-10 Thread Bojan Jovičić
Dear Max, this works like a charm. Thank you very much for real fast response. -- 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

How to merge two ArrayMaps?

2011-05-10 Thread clj123123
(def e1 {:a 1 :b b :c 300 }) (def e2 {:a1 :d blah}) how to merge to get that? {:a 1 :b b :c 300 :d blah} also is there a way to merge if the ArrayMap was in a vector? Thanks. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group,

Re: Hi, simple problem from a newbie

2011-05-10 Thread Armando Blancas
Don't be put off by these initial difficulties; this stuff is really different. I found this paper a very good read: http://www.cs.kent.ac.uk/people/staff/dat/miranda/whyfp90.pdf It puts the finger on a common problem: Such a catalogue of “advantages” is all very well, but one must not be

Re: How to merge two ArrayMaps?

2011-05-10 Thread Jonathan Fischer Friberg
use (merge e1 e2) Jonathan On Tue, May 10, 2011 at 6:11 PM, clj123123 ariela2...@gmail.com wrote: (def e1 {:a 1 :b b :c 300 }) (def e2 {:a1 :d blah}) how to merge to get that? {:a 1 :b b :c 300 :d blah} also is there a way to merge if the ArrayMap was in a vector? Thanks. -- You

Re: How Clojure protocols are implemented internally?

2011-05-10 Thread Krukow
On May 9, 12:09 am, David Nolen dnolen.li...@gmail.com wrote: On Sun, May 8, 2011 at 4:43 PM, Dmitry Kakurin dmitry.kaku...@gmail.comwrote: Very well, something along these lines would be my guess too. But that would mean that in case 2 protocols are no faster than multimethods. They

Re: How to merge two ArrayMaps?

2011-05-10 Thread clj123123
I wanted to merge ArrayMap in a vector. Is there a way to do that? I put this together but wondering it there's already a library for that. (defn merge-by-field xt must have field vals unique [xs xt field] (let [fmerge (fn [id s] (merge s (first (filter #(= id (val (find %

Re: How to merge two ArrayMaps?

2011-05-10 Thread Alan
user (let [inputs (concat e1 e2)] (map (partial apply merge) (vals (group-by :a inputs ({:d blah, :a 1, :b b, :c 300} {:d blah2, :a 2, :b a, :c 500}) On May 10, 10:10 am, clj123123 ariela2...@gmail.com wrote: I wanted to merge ArrayMap in a vector. Is there a way to do

Re: A simulation of the Monty Hall Problem

2011-05-10 Thread Konrad Hinsen
On 10 May, 2011, at 13:50 , Adam Burry wrote: FYI, the best treatment of this problem I have seen is this one: http://www.cs.utoronto.ca/~hehner/PPP.pdf There's also a compact Clojure solution based on the probability monad:

San Francisco Clojure Users

2011-05-10 Thread David Jagoe
G'day everyone, Forgive me if this is not the appropriate place for this message, but I'm in San Francisco for a few days from Johannesburg, South Africa. Any clojure users keen on meeting up? Any clojure events going on that I haven't spotted on-line? I run a business using Clojure for web

Re: A simulation of the Monty Hall Problem

2011-05-10 Thread Ken Wesson
On Tue, May 10, 2011 at 2:59 PM, Konrad Hinsen konrad.hin...@fastmail.net wrote: On 10 May, 2011, at 13:50 , Adam Burry wrote: FYI, the best treatment of this problem I have seen is this one: http://www.cs.utoronto.ca/~hehner/PPP.pdf There's also a compact Clojure solution based on the

can this program be sped up?

2011-05-10 Thread Carl Cotner
Hi, Is it possible to make Clojure run the following toy program faster (without changing the algorithm)? (defn primeQ [n] (primes 2 (/ n 2) n)) (defn divQ [d n] (= (mod n d) 0)) (defn primes [d2 t2 n2] (loop [d (int d2) t (int t2) n (int n2)] (if (divQ d n) false (if ( d t) true

Re: can this program be sped up?

2011-05-10 Thread Ken Wesson
On Tue, May 10, 2011 at 2:21 PM, Carl Cotner carl.cot...@gmail.com wrote: Hi, Is it possible to make Clojure run the following toy program faster (without changing the algorithm)? (defn primeQ [n] (primes 2 (/ n 2) n)) (defn divQ [d n] (= (mod n d) 0)) (defn primes [d2 t2 n2]  (loop [d

Re: can this program be sped up?

2011-05-10 Thread Ken Wesson
Addendum: if you are using Clojure 1.3 alpha, function calls may avoid boxing, but still have a call overhead, so you probably still want to avoid them in your loops, and unchecked primitive math is done differently. Check the documentation on that. -- You received this message because you are

Re: can this program be sped up?

2011-05-10 Thread David Nolen
On Tue, May 10, 2011 at 2:21 PM, Carl Cotner carl.cot...@gmail.com wrote: Hi, Is it possible to make Clojure run the following toy program faster (without changing the algorithm)? (defn primeQ [n] (primes 2 (/ n 2) n)) (defn divQ [d n] (= (mod n d) 0)) (defn primes [d2 t2 n2] (loop [d

Re: San Francisco Clojure Users

2011-05-10 Thread Zach Tellman
Unfortunately, you just missed the monthly Bay Area user group meetup, which was yesterday. But with Google I/O going on, maybe there are enough people around that an impromptu meetup would be plausible. Zach On May 10, 1:07 pm, David Jagoe davidja...@gmail.com wrote: G'day everyone, Forgive

Re: How Clojure protocols are implemented internally?

2011-05-10 Thread Christophe Grand
On Tue, May 10, 2011 at 7:13 PM, Krukow karl.kru...@gmail.com wrote: And I've got an impression that protocols are described to be as fast as interface dispatch (callvirt). Almost as fast in case one. There is an indirection because of dispatch. There is special support at the call

Re: San Francisco Clojure Users

2011-05-10 Thread David Jagoe
On 10 May 2011 15:00, Zach Tellman ztell...@gmail.com wrote: Unfortunately, you just missed the monthly Bay Area user group meetup, Yeah I saw that... gutted! which was yesterday.  But with Google I/O going on, maybe there are enough people around that an impromptu meetup would be plausible.

Bug? (vary-meta (promise) assoc :foo 1) hangs in Clojure 1.2

2011-05-10 Thread Ken Wesson
(vary-meta (promise) assoc :foo 1) hangs in Clojure 1.2. I suspect that vary-meta is somehow triggering an attempt to deref the promise. -- 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

Re: Bug? (vary-meta (promise) assoc :foo 1) hangs in Clojure 1.2

2011-05-10 Thread Alan
(promise) hangs in 1.2, if you try to print it from the repl. There's a ticket somewhere for better handling of non-delivered promises. On May 10, 5:01 pm, Ken Wesson kwess...@gmail.com wrote: (vary-meta (promise) assoc :foo 1) hangs in Clojure 1.2. I suspect that vary-meta is somehow

Re: Bug? (vary-meta (promise) assoc :foo 1) hangs in Clojure 1.2

2011-05-10 Thread Ken Wesson
On Tue, May 10, 2011 at 8:04 PM, Alan a...@malloys.org wrote: (promise) hangs in 1.2, if you try to print it from the repl. There's a ticket somewhere for better handling of non-delivered promises. Ah, damn. It should see if it's delivered or not and print #promise@5f18b or similar in that case

[OFF-TOPIC] - CA Status

2011-05-10 Thread Bruno Oliveira
I sent my contributor agreement through mail, months ago. I would to know if was received, my requests was to clojure and clojure-contrib projects I didn't received any feedback yet. Thanks a lot -- “Success is having to worry about every damn thing in the world, except money.” - Johnny Cash -

Re: sessions in Ring, Sandbar, Compojure, etc...

2011-05-10 Thread Matthew Boston
Maybe try looking at the source of a project on github using logins/ sessions. One I'm currently using for reference is from 4clojure https://github.com/dbyrne/4clojure On May 10, 2:24 am, Shree Mulay shreemu...@gmail.com wrote: For the life of me, I can't get sessions to work, immaterial of

Re: [OFF-TOPIC] - CA Status

2011-05-10 Thread Christopher Redinger
Hi Bruno, Unless Rich has received your CA within the past couple weeks, I would say he never received it. The compete list of CAs that he is received (within the past couple weeks) is here: http://clojure.org/contributing I'm assuming you sent it to the PO Box listed? Did you do anything

possibly non-intuitive behaviour of clojure.set/rename-keys and possible enhancement suggestion

2011-05-10 Thread Sunil S Nandihalli
Hello everybody, I tried to use clojure.set/rename-keys .. I kind of felt it has a little odd behaviour... for example .. (clojure.set/rename-keys {1 :a 2 :b 3 :c} {1 2 2 3 3 4}) returns {4 :a} I think a more reasonable behavior would be to have it return {2 :a 3 :b 4 :c} a further

Re: can this program be sped up?

2011-05-10 Thread Carl Cotner
Thanks, David, for your reply. I enjoyed your blog post, and I will try 1.3 alpha! Carl On May 10, 5:58 pm, David Nolen dnolen.li...@gmail.com wrote: It doesn't answer your question but maybe this will help you get some ideas on how to optimize your

Re: can this program be sped up?

2011-05-10 Thread Carl Cotner
On May 10, 5:47 pm, Ken Wesson kwess...@gmail.com wrote: Addendum: if you are using Clojure 1.3 alpha, function calls may avoid boxing, but still have a call overhead, so you probably still want to avoid them in your loops, and unchecked primitive math is done differently. Check the

Re: can this program be sped up?

2011-05-10 Thread Carl Cotner
Thanks for your thorough reply, Ken. On May 10, 5:43 pm, Ken Wesson kwess...@gmail.com wrote: [...] 1: Algorithmic smarts. Division is expensive. Replace divQ's implementation in terms of mod with the algorithm binary GCD and it will probably be faster. Likewise the / n 2 in primeQ can be

Re: can this program be sped up?

2011-05-10 Thread Ken Wesson
On Tue, May 10, 2011 at 10:14 PM, Carl Cotner carl.cot...@gmail.com wrote: Thanks for your thorough reply, Ken. You're welcome. 3: Technical speedups. Avoid function calls inside inner loops, which cause boxing and require var dereferencing. Fold divQ into primes, since it's only used once

Re: Ok, so code is data...

2011-05-10 Thread Bill Robertson
Thanks for the feedback and pointers. On May 10, 11:37 am, Timothy Baldridge tbaldri...@gmail.com wrote: On Tue, May 10, 2011 at 10:26 AM, Jonathan Fischer Friberg odysso...@gmail.com wrote: How do I actually just load code w/o evaluating it? mostly when you want something like this,

Re: possibly non-intuitive behaviour of clojure.set/rename-keys and possible enhancement suggestion

2011-05-10 Thread Sunil S Nandihalli
I agree there are going to be problems with implementation as-well .. for example if not all the keys in the current map are not in the kmap ... but situation can be handled however, if we passed a function this is going to be harder .. .. On Wed, May 11, 2011 at 8:26 AM, Sunil S Nandihalli