Re: [Bug] StackOverflowError while using map inside a reduce

2010-11-02 Thread Meikel Brandmeyer
Hi, Am 02.11.2010 um 12:58 schrieb Pepijn de Vos: The one-liner: http://gist.github.com/659491 I would expect this is because you pile lazy seq on lazy seq, which then get realised, unfolding the whole thing resulting in the stack overflow. Try this: user= (reduce #(doall (map + %1 %2))

Re: defmethod hangs

2010-11-01 Thread Meikel Brandmeyer
Hi, your code is really hard to understand. Please let let to be your friend! I extracted things a little bit and put everything in a let. Since I have no clue about collission detection in physics engines I derived the local names from the operations done inc, dec, etc. More meaningful names

Re: How to simplify cond statements

2010-10-29 Thread Meikel Brandmeyer
Hi, On 29 Okt., 12:11, andrei andrei.zhabin...@gmail.com wrote: 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

Re: Pulling threads...

2010-10-29 Thread Meikel Brandmeyer
Hi, On 29 Okt., 06:58, Brian Ericson li...@curvybits.org wrote: (map #(.start %) threads) map is not a loop. It creates a lazy sequences which does - nothing. At least not until it is realised. Here you throw it away immediatelly. Hence, no work is done. Use doseq instead when your main

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: 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: bug or misunderstanding intern?

2010-10-27 Thread Meikel Brandmeyer
Hi, from http://clojure.org/reader: Symbols begin with a non-numeric character and can contain alphanumeric characters and *, +, !, -, _, and ?. (and ' with 1.3 I guess) So not really surprising behaviour. Sincerely Meikel -- You received this message because you are subscribed to the Google

Re: bug or misunderstanding intern?

2010-10-27 Thread Meikel Brandmeyer
Hi again, and additionally (explaining the error message): '.' has special meaning - it can be used one or more times in the middle of a symbol to designate a fully-qualified class name, e.g. java.util.BitSet, or in namespace names. Sincerely Meikel -- You received this message because you are

Re: using a macro like a function

2010-10-27 Thread Meikel Brandmeyer
Hi, On 27 Okt., 13:53, Sunil S Nandihalli sunil.nandiha...@gmail.com wrote: I would like to do something like the following ..  (- create clojure.repl/apropos (map doc)) but I can't do it since doc is a macro and not a function.. how would one wrap doc with a function so that it can be

Re: Clojure performance on shootout

2010-10-26 Thread Meikel Brandmeyer
Hi, On 26 Okt., 13:17, Stuart Halloway stuart.hallo...@gmail.com wrote: As an aside: You will not be able to just run benchmarks carefully tuned for 1.2 under 1.3 and get best performance, as some of the performance tricks are now counter-indicated. Is there some documentation how tuning

Re: Detecting a byte array -- byte[]

2010-10-24 Thread Meikel Brandmeyer
Hi, user= (defn byte-array? [o] (instance? (Class/forName [B) o)) #'user/byte-array? user= (byte-array? abc) false user= (byte-array? (byte-array [(byte 1) (byte 2)])) true Sincerely Meikel -- You received this message because you are subscribed to the Google Groups Clojure group. To post to

Re: Detecting a byte array -- byte[]

2010-10-24 Thread Meikel Brandmeyer
Hi, On 24 Okt., 05:53, Shantanu Kumar kumar.shant...@gmail.com wrote: I want to be able to detect arrays of other types too - e.g. char[], Integer[] etc. Other types can be done as [C (char), [Ljava.lang.String;, etc. You can get the types via type or class in the repl. Hope this helps.

Re: Detecting a byte array -- byte[]

2010-10-24 Thread Meikel Brandmeyer
Hi, On 24 Okt., 14:27, Shantanu Kumar kumar.shant...@gmail.com wrote: by the way the Class/forName thing completely took me by surprise. :-) Also useful for protocols (extend-type (Class/forName ...)) and multimethods (defmethod foo (Class/forName ...)). Sincerely Meikel -- You received

Re: Trying to Load An Alias from Another Namespace into The Current Namespace

2010-10-24 Thread Meikel Brandmeyer
Hi, On 24 Okt., 04:00, Stefan Rohlfing stefan.rohlf...@gmail.com wrote: This is what I did: - src/active-record/tns.clj (ns active-record.tns) (require '[active-record.user :as user]) (require '[active-record.charge :as

Re: Wildcards on multimethod matching

2010-10-23 Thread Meikel Brandmeyer
Hi, if you only dispatch on types you can do it like this: (derive Object ::any) ; Also derive all of your ::keyword types from ::any. (defmulti foo #(vec (map type %))) (defmethod foo [::any Integer] ...) But this won't work if you dispatch on actual values as you did in your example. For

Re: getting started with clojure

2010-10-21 Thread Meikel Brandmeyer
Hi, On 21 Okt., 00:04, Eric Lavigne lavigne.e...@gmail.com wrote: I hope you are enjoying Clojure. Don't let all of this talk about compiling distract you from the fun part: writing code. Especially since compilation is not necessarily necessary and in most of the cases even

Re: Trying to Load An Alias from Another Namespace into The Current Namespace

2010-10-21 Thread Meikel Brandmeyer
Hi, you can't transfer aliases from one namespace to another. But as a workaround, you can create a file which contains the necessary commands: active-record/tables.clj: (require '[active-record.user :as user]) (require '[active-record.charge :as charge]) And then just load the file in the

Re: *assert* and assert

2010-10-21 Thread Meikel Brandmeyer
Hi, On 22 Okt., 07:48, Shantanu Kumar kumar.shant...@gmail.com wrote: When I runs this using Clojure 1.2.0: (binding [*assert* false] (assert false)) I get java.lang.AssertionError: Assert failed: false Can somebody please help me understand how to use *assert* for conditional

Re: clj-record Library: Handling Namespaces

2010-10-20 Thread Meikel Brandmeyer
Hi, On 20 Okt., 10:09, Stefan Rohlfing stefan.rohlf...@gmail.com wrote: ;; EOF while reading ;;  [Thrown class java.lang.Exception] Are you sure, that you don't have some syntax error somewhere? Sincerely Meikel -- You received this message because you are subscribed to the Google Groups

Re: clj-record Library: Handling Namespaces

2010-10-20 Thread Meikel Brandmeyer
Hi, On 20 Okt., 10:46, Stefan Rohlfing stefan.rohlf...@gmail.com wrote: You are right, there was a syntax error in charge.clj. However, after correcting the error I get the same error message as with the other namespace declaration: Did you try the same with charge/create? Examples in books

Re: clj-record Library: Handling Namespaces

2010-10-20 Thread Meikel Brandmeyer
Hi, On 20 Okt., 11:09, Stefan Rohlfing stefan.rohlf...@gmail.com wrote: Yes, I also tried charge/create. The error message is different, but it still does not work: More evidence for a problem with the user alias. Try a different one like (:require [active-record.user :as u]). Sincerely

Re: clj-record Library: Handling Namespaces

2010-10-20 Thread Meikel Brandmeyer
Hi, On 20 Okt., 11:35, Stefan Rohlfing stefan.rohlf...@gmail.com wrote: Evaluating your suggested declaration:  (ns active-record.program.core    (:require [active-record.user :as u])    (:require [active-record.charge :as charge])) I get the following error message: ;; Unable to

Re: clj-record Library: Handling Namespaces

2010-10-20 Thread Meikel Brandmeyer
Hi, On 20 Okt., 14:04, Stefan Rohlfing stefan.rohlf...@gmail.com wrote: I really learned at lot about dealing with namespaces today. I hope you also learned a bit about error messages. ;) No such var: user/create: That means you get past the namespace declaration. Hence they load fine. But in

Re: Nested For(s)

2010-10-19 Thread Meikel Brandmeyer
Hi, On 19 Okt., 13:16, Laurent PETIT laurent.pe...@gmail.com wrote: user= (def c [a b c d e f]) #'user/c user= (map vector c (cycle (range x))) ([a 0] [b 1] [c 2] [d 3] [e 4] [f 0]) And to promote some 1.2 goodness: map-indexed. user= (map-indexed #(vector %2 (rem %1 5)) abcdefghijklmn)

Re: Array types in multimethod?

2010-10-18 Thread Meikel Brandmeyer
Hi, user= (defmulti foo type) #'user/foo user= (defmethod foo (Class/forName [C) [_] (println It's an array!)) #MultiFn clojure.lang.mult...@2fbb3e9a user= (foo (make-array Character/TYPE 1)) It's an array! nil Could be easier... Hope this helps. Sincerely Meikel -- You received this message

Re: Newbie: Multiple String Operations

2010-10-15 Thread Meikel Brandmeyer
Hi, On 15 Okt., 16:25, Paul paul_bow...@yahoo.com wrote: (.replace (.replace (.replace (.replace string old new... Is there a more succinct and 'clojurish' way to do this? (- string (.replace old1 new1) (.replace old1 new1) ... (.replace oldN newN)) Sincerely Meikel -- You

Re: Python like hash-map constructor (a.k.a. dict)

2010-10-14 Thread Meikel Brandmeyer
Hi, Am 14.10.2010 um 23:07 schrieb Henk: Does dotimes force evaluation?, At a different level. (dotimes [n 1] (for ...)) does evaluate the for form. But it returns a seq which is never realised. So you do effectively … nothing. (dotimes [n 1] (into [] (for ...))) as in your example

Re: a macro

2010-10-13 Thread Meikel Brandmeyer
Hi, On 13 Okt., 07:55, Sunil S Nandihalli sunil.nandiha...@gmail.com wrote: I know if is a function and will not be evaluated before the macro expands.. may be there is a way to wrap it in a macro (since f is already defined which I would like to use) and have the macro Variables apply on the

Re: a macro

2010-10-13 Thread Meikel Brandmeyer
Hi, On 13 Okt., 08:56, Laurent PETIT laurent.pe...@gmail.com wrote: So in short: calling eval from the macro, on its argument. Beware the leopard! user= (defn f [constant] `(+ x# (* ~constant y#))) #'user/f user= (defn variables* [form] (if (seq? form)

Re: a macro

2010-10-13 Thread Meikel Brandmeyer
Hi, On 13 Okt., 11:19, Sunil S Nandihalli sunil.nandiha...@gmail.com wrote: (defmacro sexp2fn [sexp]   (let [sym (eval sexp)         vars (eval (math (Variables sexp)))]     (println [sym vars])     `(fn ~vars         ~sym))) Try the following: (defn evaled-variables [form] (eval

Re: Creating a new library

2010-10-13 Thread Meikel Brandmeyer
Hi, On 13 Okt., 07:59, Saul Hazledine shaz...@gmail.com wrote: As I understand it, its fine to put jars from other projects on Clojars. If you do this, it is recommended to use your own groupid or org.clojars.your-userid as the groupid. That way people know that the jar files aren't from the

Re: Idiomatic Way to Keep a Variable Private to a Namespace

2010-10-11 Thread Meikel Brandmeyer
Hi, On 11 Okt., 09:22, HiHeelHottie hiheelhot...@gmail.com wrote: I want to define and use a map that is private to a namespace and used by several functions in that namespace.  Is the idiomatic way simply to def it within the namespace?  Is there another way to hide it? (def ^{:private

Re: var vs. symbols

2010-10-11 Thread Meikel Brandmeyer
Hi, On 11 Okt., 11:44, Laurent PETIT laurent.pe...@gmail.com wrote: I guess one should use mapping instead of binding. The var is mapped to the symbol foo in the namespace *ns*. I'm saying that because functions for inspecting namespaces are (ns-map), etc. In a determined attempt to

Re: var vs. symbols

2010-10-11 Thread Meikel Brandmeyer
Hi, On 11 Okt., 12:26, Ulises ulises.cerv...@gmail.com wrote: so in theory one could have a symbol foo bound to a var bar? Eh. No. I don't think so. The Var has a name and the symbol has a name. And an unqualified symbol is resolved to the closest Var with the same name (conveniently derefing

Re: var vs. symbols

2010-10-11 Thread Meikel Brandmeyer
Hi, On 11 Okt., 12:45, Ulises ulises.cerv...@gmail.com wrote: user (def foo) #'user/foo user foo ;Var user/foo is unbound. ;  [Thrown class java.lang.IllegalStateException] user I guess this means there's no var named user/foo and hence the symbol cannot get its closest match in name?

Re: var vs. symbols

2010-10-11 Thread Meikel Brandmeyer
Hi, or a maybe clearer example, which shows the different states: ; No Var, yet. user= (var foo) java.lang.Exception: Unable to resolve var: foo in this context (NO_SOURCE_FILE:1) ; Var is now defined. Hence it can be resolved. But it has to root value, ie. it is unbound, yet. user= (def foo)

Re: var vs. symbols

2010-10-11 Thread Meikel Brandmeyer
Hi, On 11 Okt., 13:29, Ulises ulises.cerv...@gmail.com wrote: sorry for the confusion and the silly questions, Ehm. Nope. To cite the (german) sesame street: Wer? Wie? Was? Wieso? Weshalb? Warum? Wer nicht fragt bleibt dumm! Just keep asking. :) Sincerely Meikel -- You received this

Re: Question on binding macros

2010-10-11 Thread Meikel Brandmeyer
Hi, On 12 Okt., 07:05, Aravindh Johendran ajohend...@gmail.com wrote: (def *cont* identity) (defmacro =values [ retvals]   `(*cont* ~...@retvals)) why would the following two expressions throw errors??? (binding [*cont* (fn [m n] (=values (list m n)))] (*cont* 'a 'b)) So what happens

Re: VimClojure 2.2.0 released

2010-10-08 Thread Meikel Brandmeyer
Hi, On 6 Okt., 17:31, Wilson MacGyver wmacgy...@gmail.com wrote: If the STOMP support happens with nREPL as Rich was pushing for, you'd have the windows solution. There are plenty of STOMP client that works on windows. Do you have some pointers? Googling didn't turn up useful stuff.

Re: Is This Function Idiomatic Clojure?

2010-10-07 Thread Meikel Brandmeyer
Hi, On 7 Okt., 08:29, Stefan Rohlfing stefan.rohlf...@gmail.com wrote: (defn d-map [ kfps]   (let [keys     (map first kfps)          fns       (map second kfps)]     (loop [keys keys fns fns res []]       (if (seq keys)         (recur (rest keys) (rest fns)                    (into res

Re: VimClojure 2.2.0 released

2010-10-06 Thread Meikel Brandmeyer
Hi, On 6 Okt., 16:44, Jeff Rose ros...@gmail.com wrote: I've just installed the new version, but it isn't connecting to nailgun using either my ng-server script or using lein nailgun, which both work with the previous version.  Do we need to change port numbers or do something differently

Re: Changing keys in a map

2010-09-30 Thread Meikel Brandmeyer
Hi, On 30 Sep., 09:37, Sean Corfield seancorfi...@gmail.com wrote: That's very similar to one of my attempts and... I don't know... I just don't like it as much. Splitting the map into two streams and zipping them back together just doesn't feel as 'nice' and making one pass over the

Re: anonymous fn or partial?

2010-09-30 Thread Meikel Brandmeyer
Hi, On 30 Sep., 09:48, Ulises ulises.cerv...@gmail.com wrote: user= (map (fn [n] (+ 2 n)) [1 2 3 4 5]) (3 4 5 6 7) user= (map (partial + 2) [1 2 3 4 5]) (3 4 5 6 7) user= You can also consider the following: (map #(+ % 2) [1 2 3 4]), which is also very clear. I personally almost never use

Re: anonymous fn or partial?

2010-09-30 Thread Meikel Brandmeyer
Hi, On 30 Sep., 12:10, Ulises ulises.cerv...@gmail.com wrote: My question stemmed from the fact that sometimes I find myself mapping functions which are just partial applications of the same function and perhaps having a bunch of partials lying around would make my code read better. Well.

Re: Generating type hints dynamically

2010-09-29 Thread Meikel Brandmeyer
Hi, On 29 Sep., 11:28, Shantanu Kumar kumar.shant...@gmail.com wrote: Could you please post the working example you got? (defmacro hinted-fn [class-sym] (let [arg (gensym arg)] `(fn [~(with-meta arg {:tag class-sym})] (.get_val ~arg Hope that helps. Sincerely Meikel -- You

Re: How to write this in Clojure? Example from PAIP

2010-09-29 Thread Meikel Brandmeyer
Hi, a slight enhancement for 1.2: Clojure now supports keyword arguments directly. (defn find-all [item coll {:keys [test test-not] :or {test =}}] (if test-not (remove #(test-not item %) coll) (filter #(test item %) coll))) Sincerely Meikel -- You received this message because

Re: prn-str and lists

2010-09-29 Thread Meikel Brandmeyer
Hi, On 29 Sep., 15:33, K. kotot...@gmail.com wrote: For instance (pr-str '(+ 1 2)) returns (+ 1 2), which can not be read back since (eval (read-string (pr-str '(+ 1 2 returns 3! Here is your misunderstanding. Reading ends at read-string. When you look at the result you will find a list

Re: How to write this in Clojure? Example from PAIP

2010-09-29 Thread Meikel Brandmeyer
Hi, Am 29.09.2010 um 21:37 schrieb David Sletten: I was trying to remember how to do the new keywords, but I couldn't find an example. You have the default value for :test in there too. It's basically normal map destructuring in the varags position, ie. after the in the argument list.

Re: question regarding macro (ab)usage

2010-09-28 Thread Meikel Brandmeyer
Hi, I'm not sure my solution is 100% idiomatic, but has some advantages. General strategy: minimise macro usage. Macros are cool, but overrated. Put as much as possible into functions. This has several advantages like easier testing, less macro trap doors, better readability (no # all over the

Re: An Emacs command to close the various balanced expressions in Clojure

2010-09-28 Thread Meikel Brandmeyer
Hi, Am 28.09.2010 um 19:07 schrieb Michael Gardner: Does anybody know of an equivalent for Vim? Not yet, but it is on the radar for VC now. :) Sincerely Meikel -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: German Clojure Book Available

2010-09-24 Thread Meikel Brandmeyer
\o/ Gratulation! :D -- 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: concurrency example about java x clojure

2010-09-21 Thread Meikel Brandmeyer
Hi, On 21 Sep., 09:39, Laurent PETIT laurent.pe...@gmail.com wrote: So (= m1 m2) may not imply (= (zipmap (keys m1) (vals m1)) (zipmap (keys m2) (vals m2))) for any (m1, m2), hmmm, good to remember somewhere in my head ... :) I don't think that this is the case. What is meant, is (= (keys

Re: concurrency example about java x clojure

2010-09-20 Thread Meikel Brandmeyer
Hi, Am 20.09.2010 um 18:52 schrieb John Cromartie: (def flip-map #(apply zipmap ((juxt vals keys) %))) If I was going to write flip-map it might be a tad longer, but lazy and a bit clearer (IMO), with: (defn flip-map [m] (into {} (map (juxt second first) m))) Is there some specific

Re: concurrency example about java x clojure

2010-09-20 Thread Meikel Brandmeyer
Hello Laurent. Am 20.09.2010 um 22:38 schrieb Laurent PETIT: The fact that currently having vals and keys return seqs in the same order is not guaranteed by the documentation ? Touché. Hard to swallow the own pill. It is not mentioned in the documentation, but it is chouser's believe that

Re: Keyword namespaces

2010-09-19 Thread Meikel Brandmeyer
Hi, Am 19.09.2010 um 22:59 schrieb ataggart: Also note that the namespace portion of a keyword does not get resolved against the current aliases. E.g., user= (require '[clojure.java.io :as io]) nil user= (= :io/foo :clojure.java.io/foo) false It does with ::. user= (= ::io/foo

Re: thinking in clojure

2010-09-16 Thread Meikel Brandmeyer
Hi, maybe this does what you want. I'm not sure, since you add the new meeting to *all* meetings? And where does the :title come from when you add a new meeting? I assume you have a map of a meeting title and a meeting and want to add this to the corresponding entry in the data map. If the

Re: thinking in clojure

2010-09-16 Thread Meikel Brandmeyer
Hi, On 16 Sep., 15:36, Meikel Brandmeyer m...@kotka.de wrote:   (if (not (nil? (next collection) You can save the nil?. (if (not (next collection))) will also work. nil is logically false. And of course this should be (if (next collection)). The not belongs to the You can save part

Re: inline vs extended types

2010-09-16 Thread Meikel Brandmeyer
Hi, On 15 Sep., 12:55, SIdhant Godiwala sidhant.godiw...@gmail.com wrote: Is there any way to define the MultiMap protocol inline with the clashing methods? How could there be one? The compiler cannot decide which method to call. Although their name is the same the could have completely

Re: is it possible to check if a promise has been delivered to without blocking?

2010-09-14 Thread Meikel Brandmeyer
See also here: http://groups.google.com/group/clojure-dev/browse_thread/thread/bbf34a823f3081d6 -- 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

Re: var args

2010-09-14 Thread Meikel Brandmeyer
Hi, Am 14.09.2010 um 23:01 schrieb Alan: (defn make-tables [connection schema] (sql/with-connection connection (doseq [[name specs] schema] (try (apply sql/create-table name specs) (catch Exception e (prn e)) You actually don't

Re: drop-while and (pred item) returns nil?

2010-09-13 Thread Meikel Brandmeyer
Hi, On 13 Sep., 08:22, Alan a...@malloys.org wrote: By the way, I cloned the Clojure repo and have adjusted the docs for this function, but I can't figure out how to get Github to submit it for approval, or for a pull request or whatever it is. If someone wants to take this patch and check

Re: ns-unmap-all

2010-09-13 Thread Meikel Brandmeyer
Hi, On 13 Sep., 09:39, Laurent PETIT laurent.pe...@gmail.com wrote: And you should consider wrapping the call to map into (dorun) so that you're sure that once the function exits, all the ns-umap calls are done. (defn ns-unmap-all  Unmap all the symbols (except 'ns' and 'in-ns').  

Re: java interop problem

2010-09-13 Thread Meikel Brandmeyer
Hi, On 13 Sep., 15:07, Ranjit Chacko rjcha...@gmail.com wrote:     (for [x (range 3) y (range 3)] (aset xt x y 1)) Note that that this will not do what you think it does. for creates a lazy sequence which is thrown away immediately. So the aset calls are never done. for is a list

Re: Quirk of Map destructuring

2010-09-13 Thread Meikel Brandmeyer
Hi, Am 13.09.2010 um 20:54 schrieb Robert McIntyre: I'm wondering why the symbol route was selected when the merge way may be more convenient, or why there's something really bad about the merge way that I'm overlooking. I find the the symbol way more consist with the different usage

Re: Simple things should be simple

2010-09-10 Thread Meikel Brandmeyer
Hi, On 9 Sep., 20:46, Mike Meyer mwm-keyword-googlegroups. 620...@mired.org wrote: The first problem with that is that this stuff seems show up *everywhere* in Javaland. It's not just web apps, it's pretty much anything. You just lost me completely with your argumentation. I wrote a small

Re: Knowing in advance the complexity of count

2010-09-10 Thread Meikel Brandmeyer
Hi, On 9 Sep., 21:01, Randy Hudson randy_hud...@mac.com wrote: Inexplicably (counted? abcd) returns false. Why should it? String does not implement Counted. Sincerely Meikel -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group,

Re: matching with wild-cards in clojure multi-methods

2010-09-10 Thread Meikel Brandmeyer
Hi, On 9 Sep., 21:47, Daniel Werner daniel.d.wer...@googlemail.com wrote: Could this be a bug? No. Clojure does not enforce contracts in several places. Feed wrong things in and get undefined behaviour back. Only the contract is guaranteed. Everything else is an implementation detail and might

Re: Simple things should be simple

2010-09-10 Thread Meikel Brandmeyer
Hi, On 10 Sep., 10:27, Laurent PETIT laurent.pe...@gmail.com wrote: while I admit I haven't read *all* the answers to Meikel's question in their entirety, what I've understood is that :   * he's not talking about clojure the language, but its ecosystem (the JVM host and the J2EE stuff -de

Re: Simple things should be simple

2010-09-10 Thread Meikel Brandmeyer
Hi, Am 10.09.2010 um 21:17 schrieb Mike Meyer: 1) Write program in chosen unix-friendly interpreted language. You lost exactly here. unix-friendly. Since you keep putting your context over everything, I will also keep on putting mine over everything. Ruby, Python, Perl, Tcl, ... are all not

Re: lisp error system in clojure

2010-09-09 Thread Meikel Brandmeyer
Hi, On 9 Sep., 05:31, Seth wbu...@gmail.com wrote: Is there any code out there which reproduces common lisp's restart error handling capabilities? I think clojure.contrib.error-kit is the closest approach. Sincerely Meikel -- You received this message because you are subscribed to the

Re: Simple things should be simple

2010-09-09 Thread Meikel Brandmeyer
Hi, I don't know what the full definition of deploy is, but here is an example, that should serve as a starting point: http://m.3wa.com/?p=472 Sincerely Meikel -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Knowing in advance the complexity of count

2010-09-09 Thread Meikel Brandmeyer
Hi, On 9 Sep., 16:45, Nicolas Oury nicolas.o...@gmail.com wrote: is it a way to do so? You can check the Counted marker interface for clojure collections. But this won't cover Strings etc. More information here: http://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L489

Re: Macro problems with delay

2010-09-09 Thread Meikel Brandmeyer
Hi, On 10 Sep., 03:11, joshua-choi rbysam...@gmail.com wrote: I am running into a problem sometimes when I call a certain macro I defined. This problem macro (and an associated problem function) is: http://gist.github.com/572875 I run into this error (which is at a call to the macro, but

Re: A difficult Metaphor for Macros (especially for Java people)

2010-09-08 Thread Meikel Brandmeyer
Hi, On 8 Sep., 17:07, alux alu...@googlemail.com wrote: yes, I think thats the right way to teach this stuff. My problem arises earlier - I still have to motivate my collegues, to get them interested, and, maybe, teach them later ;-) Then I wouldn't stress macros at all. Just mention them

Re: matching with wild-cards in clojure multi-methods

2010-09-08 Thread Meikel Brandmeyer
Hi, On 8 Sep., 21:49, Daniel Werner daniel.d.wer...@googlemail.com wrote: Building your own hierarchy would make it safe to use unqualified keywords as well -- if I am not mistaken? (- (make-hierarchy) (derive :hello :anything) ...) derive works with non-qualified keywords, but the

Re: defrecord with default values

2010-09-07 Thread Meikel Brandmeyer
Hi, first of all we should start with the form we finally want to have: (defrecord Foo [a b c]) (defn make-Foo [ {:keys [a b c] :or {a :x c :z}}] (Foo. a b c)) ; Use as: (make-Foo :b :f) = (Foo. :x :f :z) The only annoying part is the boilerplate of defining make-Foo. What we would like

Re: matching with wild-cards in clojure multi-methods

2010-09-06 Thread Meikel Brandmeyer
Hi, On 6 Sep., 06:14, Sunil S Nandihalli sunil.nandiha...@gmail.com wrote: (defmethod foo [_          :hello    _         _   ] (str I'm method 1)) (defmethod foo [:world   _         :us       _  ] (str I'm method 2)) (defmethod foo [:city       _         :us      _  ] (str I'm method 3))

Re: JSON lib of choice?

2010-09-06 Thread Meikel Brandmeyer
Hi, On 7 Sep., 04:50, Wilson MacGyver wmacgy...@gmail.com wrote: For JSON, are you using clojure.contrib.json or clj-json? Why? I use clj-json. Mainly because it is brought in by another dependency, anyway. There were some comparisons, which claimed it to be quite fast. But you know me: I'm an

Re: Clojure macros

2010-09-05 Thread Meikel Brandmeyer
Hi, Am 05.09.2010 um 23:10 schrieb CuppoJava: (defmacro tm [ args] `(hash-map ~@(mapcat (fn [x] (list (keyword x) x)) args))) Or you return the map directely: (defmacro tm [ args] (apply hash-map (mapcat (juxt keyword identity) args))) Sincerely Meikel -- You received this message

Re: deftype makes no extender?

2010-09-03 Thread Meikel Brandmeyer
Hi, On 3 Sep., 12:49, alux alu...@googlemail.com wrote: shouldnt the type x be listed a extender of xx here? Or why not? No. It shows up if you actually use extend to the extend the protocol to the type. Sincerely Meikel -- You received this message because you are subscribed to the Google

Re: sequence rest and next

2010-09-03 Thread Meikel Brandmeyer
Hi, On 3 Sep., 11:16, Abraham Varghese abev...@gmail.com wrote: I cannot understand between  ( next aseq)   and ( rest aseq) ... next will realise the first item of the rest of aseq, while rest will not. You can always express next in terms of rest: (defn next [s] (seq (rest s)))

Re: reflection warnings with defprotocol/deftype with type hints

2010-09-01 Thread Meikel Brandmeyer
Hi, On 1 Sep., 07:33, Adrian Cuthbertson adrian.cuthbert...@gmail.com wrote: There are probably ways of creating types on protocols, but I haven't tried that yet. Clojure is a dynamically typed language. I don't think that putting types on protocols is very interesting. Type hints should be a

Re: Web Development - templating?

2010-09-01 Thread Meikel Brandmeyer
Hi, On 1 Sep., 09:09, Sean Corfield seancorfi...@gmail.com wrote: So far, all the web frameworks I've seen mentioned in Clojure seem to expect you to write some sort of HTML markup in Clojure itself... I have good experiences with enlive[1]. There you write your templates in normal HTML files

Re: Multimethods and multiple bodies method

2010-09-01 Thread Meikel Brandmeyer
Hi, On 2 Sep., 06:26, HB hubaghd...@gmail.com wrote: How a multimethod in Clojure differs from a method that have multiple bodies? The latter can only dispatch based on the number of arguments and cannot be extended later on. Compare: (defmulti foo-multi type) (defmethod foo-multi String

Re: Problem reloading source file with imports

2010-08-31 Thread Meikel Brandmeyer
Hi, On 31 Aug., 12:00, Chris Jenkins cdpjenk...@gmail.com wrote: The thing that still confuses me is that I can successfully load a source file that imports the whole of clojure.contrib.seq once (with warnings) but an attempt to reload that source file then fails - even if I edit the source

Re: Help speed up an inner loop?

2010-08-31 Thread Meikel Brandmeyer
Hi, On 31 Aug., 08:46, Robert McIntyre r...@mit.edu wrote: Without AOT compilation countnl-lite takes around 66 msecs With AOT compilation countnl-lite takes ~46 msecs Did you measure start-up time in your runs? AOT compilation should have no impact on the runtime speed. Sincerely Meikel --

Re: Problem reloading source file with imports

2010-08-30 Thread Meikel Brandmeyer
Hi, Am 30.08.2010 um 20:43 schrieb Chris Jenkins: How would using the :only keyword help here? Just to be clear, the problem here is that attempting to load my source file the second time fails (loading the first time having succeeded, albeit with a few warnings about replacing symbols

Re: Is it possible in theory to write/modify a Clojure compiler that doesn't

2010-08-29 Thread Meikel Brandmeyer
Hi, Am 28.08.2010 um 19:09 schrieb Michał Marczyk: I'm sure I'm missing lots of things, but I'd love to know which, so -- please let me know. :-) In fact, your two-pass scenario is probably the best you can get, since you can define arbitrary classes in arbitrary namespaces. (Whether this is

Re: Clojure 1.2 and the Computer Language Benchmarks Game

2010-08-26 Thread Meikel Brandmeyer
Hi, On 26 Aug., 07:58, Isaac Gouy igo...@yahoo.com wrote: Have you actually measured the time difference? Compare the mandelbrot numbers for Haskell, Java and Scala. The ranges are (0.07s 0.86s 13s), (0.19s 0.86s 12s), (0.22s 0.97s 15s). So Java and Scala are not slower than Haskell, but the

Re: Some clarifications about let form

2010-08-26 Thread Meikel Brandmeyer
Hi, On 26 Aug., 17:02, HB hubaghd...@gmail.com wrote: Hey, Basically, I understand what let form does but I'm not sure when to use it. Would you please enlighten me about it? (if possible some typical Java code and then covert it to Clojure let form). I really appreciate your time and help.

Re: Clojure Conj Questions

2010-08-25 Thread Meikel Brandmeyer
Hi, On 19 Aug., 17:19, Sean Devlin francoisdev...@gmail.com wrote: http://first.clojure-conj.org/ Will the talks be recorded? Put on blip.tv? For those on the other side of the Big Pond? Sincerely Meikel -- You received this message because you are subscribed to the Google Groups Clojure

Re: misunderstanding collection

2010-08-25 Thread Meikel Brandmeyer
Hi, On 25 Aug., 16:06, Glen Rubin rubing...@gmail.com wrote: (map #(map reduce + %) signal) The error you got here is probably related to the inner map. It should probably read (map #(map (partial reduce +) %) signal) or (map (partial map #(reduce + %)) signal) Sincerely Meikel -- You

Re: misunderstanding collection

2010-08-25 Thread Meikel Brandmeyer
Hi, and again the for solution if nested anonymous functions are too hard to read. (for [signals signals-list] (map #(reduce + %) signals)) Sincerely Meikel -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: misunderstanding collection

2010-08-25 Thread Meikel Brandmeyer
I vote for James'. On 25 Aug., 16:42, nickikt nick...@gmail.com wrote: To bad we don't have a voting system like on stackoverflow would be nice to see witch answer got the most points. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this

Re: why data structure

2010-08-23 Thread Meikel Brandmeyer
Hi, On 23 Aug., 14:03, Nicolas Oury nicolas.o...@gmail.com wrote: If the AST of LISP were more complicated, this kind of program would be more complicated. eg. see OCaml's camlp4. I found it complicated compared to Lisp style macros. Sincerely Meikel -- You received this message because

Re: parallel execution

2010-08-23 Thread Meikel Brandmeyer
Hi, maybe work is of interest to you: http://measuringmeasures.com/blog/2010/8/16/clojure-workers-and-large-scale-http-fetching.html Sincerely Meikel -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: trouble using nested map fn

2010-08-23 Thread Meikel Brandmeyer
Hi, On 24 Aug., 03:08, gary ng garyng2...@gmail.com wrote: (map #(for [s %2] (map * %1 s)) target signal) Though personally I still think the %2 %1 is a bit confusing.- Zitierten Text ausblenden - If you don't like it, don't use it.You can always give things meaningful names. (for

Re: Implementing a protocol with using a base implementation?

2010-08-21 Thread Meikel Brandmeyer
Hi, Am 21.08.2010 um 07:33 schrieb Toni Batchelli: (dotimes [_ 10] (time (dotimes [_ 1] (.m1 my-simple-P hello ; Elapsed time: 131.973 msecs I think you get caught by reflection here. As Nicholas said, you should call m1, not .m1. Sincerely Meikel -- You received this message

Re: Problem with Sandbar and Clojure 1.2

2010-08-20 Thread Meikel Brandmeyer
Hi, On 20 Aug., 11:13, Nebojsa Stricevic nebojsa.strice...@gmail.com wrote: I'm building a Clojure web app that I would like to migrate to 1.2. I've tried to empty source files and then delete one by one :use and :require, and I think error is connected with Sandbar lib (0.2.4). REPL prints

Re: Using dochars

2010-08-20 Thread Meikel Brandmeyer
Hi, On 20 Aug., 10:25, probertm probe...@gmail.com wrote: New here to Clojure-land and loving what I am seeing, though I am not getting some of the forms yet. Can someone help me with contrib.str-utils2/dochars?  I have a need to iterate over each character in a string and this seems to be

<    3   4   5   6   7   8   9   10   11   12   >