Different error reporting wrt java.lang types a new feature of 1.3.0-alpha2?

2010-10-28 Thread Jacek Laskowski
Hi, I've just run across a different error reporting in 1.3.0-alpha2 to the one in 1.2. See the sample below. Clojure 1.3.0-alpha2 user= (use 'clojure.contrib.monads) nil user= ((fetch-val 1) 4) ClassCastException java.lang.Long cannot be cast to clojure.lang.IFn

Re: Different error reporting wrt java.lang types a new feature of 1.3.0-alpha2?

2010-10-28 Thread Chris Maier
I don't recall all the reasons and details from Rich's conj talk, but this is expected behavior now; your numbers are now Longs internally by default. See http://github.com/clojure/clojure/commit/845c63e9317826a5564ef766550562b3fbe68181 Chris On Thu, Oct 28, 2010 at 6:00 AM, Jacek Laskowski

OS process timed out with clutch view server for Couch

2010-10-28 Thread Meikel Brandmeyer
Hi, did anyone encounter OS process timed out errors with the clutch view server for Couch? Defining the same view with javascript works fine, but when using clojure the view hangs and Couch basically logs OS process timed out errors. The command line seems to work. I could start the view server

Re: Different error reporting wrt java.lang types a new feature of 1.3.0-alpha2?

2010-10-28 Thread Chris Maier
Here we go: http://david-mcneil.com/post/1393750407/clojure-conj-day-1-notes Check the notes at the bottom from Rich's talk; it's the part about unified primitives and boxed numbers. Chris On Thu, Oct 28, 2010 at 7:20 AM, Chris Maier christopher.ma...@gmail.com wrote: I don't recall all the

Re: Fastest way to generate comma-separated list

2010-10-28 Thread andrei
Does this help? user (use 'clojure.string) nil user (join , (range 10)) 0,1,2,3,4,5,6,7,8,9 It still doesn't work for the list of strings. But thanks for reminding about it. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this

Re: Fastest way to generate comma-separated list

2010-10-28 Thread andrei
Are you looking for pr-str? user (pr-str foo) \foo\ Yeah, that's exactly what I tried to implement with my `pr-to-str`, thank you. -- 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: Let usage question

2010-10-28 Thread Chouser
On Wed, Oct 20, 2010 at 3:21 PM, Rich Hickey richhic...@gmail.com wrote: On Oct 20, 1:34 pm, cej38 junkerme...@gmail.com wrote: This question leads into something that I read in Joy of Clojure (page 161 in the latest MEAP edition): If you manage to hold onto the head of a sequence somewhere

reducing terms in vector

2010-10-28 Thread Glen Rubin
Hi! A little stuck on how to do this efficiently. I have data that looks like this ( [ [1 2] [3 4] [5 6] ... ] [ [5 6] [7 8] [9 0] ... ] ...) I am trying to sum the vector pairs, e.g [6 8] [10 12] [14 6] thx! -- You received this message because you are subscribed to the Google Groups

Re: reducing terms in vector

2010-10-28 Thread Ulises
A little stuck on how to do this efficiently.  I have data that looks like this ( [ [1 2] [3 4] [5 6] ... ]  [ [5 6] [7 8] [9 0] ... ] ...) I am trying to sum the vector pairs, e.g [6 8] [10 12] [14 6] Try: user (def all-pairs '([ [1 2] [3 4] [5 6] ] [[5 6] [7 8] [9 0]]) )

Re: reducing terms in vector

2010-10-28 Thread Eric Schulte
I don't know if use of `partial' is considered idiomatic, but I think it's the clearest in cases like this. user (def all-pairs '([ [1 2] [3 4] [5 6] ] [[5 6] [7 8] [9 0]]) ) #'user/all-pairs user (apply map (partial map +) all-pairs) ((6 8) (10 12) (14 6)) -- Eric Ulises

Re: Installing Clojure CLR

2010-10-28 Thread Sean Devlin
What is the full path of that program in the 1.2.0 bundle? I can't seem to find it. On Oct 27, 4:23 pm, dmiller dmiller2...@gmail.com wrote: Let me know on the error. Re REPL: run Clojure.Main.exe to start. -David On Oct 27, 2:54 pm, Sean Devlin francoisdev...@gmail.com wrote: So, I

apply an higher order function on an arbitrary nested data structure

2010-10-28 Thread Amitava Shee
I would like to apply an higher order function on an arbitrarily nested data structure which yields exactly the same structure but the original values replaced by the result of applying the passed in function. This is somewhat akin to the fmap function in Functor type class in haskell. I had a

encoding of non-ascii symbols in clojure.contrib.json

2010-10-28 Thread Alex Ott
Hello all I switched from org.danlarkin/clojure-json library to clojure.contrib.json, and found that all non-ascii characters are encoded as \u characters. But information on json.org states that character could be any-Unicode-character-except--or-\-or-control-character So, it seems that

Re: apply an higher order function on an arbitrary nested data structure

2010-10-28 Thread Sean Devlin
Like my same fn or something different? Maybe combine it with prewalk? Sean On Oct 28, 10:42 am, Amitava Shee amitava.s...@gmail.com wrote: I would like to apply an higher order function on an arbitrarily nested data structure which yields exactly the same structure but the original values

Re: apply an higher order function on an arbitrary nested data structure

2010-10-28 Thread nicolas.o...@gmail.com
Functor's fmap in Haskell is passed where to apply the function as an (hidden in the type class dictionary) argument. You would need somehow to be more specific about where you want to apply your function in the data-structure. (On predefined position, a la Functor, or on every leaf, with a

Re: apply an higher order function on an arbitrary nested data structure

2010-10-28 Thread Sean Devlin
Okay, you're re-inventing clojure.walk. Please take a look at that namespace. On Oct 28, 11:52 am, Eric Schulte schulte.e...@gmail.com wrote: Without each type specifying where it would like the function applied the result will be sort of hacky, but here's my hackey attempt at fmap in

parrot vm

2010-10-28 Thread Terrance Davis
Is anyone working on clojure for the parrot vm? -Terrance -- 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

Re: Installing Clojure CLR

2010-10-28 Thread dmiller
Github automatically provides a zip of any tagged commit, so you can download the source for the 1.2.0 release. That's the link with the little tag icon on it. That is a source distribution and you'd have to follow a long involved path to get that to run. I took the instructions for that off

Re: apply an higher order function on an arbitrary nested data structure

2010-10-28 Thread Konrad Hinsen
On 28 Oct 2010, at 16:42, Amitava Shee wrote: I would like to apply an higher order function on an arbitrarily nested data structure which yields exactly the same structure but the original values replaced by the result of applying the passed in function. This is somewhat akin to the fmap

Re: Images in autodoc?

2010-10-28 Thread Chris Maier
My interest is general improvement of Clojure documentation. At the conj, I spoke with Zack Kim about helping to improve the state of the documentation. My goal was to contribute additional documentation for vars that are lacking, as well as clarifying some of the more confusing doc strings

(count (filter ...)) much slower in 1.3 Alpha 2?

2010-10-28 Thread Btsai
I have some code that counts the elements in a list that map to true in a lookup table, looking something like this: (def lookup-table {1 true, 2 false}) (def elements (range 100)) (count (filter lookup-table elements)) On my machine, with server mode enabled, the count + filter got ~10

Re: Different error reporting wrt java.lang types a new feature of 1.3.0-alpha2?

2010-10-28 Thread Jacek Laskowski
On Thu, Oct 28, 2010 at 1:49 PM, Chris Maier christopher.ma...@gmail.com wrote: Here we go: http://david-mcneil.com/post/1393750407/clojure-conj-day-1-notes Check the notes at the bottom from Rich's talk; it's the part about unified primitives and boxed numbers. Thanks. That helped. Jacek

to macro or not?

2010-10-28 Thread Raoul Duke
hi, not looking to stir up a pot, looking to learn from people's experience. i've heard that in CL land, one is told to avoid macros as long as possible. i've heard other folks in the Clojure world say that if you aren't using macros, then sorta why bother use a Lisp since you are missing out on

Re: apply an higher order function on an arbitrary nested data structure

2010-10-28 Thread Sean Devlin
Okay, functor is a good idea but a weak implementation. My complaint is that it only provides functor behavior for the map function. same is a higher order function that works on anything, and is based on protocols. Take a look at the test cases to understand what I'm talking about.

Re: to macro or not?

2010-10-28 Thread Michael Gardner
On Oct 28, 2010, at 2:55 PM, Raoul Duke wrote: not looking to stir up a pot, looking to learn from people's experience. i've heard that in CL land, one is told to avoid macros as long as possible. i've heard other folks in the Clojure world say that if you aren't using macros, then sorta why

Re: to macro or not?

2010-10-28 Thread Raoul Duke
On Thu, Oct 28, 2010 at 1:08 PM, Michael Gardner gardne...@gmail.com wrote: Use a macro iff you can't do what you want with a function. sorta true, perhaps leading to the kernel question: how do you decide what it really is you want/need to do? cf. the use of macros then not use of macros in

Re: to macro or not?

2010-10-28 Thread Meikel Brandmeyer
Hi, Am 28.10.2010 um 21:55 schrieb Raoul Duke: i've heard other folks in the Clojure world say that if you aren't using macros, then sorta why bother use a Lisp since you are missing out on one of the most powerful differentiators. These people ^^^ should listen carefully to those people

Re: to macro or not?

2010-10-28 Thread Mike Meyer
On Thu, 28 Oct 2010 12:55:55 -0700 Raoul Duke rao...@gmail.com wrote: hi, not looking to stir up a pot, looking to learn from people's experience. i've heard that in CL land, one is told to avoid macros as long as possible. i've heard other folks in the Clojure world say that if you aren't

Re: Clojure issue tracking is now on JIRA

2010-10-28 Thread Tom Hicks
Worked great for meThanks Stuart for wrestling with the dragon. I've created and shared a couple of simple issue filters to get issue- browsers started. Search for them under managing filters section. cheers, -tom On Oct 27, 6:07 pm, Stuart Halloway stuart.hallo...@gmail.com wrote:

fundata1 -- Karmic Social Capital Benchmark and Shootout

2010-10-28 Thread Alexy
I am happy to announce fundata1 -- the largest-ever program per RAM allocation in Haskell, originally implemented in Clojure and then OCaml and Haskell for social network modeling. http://github.com/alexy/fundata1 It has now become the first large-scale social networking benchmark with a real

How to simplify cond statements

2010-10-28 Thread andrei
Hi, I have a code similar to this: (def pairs (list [1 :a] [2 :b] [3 :c])) ... (loop [ps pairs, ret {}] (cond (empty? ps) ret (some-test (first (first ps))) (recur (rest ps) (add-to- result ret (first (first ps :true (recur (rest ps) (do-smth-else ret (first

Re: to macro or not?

2010-10-28 Thread Santosh Rajan
On Fri, Oct 29, 2010 at 1:58 AM, Mike Meyer mwm-keyword-googlegroups.620...@mired.org 3) You need it to get the API syntax you want (most commonly, a DSL). This last point is what I consider the most powerful feature of any language. And thats what makes Lispy languages a class apart. Use a

Re: How to simplify cond statements

2010-10-28 Thread lprefontaine
user= (doc ffirst) - clojure.core/ffirst ([x]) Same as (first (first x)) nil user= That could help a bit : Luc P. andrei andrei.zhabin...@gmail.com wrote .. Hi, I have a code similar to this: (def pairs (list [1 :a] [2 :b] [3 :c])) ... (loop [ps pairs,

Re: How to simplify cond statements

2010-10-28 Thread Andrew Gwozdziewycz
I'd hoist the empty out of the cond using an if: (if (empty? ps) ret (let [fps (first (first ps))] (cond ...))) On Thu, Oct 28, 2010 at 8:49 PM, andrei andrei.zhabin...@gmail.com wrote: Hi, I have a code similar to this: (def pairs (list [1 :a] [2 :b] [3 :c]))

Re: to macro or not?

2010-10-28 Thread andrei
I'll try to extend Mike's answer by one more example. Consider `and` Lisp macro. It is not a function, because it must evaluate it's arguments lazily, and using macros is the only way to do it. But try to apply `and` to the list of values (I know, that it's a job for a function `every?`, but how

Re: to macro or not?

2010-10-28 Thread Mike Meyer
On Fri, 29 Oct 2010 06:30:27 +0530 Santosh Rajan santra...@gmail.com wrote: On Fri, Oct 29, 2010 at 1:58 AM, Mike Meyer mwm-keyword-googlegroups.620...@mired.org 3) You need it to get the API syntax you want (most commonly, a DSL). This last point is what I consider the most powerful

Re: to macro or not?

2010-10-28 Thread Mike Meyer
On Thu, 28 Oct 2010 18:12:39 -0700 (PDT) andrei andrei.zhabin...@gmail.com wrote: I'll try to extend Mike's answer by one more example. Consider `and` Lisp macro. It is not a function, because it must evaluate it's arguments lazily, and using macros is the only way to do it. Actually, this

Re: How to simplify cond statements

2010-10-28 Thread David Sletten
Andrei, You could just bind another local variable in the loop form: (loop [ps pairs ret {} ffps (ffirst ps)] (cond (empty? ps) ret (some-test ffps) (recur (rest ps) (add-to-result ret ffps) (ffirst (rest ps))) :true (recur (rest ps) (do-sth-else ret ffps) (ffirst

Re: apply an higher order function on an arbitrary nested data structure

2010-10-28 Thread Konrad Hinsen
On 28.10.2010, at 21:57, Sean Devlin wrote: Okay, functor is a good idea but a weak implementation. My complaint is that it only provides functor behavior for the map function. same is a higher order function that works on anything, and is based on protocols. Take a look at the test cases

Test for whether a function accepts a particular arity.

2010-10-28 Thread Ken Wesson
(defn accepts-arity? [n f] (reduce #(or %1 (= n (count %2)) (and (= ' (last (butlast %2))) (= n (- (count %2) 2 false (:arglists (meta f This works only if f has metadata -- anonymous lambdas don't but functions defined using defn do. I thought this up