Re: API for ClojureDocs.org

2010-09-06 Thread Zmitro Lapcjonak
On Sep 3, 2:11 am, Lee Hinman matthew.hin...@gmail.com wrote: working on the API for ClojureDocs.org in the coming future. I was hoping to get some feedback regarding what people wanted to see for an API for ClojureDocs: Any other feedback is highly appreciated :) when i added examples, i

Re: Documentation tools

2010-09-06 Thread Tim Daly
The literate programming discussion centered around the question what should be the state of the art in clojure documentation, not what is the state of the art in clojure documentation. If you're looking for API documentation then literate programming is the wrong tool. An API would document

Re: Documentation tools

2010-09-06 Thread Tim Daly
See http://en.wikipedia.org/wiki/Axiom_computer_algebra_system which is in process to become a fully literate computer algebra system. 20 volumes so far and a lot of documentation still to come. Once a system gets larger than one person's head (e.g. Rich's) then the question of why becomes

Re: API for ClojureDocs.org

2010-09-06 Thread Moritz Ulrich
One of the most important things for me is the access to code examples. Every example could be split in multiple parts. (comment, function and result part for example) Editors (Emacs + Slime) could display these in a nicely and decent manner while developing. Also, bulk-get could be helpful (to

Re: Documentation tools

2010-09-06 Thread Joop Kiefte
Is it feasable to create a literate haskell like alternate format for Clojure? 2010/9/6 Tim Daly d...@axiom-developer.org: See http://en.wikipedia.org/wiki/Axiom_computer_algebra_system which is in process to become a fully literate computer algebra system. 20 volumes so far and a lot of

external clojure lib

2010-09-06 Thread Abraham Varghese
Dear all , How to get external clojure libs workng in my system? like clojure.contrib , etc? Thanks in advance AV -- 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

external clojure lib

2010-09-06 Thread Abraham Varghese
Dear all , How to get external clojure libs workng in my system? like clojure.contrib , etc? Thanks in advance AV -- 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

Re: Announcement: secrets of monad fu, revealed

2010-09-06 Thread Eivind Magnus Hvidevold
I liked it. Easy to grok. I had some vague idea that monads are like overloading the pipe operator in a function pipeline, but now it's much clearer. I know some abstract algebra, though not category theory. I skipped the proofs, didn't care about those. -- Eivind Magnus Hvidevold Cell: +47

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

2010-09-06 Thread Sunil S Nandihalli
It looks like the matchure http://github.com/dcolthorp/matchure.git does this kind of thing .. :) .. I guess somebody has already written a library to do what I wanted ... On Mon, Sep 6, 2010 at 9:44 AM, Sunil S Nandihalli sunil.nandiha...@gmail.com wrote: Hi Mark, Let us say my dispatch

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

2010-09-06 Thread Sunil S Nandihalli
Hi Mark, Let us say my dispatch function always returns a vector of 4 keywords. now I want to write my methods in the following way.. (defmethod foo [_ :hello_ _ ] (str I'm method 1)) (defmethod foo [:world _ :us _ ] (str I'm method 2)) (defmethod foo

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

2010-09-06 Thread Sunil S Nandihalli
Thanks Mark for you reply. Well I realized we can do that .. but I feel it would be more expressive and readable if I could do the wild-card like pattern matching when I am defining the method. Sunil. On Mon, Sep 6, 2010 at 9:25 AM, Mark Rathwell mark.rathw...@gmail.comwrote: You can add

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: Announcement: secrets of monad fu, revealed

2010-09-06 Thread David Cabana
Easy to grok is music to my ears. I imagine most people who read my post would skip the proofs, and that is just fine. The proofs are gruntwork. I wouldn't want the tedious details to obscure the idea of the monad, which is quite elegant once you get your head around it. On Mon, Sep 6, 2010 at

Re: external clojure lib

2010-09-06 Thread Sunil S Nandihalli
Hi Abraham, Make sure that the jar file of the external library you are referring to is in path. If you are developing clojure code .. I would strongly advice you to use leiningen which takes care of a lot of these things for you. Btw. what is the development environment you are using? .. Try to

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

2010-09-06 Thread Sunil S Nandihalli
thanks Meikel for the suggestion .. I never thought of that .. (or actually didn't know about it).. I think that helps.. Sunil. On Mon, Sep 6, 2010 at 8:19 PM, Meikel Brandmeyer m...@kotka.de wrote: Hi, On 6 Sep., 16:43, Meikel Brandmeyer m...@kotka.de wrote: (defmulti foo

Re: external clojure lib

2010-09-06 Thread Sunil S Nandihalli
when I say is in path ... I meant that you CLASSPATH variable has this jar file in it.. On Mon, Sep 6, 2010 at 8:30 PM, Sunil S Nandihalli sunil.nandiha...@gmail.com wrote: Hi Abraham, Make sure that the jar file of the external library you are referring to is in path. If you are

Re: external clojure lib

2010-09-06 Thread rodgertq
Leinengen makes the process pretty painless, see: http://github.com/technomancy/leiningen On Sep 6, 5:20 am, Abraham Varghese vincent@gmail.com wrote: Dear all , How to get external clojure libs workng in my system? like clojure.contrib , etc? Thanks in advance AV -- You received

Mapping a function to a map

2010-09-06 Thread Nicolas Oury
Dear all, is there a function to map a function to all values in a map, keeping the same keys? Reducing from the seqed map seems a bit slower that what could be done directly... Best, Nicolas. -- You received this message because you are subscribed to the Google Groups Clojure group. To post

Re: Mapping a function to a map

2010-09-06 Thread Sunil S Nandihalli
Nicolas I am not sure of the performance characteristics.. but you may want to look at *(clojure.walk/walk #(do (println inner : %) %) #(do (println outer : %) %) {:a 1 :b 2}) * Best regards, Sunil. On Mon, Sep 6, 2010 at 9:10 PM, Nicolas Oury nicolas.o...@gmail.com wrote: Dear all, is

Re: Mapping a function to a map

2010-09-06 Thread Sunil S Nandihalli
(clojure.walk/walk (fn [[key val]] [key (* 2 val)]) identity {:a 1 :b 2}) On Mon, Sep 6, 2010 at 9:26 PM, Sunil S Nandihalli sunil.nandiha...@gmail.com wrote: Nicolas I am not sure of the performance characteristics.. but you may want to look at *(clojure.walk/walk #(do (println inner :

Re: Mapping a function to a map

2010-09-06 Thread Robert McIntyre
walk is good but it's not lazy. If you want to preserve laziness you can do: (defn map-vals transform a map by mapping it's keys to different values. [f m] (into {} (map (fn [[key val]] [key (f val)]) m))) This is also nice because you can then write functions whose arguments are [val]

Re: Mapping a function to a map

2010-09-06 Thread Michał Marczyk
On 6 September 2010 18:29, Robert McIntyre r...@mit.edu wrote: walk is good but it's not lazy. If you want to preserve laziness you can do: This won't be lazy, because (into {} ...) is a strict operation. I'd suggest something like (defn mmap [f m] (zipmap (keys m) (map f (vals m f is

Re: Mapping a function to a map

2010-09-06 Thread Robert McIntyre
I thought that since into uses reduce, it would be lazy, but I was wrong. reduce just plows through everything with a non-lazy recursion. Why is reduce not lazy? --Robert McIntyre On Mon, Sep 6, 2010 at 12:37 PM, Michał Marczyk michal.marc...@gmail.com wrote: On 6 September 2010 18:29, Robert

Re: Mapping a function to a map

2010-09-06 Thread gary ng
On Mon, Sep 6, 2010 at 9:49 AM, Robert McIntyre r...@mit.edu wrote: I thought that since into uses reduce, it would be lazy, but I was wrong. reduce just plows through everything with a non-lazy recursion. Why is reduce not lazy? reduce in clojure == foldl in Haskell and as far as I know,

Re: Mapping a function to a map

2010-09-06 Thread Justin Kramer
reduce returns a single value; there's no collection to make lazy. There is reductions, which returns the intermediate results of reduce as a lazy sequence. Justin On Sep 6, 12:49 pm, Robert McIntyre r...@mit.edu wrote: I thought that since into uses reduce, it would be lazy, but I was wrong.

Re: Mapping a function to a map

2010-09-06 Thread gary ng
On Mon, Sep 6, 2010 at 10:09 AM, Justin Kramer jkkra...@gmail.com wrote: reduce returns a single value; there's no collection to make lazy. There is reductions, which returns the intermediate results of reduce as a lazy sequence. if f = cons in 'reduce f a seq', there is a collection. Though

Re: Mapping a function to a map

2010-09-06 Thread Michał Marczyk
On 6 September 2010 18:49, Robert McIntyre r...@mit.edu wrote: I thought that since into uses reduce, it would be lazy, but I was wrong. reduce just plows through everything with a non-lazy recursion. Well, there's another reason in that the concept of a lazy map is problematic. In Clojure, at

Re: Mapping a function to a map

2010-09-06 Thread Stuart Sierra
On Sep 6, 11:40 am, Nicolas Oury nicolas.o...@gmail.com wrote: is there a function to map a function to all values in a map, keeping the same keys? I like reduce because you can modify both the key and the value, and even choose to omit or add certain keys: (reduce (fn [[k v] m] (assoc m k

Re: Mapping a function to a map

2010-09-06 Thread Robert McIntyre
Why is it that clojure maps aren't lazy though? Wouldn't that be just as useful an abstraction as lazy sequences? Aren't map really just lists of pairs in the end anyway? --Robert McIntyre On Mon, Sep 6, 2010 at 1:19 PM, Michał Marczyk michal.marc...@gmail.com wrote: On 6 September 2010 18:49,

Re: Mapping a function to a map

2010-09-06 Thread gary ng
On Mon, Sep 6, 2010 at 10:47 AM, Robert McIntyre r...@mit.edu wrote: Why is it that clojure maps aren't lazy though? Wouldn't that be just as useful an abstraction as lazy sequences? Aren't map really just lists of pairs in the end anyway? how can laziness benefit map usage pattern ? efficient

Re: Mapping a function to a map

2010-09-06 Thread Nicolas Oury
Different reactions: 1. The reduce solution is O(n .log n) + time of mapping elements, as inserting in a map is O(log n). A tree with n leafs and arity at least binary is of size at most 2n. So a map on a map could be done in O(n) + time of mapping elements, but it would need a bit of support

Binding and temporary global state

2010-09-06 Thread Cameron Pulsford
Hello all, here is an extremely reduced version of a problem I'm not sure how to work around. (It's going to be a toy assembly language if anyone's wondering) When I call assemble in the following code I get the error: java.lang.IllegalStateException: Var reader/*macros* is unbound. I'd like

Re: Binding and temporary global state

2010-09-06 Thread Jarkko Oranen
Cameron Pulsford wrote: Is there a way to do this? Besides cleaning up function signatures is this a premature optimization to begin with? (declare *macros*) (defn macro-expand [tokens] (map #(get *macros* % %) tokens)) (defn compile-op [op] (macro-expand op)) (defn assemble

Re: Binding and temporary global state

2010-09-06 Thread lprefontaine
Hi Cameron, Use def or defvar (if you use contrib.def) to create an instance of *macros*. Declare is used for forward references (when you reference something before declaring it) so the compiler knows that your code is sane but it does not define anything by itself. Yes, it may look a bit

Re: Binding and temporary global state

2010-09-06 Thread Cameron Pulsford
Interesting results. By putting (println compiled-ops) it worked, but not by putting it in a doall. (same error) Changing my declares to defs did the trick did though and learning about bound-fn* was also a serious mind-expander for me right now too. Thanks to both of you! On Sep 6, 4:57 pm,

Re: Binding and temporary global state

2010-09-06 Thread lprefontaine
I am a bit puzzled, I did a quick test and rebinding using a declare should work (outside of your sample code). I have a reminiscence of a similar problem I encountered before version 1.0 and used a def to solve my problem at the time. But the small test I just made with 1.2 is working. There's

Re: Documentation tools

2010-09-06 Thread Mark Engelberg
On Mon, Sep 6, 2010 at 2:51 AM, Tim Daly d...@axiom-developer.org wrote: The literate programming discussion centered around the question what should be the state of the art in clojure documentation, not what is the state of the art in clojure documentation. I brought up literate programming

clojure Image/video processing?

2010-09-06 Thread Robert McIntyre
I was wondering if anyone has used clojure for image/video processing and how that has worked out. I've spent a long time on this since clojure 1.0 and have gone through many different (java) libraries trying to find something that's truly awesome. I've tried: Images: ImageJ (lots of plugins

Re: clojure Image/video processing?

2010-09-06 Thread Wilson MacGyver
If by processing image you mean like resizing, etc. I use jmagick http://www.jmagick.org/index.html On Sep 6, 2010, at 5:57 PM, Robert McIntyre r...@mit.edu wrote: I was wondering if anyone has used clojure for image/video processing and how that has worked out. -- You received this message

agents, await and Swing thread

2010-09-06 Thread K.
Hello, I've got a concurrency problem and it's not really clear to me how to solve it. I have a Swing GUI doing a search in background with agents and the results are displayed one after the other, also in background. Here is, largely simplified, how I do it: (defvar- *end-search* (atom false))

Re: Lisp/Scheme Style Guide

2010-09-06 Thread sitkack
It would be _nice_ to have a default that was the baseline format. The Canon of Clojure Conventional Conformity (). If an org or project wanted to have a different format, they could supply it as a plugin to the clojure-fmt tool. (set-format local-conventions) When the format gets

Re: clojure Image/video processing?

2010-09-06 Thread Sean Grove
On Sep 6, 2010, at 2:57 PM, Robert McIntyre wrote: I was wondering if anyone has used clojure for image/video processing and how that has worked out. Images: For image processing, I've just been using the java2d api, a la http://www.javaworld.com/javaworld/jw-09-1998/jw-09-media.html?page=1

defrecord with default values

2010-09-06 Thread anthonyghr
Disclamer: I'm a Clojure noob, so bad code follows... I have been putzing around with implementing a Simple Temporal Network (a graph structure for scheduling problems) in Clojure. In the process, I wanted to generate records that had default values. I ran into this blog post by cemerick

Re: clojure Image/video processing?

2010-09-06 Thread Marc Downie
On Mon, Sep 6, 2010 at 5:45 PM, Sean Grove otokora...@gmail.com wrote: On Sep 6, 2010, at 2:57 PM, Robert McIntyre wrote: I was wondering if anyone has used clojure for image/video processing and how that has worked out. We've been rolling our own, either using Apple's Core Image framework

JSON lib of choice?

2010-09-06 Thread Wilson MacGyver
I figure enough time has passed that I want to bring this up again. For JSON, are you using clojure.contrib.json or clj-json? Why? Thanks -- 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

Re: JSON lib of choice?

2010-09-06 Thread Phil Hagelberg
We use org.danlarkin.json, and it's never let us down. -Phil On Sep 6, 2010 7:50 PM, Wilson MacGyver wmacgy...@gmail.com wrote: I figure enough time has passed that I want to bring this up again. For JSON, are you using clojure.contrib.json or clj-json? Why? Thanks -- You received this

Re: Documentation tools

2010-09-06 Thread zkim
Mark- ATM, autodoc is your best bet for automatically generating documentation from your source files. The ClojureDocs lib analyzer codebase is pretty much a ns / var metadata extraction tool, similar to autodoc. Unfortunately out of the five requirements you listed [1] we only (automatically)

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 Image/video processing?

2010-09-06 Thread Robert McIntyre
Thank you everyone for your time and great advice. Thank you Wilson MacGyver, for recommending jmagick. I actually already use it's brother im4java (http://im4java.sourceforge.net/) for great justice already and forgot to mention it. It does alright for basic image manipulation. The reason

Re: Lisp/Scheme Style Guide

2010-09-06 Thread Laurent PETIT
An interesting candidate for this is the current clojure.contrib.pprint tool. It should be adapted to not only grok clojure forms, but also strings, of course (and this may not be that easy), so that nothing in the source code is lost during the parsing ... 2010/9/6 sitk...@gmail.com: It would