Re: zip-reduce

2012-12-24 Thread Alan Malloy
Except of course zip-seq doesn't need the f, acc arguments. Sorry about that. On Monday, December 24, 2012 7:18:17 PM UTC-8, Alan Malloy wrote: > > Probably better to write it more generally, by creating a seq from a > zipper and then just using the ordinary reduce function on that zip: > > (def

Re: zip-reduce

2012-12-24 Thread Alan Malloy
Probably better to write it more generally, by creating a seq from a zipper and then just using the ordinary reduce function on that zip: (defn zip-seq [f acc z] (map node (tree-seq branch? children z))) (reduce f acc (zip-seq some-zipper)) On Monday, December 24, 2012 6:27:00 PM UTC-8, JvJ w

zip-reduce

2012-12-24 Thread JvJ
The other day I wrote this as a utility function because I couldn't find anything like it in the zipper libary. Am I missing something? Is something like this implemented somewhere? (defn zip-reduce "Reduce called on a zipper." [f acc z] (if (zip/end? z) acc (recur f (f acc z)

Re: ClojureCLR errors on Mono Linux

2012-12-24 Thread RobertLJ
Shantanu The best way to get going right now with ClojureCLR is to build it from source. The following is the process to build ClojureCLR on Linux (Assuming that the mono development environment is installed). 1. Download: https://github.com/clojure/clojure-clr/archive/clojure-1.4.1.tar.gz

Re: EOF when executing lein trampoline cljsbuild repl-listen

2012-12-24 Thread Mark
Thanks guys. I switched to a Linux environment and it works fine. On Monday, December 24, 2012 3:49:54 AM UTC-8, David Powell wrote: > > I can confirm the same problem > > > On Sun, Dec 23, 2012 at 11:30 PM, Mark >wrote: > >> Hi, >> I'm trying to make my way through the modern-cljs tutorials an

Merry Christmas Everybody

2012-12-24 Thread Simone Mosciatti
I just wanted to say "Merry Christmas" to this wonderful community that during this first (half) year learning clojure is really helping me. Thanks to everybody and best wishes for the holidays Simone Mosciatti PS: Here in Italy is just 0.11 AM of the 25th of December aka Christmas... -- You

Re: inserting code into reify methods

2012-12-24 Thread Alan Malloy
You don't need any of the typehints in your reify body. The compiler infers argument and return types from the interface definition. On Monday, December 24, 2012 5:35:35 AM UTC-8, nkonovalov wrote: > > Hi. > > I have a java interface. > Something like this this. > > public interface ITest { >

Re: Use repeat with a function argument

2012-12-24 Thread Marko Topolnik
I deleted my answer minutes after posting. The phrase "function argument" is ambiguous ("argument to function", "argument which is a function") and I jumped to the wrong conclusion. On Monday, December 24, 2012 7:00:48 PM UTC+1, Sean Corfield wrote: > > He's repeating a function argument, not a

Re: Use repeat with a function argument

2012-12-24 Thread Sean Corfield
He's repeating a function argument, not a function. Meikel is correct that the second expression causes (some #{0} ...) to return nil when number is not a multiple of 3 or 5, and then zero? fails. As he suggests... (reduce + (filter (fn [number] (some zero? (map mod (take 2 (repeat number)) [3 5]

Re: inserting code into reify methods

2012-12-24 Thread juan.facorro
Here's a possible implementation: (ns macro-test (:require [clojure.pprint :as p])) (defn get-args-index [x] (first (filter identity (map-indexed #(when (vector? %2) %1) x (defn insert-at [x y i] (concat (take (inc i) x) (list y) (drop (inc i) x))) (defmacro reify-with-validation [f i

Re: EOF when executing lein trampoline cljsbuild repl-listen

2012-12-24 Thread David Powell
Ah, cool. This is fixed in leiningen HEAD. Though "lein ring server" doesn't work in HEAD. On Mon, Dec 24, 2012 at 6:08 AM, George Oliver wrote: > > > On Sunday, December 23, 2012 3:30:53 PM UTC-8, Mark wrote: >> >> >> I figure the reader is trying to load the project.clj but I'm executing >> f

Re: Use repeat with a function argument

2012-12-24 Thread Ben Wolfson
of course repeat works with functions: user=> (take 4 (map #(% 4) (repeat inc))) (5 5 5 5) On Sun, Dec 23, 2012 at 11:56 PM, Marko Topolnik wrote: > repeat is not supposed to work with functions, but there's repeatedly. > > > On Monday, December 24, 2012 4:20:23 AM UTC+1, Andrew Care wrote: >> >

Re: EOF when executing lein trampoline cljsbuild repl-listen

2012-12-24 Thread David Powell
Ah, cool. I can confirm that this works for me in leiningen HEAD. On Mon, Dec 24, 2012 at 6:08 AM, George Oliver wrote: > > > On Sunday, December 23, 2012 3:30:53 PM UTC-8, Mark wrote: >> >> >> I figure the reader is trying to load the project.clj but I'm executing >> from the project's root di

inserting code into reify methods

2012-12-24 Thread nkonovalov
Hi. I have a java interface. Something like this this. public interface ITest { void printHello(); void printName(String name); } And i get an implementation using reify. (def impl (reify macrotest.ITest (^void printHello [this] (println "Hello world!")) (^void printName [this ^

Re: Call namespace's functions from a record

2012-12-24 Thread Jim - FooBar();
You are sort of correct...It's not an *error* per ce (it will still work) but since you're going through a protocol it is a bit suicidal to use interop...Just use the protocol... :) Jim On 24/12/12 12:52, Christian Sperandio wrote: I thought the import was enough. And my error with the "." c

Re: Call namespace's functions from a record

2012-12-24 Thread Christian Sperandio
I thought the import was enough. And my error with the "." came from the fact Component is a compiled class and I believed I had to follow the Java standard writing. Thank for your help. On 12/24/2012 01:42 PM, Jim - FooBar(); wrote: Lose the "." - call children? like this: (children? c) an

Re: Call namespace's functions from a record

2012-12-24 Thread Jim - FooBar();
Lose the "." - call children? like this: (children? c) and make sure you can see the test-record.component namespace from your user ns (apart from importing the record class). HTH, Jim On 24/12/12 11:55, Christian Sperandio wrote: Hi, I'm testing the use of records in Clojure and I have som

Call namespace's functions from a record

2012-12-24 Thread Christian Sperandio
Hi, I'm testing the use of records in Clojure and I have some issues when I try to call function of another namespaces from the record. For testing purposes, I defined this record: (ns test-record.component (:use test-record.utils)) (defprotocol Hierarchical "Protocol for tree." (childre

Re: EOF when executing lein trampoline cljsbuild repl-listen

2012-12-24 Thread David Powell
I can confirm the same problem On Sun, Dec 23, 2012 at 11:30 PM, Mark wrote: > Hi, > I'm trying to make my way through the modern-cljs tutorials and running > into a blocker: I'm on tutorial 2 ( > https://github.com/magomimmo/modern-cljs/blob/master/doc/tutorial-02.md?.mdown) > and when I try

Re: abysmal multicore performance, especially on AMD processors

2012-12-24 Thread cameron
I've been moving house for the last week or so but I'll also give the benchmark another look. My initial profiling seemed to show that the parallel version was spending a significant amount of time in java.lang.isArray, clojush.pushstate/stack-ref is calling nth on the result of cons, since it i