Re: A functional, efficient, convolution function. Is imperitive-style the answer?

2010-07-16 Thread Michael Gardner
I'm assuming the StackOverflow link you refer to is http://stackoverflow.com/questions/3259825/trouble-with-lazy-convolution-fn-in-clojure. I would think about the problem this way: to compute the value at index i in the output list, you multiply together each pair of values in the input lists

Re: A functional, efficient, convolution function. Is imperitive-style the answer?

2010-07-16 Thread Frederick Polgardy
Where's the link? :) -Fred -- Science answers questions; philosophy questions answers. On Jul 16, 2010, at 2:57 PM, Isaac Hodes wrote: > I posted this on StackOverflow yesterday, but to no avail: I don't > think many people looked at it, or least I didn't get much feedback. > > I am trying to

Question on namespace/packages of defrecord

2010-07-16 Thread Eric Thorsen
Congrats on the 1.2 beta guys! When I AOT a defrecord it does not javaize the clojure namespace into a proper java package name. (ns this-that) (defrecord Fred []) ;creates a class file this-that.Fred.class Is this by design? What is the thinking here? Thanks, Eric -- You received this messa

A functional, efficient, convolution function. Is imperitive-style the answer?

2010-07-16 Thread Isaac Hodes
I posted this on StackOverflow yesterday, but to no avail: I don't think many people looked at it, or least I didn't get much feedback. I am trying to create a lazy/functional/efficient/Clojuresque function to carry out convolution on two lists/vectors of (ideally BigDecimals but that may be ineff

Re: ClojureDocs.org

2010-07-16 Thread Avram
A few thoughts... It might be interesting to allow examples to be rated. Quality or usefulness of the provided example could then be inferred from the rating and highly rated examples could bubble to the top or have the associated rating prominently shown. ~A On Jul 16, 10:29 am, Lee Hinman wro

Re: Function called from macro loses record structure

2010-07-16 Thread Michał Marczyk
This is an instance of the broader issue whereby records currently evaluate to maps. There was a ticket open for that on Assembla. I'm not sure what's the current status on that, but whenever it gets fixed, macros will be able to use records in their expansions. Sincerely, Michał -- You received

Re: defmulti - defonce semantics?

2010-07-16 Thread Pedro Henriques dos Santos Teixeira
On Fri, Jul 16, 2010 at 6:20 PM, Kevin Downey wrote: > use of immigrate is unhygienic and a problem to be solved before you > go looking for others > didn't realize it before. I already started to remove it from code, and declaring all :uses explicitly. thanks for the reply. -- You received th

Re: ClojureDocs.org

2010-07-16 Thread Daniel Werner
Hi Zack, I just take a quick look at your site and must say that I'm impressed. This is going to become one of the utilities I constantly keep open in the background while developing. Especially since features like the Var cross-referencing tend to make easier to get the "big picture". One thing

Re: Implementing a protocol with using a base implementation?

2010-07-16 Thread Toni Batchelli
Hi Nicolas, I get the idea, but I don't see how this would help provide a default implementation for the functions inside a protocol. It looks to me like this would be the same as creating a record with only some of the functions implemented. Or am I reading it wrong? Thanks for your input. Toni

Re: defmulti - defonce semantics?

2010-07-16 Thread Kevin Downey
use of immigrate is unhygienic and a problem to be solved before you go looking for others On Thu, Jul 15, 2010 at 11:07 AM, Pedro Teixeira wrote: > On Jul 14, 4:09 pm, Michał Marczyk wrote: >> If you're ok with discarding all your methods for the given multi, you can do >> >> (ns-unmap the-ns-o

Re: Clojure noob: refactoring factorial code

2010-07-16 Thread Mike Meyer
"James Reeves" wrote: >On 15 July 2010 16:24, Brisance wrote: >> Thanks for the response. >> >> To get an idea of what I mean,  visit http://www.wolframalpha.com/''. >> Then enter something ridiculous (to me, at least) like 10! >> >> The answer is almost instantaneous. > >Wolfram Alpha is me

Re: Cljr and user.clj

2010-07-16 Thread liebke
Rick, I think the problem is that additional classpaths are added, dynamically, after the user.clj file is evaluated. It does get evaluated if it's in ./ or ./src, which are added at launch in the cljr scripts. I have added ~/.cljr to the classpath defined in the launch scripts, so you can place

Re: Implementing a protocol with using a base implementation?

2010-07-16 Thread Nicolas Oury
I read my mail and couldn't understand it. Here is what I meant: (defprotocol MessageReceived (message-received ...)) (defprotocol ExceptionCaught .) (extend Object MessageReceved {:message-received default-message-received-function}... ) (deftype channel-handler ExceptionCaught

Re: Implementing a protocol with using a base implementation?

2010-07-16 Thread Nicolas Oury
Not very clean suggestion. Split the protocol in one protocol per function. Instance every one on Object, with the default protocol. Instance each specific on the function for which it has a special instance. On Fri, Jul 16, 2010 at 7:45 PM, tbatchelli wrote: > Hi all, > > I am writing a netw

Re: Clojure 1.2 Beta 1

2010-07-16 Thread Stefan Kamphausen
Hi, FWIW... I've delayed this work for ages, but now that 1.2 is just around the corner I have no reason to wait any longer. So I went through all [1] examples from our forthcoming book [2] and tested them with the current beta. The result of this is encouraging: everything works fine. Until n

Re: extend-protocol bug?

2010-07-16 Thread Alex Ott
May be at least this should be documented? I could understand, that some developers will be mixed up by behavior... On Friday, July 16, 2010, Stuart Halloway wrote: > This behavior is by design. > > (1) The absence of warning is consistent with proxy, reify, etc. You specify > as much as you wan

Re: Clojure 1.2 Beta 1

2010-07-16 Thread Jeffrey Schwab
On 7/16/10 2:42 PM, Cyrus Harmon wrote: Going to http:// clojure.org, searching for git and following the "Clojure goes git" link would lead one to http://groups.google.com/group/clojure/msg/ca4fb58428052554 which suggests that the rickhickey page is the right one. Where's the announcement abo

Re: Clojure 1.2 Beta 1

2010-07-16 Thread Stefan Kamphausen
Hi Stu, On 16 Jul., 19:54, Stuart Halloway wrote: > Hi Stefan, > > The behavior you are seeing is not a problem, and understanding why may be > helpful to using agents correctly. > > The thread that sends to an agent has no guarantee that it will (or will not) > see the result of its action a t

Implementing a protocol with using a base implementation?

2010-07-16 Thread tbatchelli
Hi all, I am writing a network protocol handler based on events (to wrap netty, if you're curious). I created a protocol that defines the functions needed to handle every possible (channel) event: (defprotocol channel-handler-strategy (message-received [this ctx evt]) (exception-caught [this

Re: Clojure 1.2 Beta 1

2010-07-16 Thread Cyrus Harmon
Going to http:// clojure.org, searching for git and following the "Clojure goes git" link would lead one to http://groups.google.com/group/clojure/msg/ca4fb58428052554 which suggests that the rickhickey page is the right one. Where's the announcement about git://github.com/clojure ? thanks, c

Re: Clojure 1.2 Beta 1

2010-07-16 Thread Stuart Halloway
Hi Stefan, The behavior you are seeing is not a problem, and understanding why may be helpful to using agents correctly. The thread that sends to an agent has no guarantee that it will (or will not) see the result of its action a tiny bit later, when the repl prints the stringified version of

Re: extend-protocol bug?

2010-07-16 Thread Stuart Halloway
This behavior is by design. (1) The absence of warning is consistent with proxy, reify, etc. You specify as much as you want, and there is no warning. This is very unlikely to change! (2) The dynamism implied by a hypothetical "append-partial-protocol" seems high on complexity and low on value

Re: ClojureDocs.org

2010-07-16 Thread Lee Hinman
Had another suggestion, As an example contributor, It would be really nice to see a list of functions that have no examples yet at a glance, so if I wanted to work on adding examples I could go through a list and work on functions that have no examples. I believe the clojure-examples appspot wiki

Clojure Job Opening in Ghent Belgium

2010-07-16 Thread hochstenbach
Hi all, I hope you don't mind me sharing Clojure job opportunity in Ghent Belgium. Our university library is searching for a developer willing to participate in an open source project to create an image database to present high resolutions scans of old manuscripts on the Internet. Here is the (Du

Re: ClojureDocs.org

2010-07-16 Thread Islon Scherer
Hi. Does clojuredocs expose any external API (json, xml... rest, webservices, etc) so I can access the docs from my code? Islon On Jul 13, 11:40 pm, j-g-faustus wrote: > On Jul 13, 8:37 pm, Paul Moore wrote: > > > Can I suggest omitting the "Table of contents" sidebar when printing? > > I've n

Re: extend-protocol bug?

2010-07-16 Thread Alex Ott
It's better to illustrate this with simple example: If I'll define following protocol: (defprotocol test1 (a1 [this] "a1") (a2 [this] "a2") (a3 [this] "a3") ) and then I can extend it with following constuction: (extend-protocol test1 String (a1 [this] (str "Hello1 " th

Re: Clojure noob: refactoring factorial code

2010-07-16 Thread Brendan Ribera
> > In conventional imperative/procedural languages, as you pointed out, > the algorithm used to calculate the factorial would be dependent on > available compute resources. In order to select the appropriate > algorithm one might select an arbitrary value (let's say 1000) and > decide to use one a

Re: Clojure 1.2 Beta 1

2010-07-16 Thread Stefan Kamphausen
Hi, I think I found a minor problem. It appears with the error handling of agents and actually is just a minor glitch in the output. Consider the following session, copied from a terminal: shell> java -cp clojure.jar clojure.main Clojure 1.2.0-beta1 user=> (def agt1 (agent "One")) #'user/agt1 u

Re: Clojure noob: refactoring factorial code

2010-07-16 Thread James Reeves
On 15 July 2010 16:24, Brisance wrote: > Thanks for the response. > > To get an idea of what I mean,  visit http://www.wolframalpha.com/''. > Then enter something ridiculous (to me, at least) like 10! > > The answer is almost instantaneous. Wolfram Alpha is merely approximating the result to

Re: Saving runtime clojure image

2010-07-16 Thread Laurent PETIT
Not provided by the underlying platform, the JVM. But one could consider recording your interactions with the REPL, and having an option to replay them at startup. With time, your REPL will start slower and slower and slower though. And even with an "history replay" feature, there will be tim

extend-protocol bug?

2010-07-16 Thread [AvataR]
I have record J:Bot, protocol P:Bot and two files, one extend-protocol statement by file. After loading first file i get: http://pastebin.com/Kq5GZ6RJ After loading second file i get: http://pastebin.com/Pu3kHZ1h Looks like next extend-protocol rewrite :impls seg. How/where post the bug? Or myabe

Saving runtime clojure image

2010-07-16 Thread Jozef Wagner
Hi, I've read in some old discussion ( http://groups.google.com/group/clojure/browse_thread/thread/5259280f2fd8c8a5/ ) that "Clojure cannot save a runtime image the way SBCL and other Lisps can." Is this still true or is it possible to save-lisp-and-die? If not, are there plans for such functiona

Re: Clojure noob: refactoring factorial code

2010-07-16 Thread Brisance
Hello Mike, Thanks for taking time to respond. I replied to another post but somehow it didn't show up. Perhaps it is awaiting moderation. Anyway, perhaps I should explain the situation more clearly. In conventional imperative/procedural languages, as you pointed out, the algorithm used to calcu

Command line debugging

2010-07-16 Thread Steve Molitor
Sorry if this has already been answered, but what's the best recipe for getting a command line debugger going with clojure 1.2 snapshots? I've read about debug-repl and other solutions but I'm not sure what works with 1.2. Thanks, Steve -- You received this message because you are subscribed t

Re: Clojure noob: refactoring factorial code

2010-07-16 Thread Brisance
Thanks for the response. To get an idea of what I mean, visit http://www.wolframalpha.com/''. Then enter something ridiculous (to me, at least) like 10! The answer is almost instantaneous. The question is: how would someone write idiomatic Clojure in such a way that it gives exact results f

Re: defmulti - defonce semantics?

2010-07-16 Thread Pedro Teixeira
On Jul 14, 4:09 pm, Michał Marczyk wrote: > If you're ok with discarding all your methods for the given multi, you can do > > (ns-unmap the-ns-of-defmultiname-of-the-multimethod) > > (I'm not sure if you should also unmap it in namespaces which refer to > that Var just now...) > > Then the entire

Re: Building mixed clojure and java code

2010-07-16 Thread Martin DeMello
Thanks, that got me up and running! I had to upgrade to head lein and wipe my maven repository first (as per http://groups.google.com/group/leiningen/browse_thread/thread/8f2ef7edb9fda3be?pli=1) and then pull the latest lein-javac, and after that it all worked smoothly. martin On Thu, Jul 15, 201

Cljr and user.clj

2010-07-16 Thread Rick Moynihan
I've just installed Cljr and am really impressed with it... However I have run into a small problem. I'd like to have my cljr execute my user.clj at startup, however it seems that cljr is ignoring classpaths added with the command cljr add-classpath ~/.clojure/ looking in ~/.cljr/project.clj I

Re: terracotta?

2010-07-16 Thread peter veentjer
To repeat myself again: The big problem with a MVCC based STM, is that there is a central clock that needs to be touched by independent transactions. That was one of the reasons for me to get not started on a distributed STM. So you will get something up and running on your laptop, but it will no

Re: ANN lein-daemon, lein-test-out

2010-07-16 Thread Alex Ott
Re Just fyi - when running clojure program under daemon on windows, you can get NPE, if you'll try to load file or resources. See http://www.assembla.com/spaces/clojure/tickets/379 for details Allen Rohner at "Thu, 15 Jul 2010 15:00:03 -0700 (PDT)" wrote: AR> I'd like to announce two new lein