Re: Efficiency of Dijkstra's algorithm

2012-11-21 Thread Dennis Haupt
i used a java priorityqueue for this. it's mutable (but local), and since
you're not going to access he queue with more than in thread you can hide
this fact and still pretend to be functional.
i did it. in reality, cheats are always allowed.


2012/11/21 Sergey Didenko 

> I have used mutable code working on Java structures when I was
> implementing the kind of Dijkstra algorithm. As long as it is
> encapsulated in a function it seems quite a good approach to me.
>
> And also quite readable given the amount of mutable Dijkstra examples
> in the Internet.
>
> --
> 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, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Problems getting Heroku to accept custom bin/build script

2012-11-21 Thread Michael Berg
Hi Phil,

the test apps name is: weberest(.herokuapp.com)

In this case there's no problem with AOT; I'm just relying on the Heroku 
output after a git push to show that it used the custom build script and 
learn what went wrong in the real app. If that would work, I'd try it there 
(where AOT and core.match is involved).

Thank you for your help.

Michael



On Tuesday, November 20, 2012 6:16:05 PM UTC+1, Phil Hagelberg wrote:
>
>
> > I'm trying now already for hours to get somehow Heroku to accept a 
> > simple bin/build script with "lein deps" inside.  
>
> If you give me the app name I can see what's going wrong. 
>
> thanks, 
> Phil 
>

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

ANN: Parse-EZ 0.3.0

2012-11-21 Thread Panduranga Adusumilli


Parse-EZ is a parser library for Clojure programmers. It allows easy mixing 
of declarative and imperative styles and does not require any special 
constructs, macros, monads, etc. to write custom parsers. All the parsing 
is implemented using regular Clojure functions.

README: https://github.com/protoflex/parse-ez/blob/master/README.md

Version 0.3.0 adds macro versions of the parse combinators for expressing 
combinator-nesting a bit more succinctly.

Release Notes: 
https://github.com/protoflex/parse-ez/blob/master/ReleaseNotes.md

---

Panduranga Adusumilli


-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: More ClojureScript questions....

2012-11-21 Thread Thomas
That did the trick David, thanks for pointing out (with hindsight) the 
obvious to me.

Thomas

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Request for a hint

2012-11-21 Thread Milen Ivanov
Dear Mr. Griefer,

Thank you! 

I get it now after reading few more pages. Even the font is different than 
that of real code and, moreover, it is recommended that the reader gets the 
code from book's webpage. So, I keep on reading... First of all, I paid for 
the book, LOL, and, second, I need to learn some Clojure for better or 
worse.  

Best Regards,
Milen

On Sunday, November 18, 2012 12:46:25 AM UTC+2, Charlie Griefer wrote:
>
> On Sat, Nov 17, 2012 at 5:32 PM, Milen Ivanov 
> > 
> wrote: 
> > Dear Mr. Chose, 
> > 
> > Thank you for your help! 
> > 
> > So, the "bug" is then in the book. Fine. 
>
> There's no "bug" in the book. 
>
> You copied sample code that's meant to show the syntax of using conj 
> directly into the repo, using undeclared values. 
>
> (conj coll item) is not meant to run on its own. It's demonstrating 
> that the function conj takes a collection and an item, and returns a 
> new collection with the item added on. 
>
> So as BG pointed out, you can do: 
>
> (conj [1 2 3] 4), in which [1 2 3] is a collection (vector) and 4 is 
> the item to be conj'd, which returns a new vector [1 2 3 4]. 
> (conj '(1 2 3) 4), in which '(1 2 3) is a collection (list) and 4 is 
> the item to be conj'd, which returns a new list (4 1 2 3) 
>
> If you want to do (conj coll item) you need to define coll and item, 
> which BG did as: 
>
> (def coll [1 2 3 4 5]) 
> (def item 6) 
>
> Now that "coll" and "item" exist, you can do (conj coll item), which 
> is the same as doing (conj [1 2 3 4 5] 6). 
>
> But you cannot simply do (conj coll item), and this is not a "bug" in 
> the book, but rather a description of how conj works. 
>
> -- 
> Charlie Griefer 
> http://charlie.griefer.com/ 
>
> I have failed as much as I have succeeded. But I love my life. I love 
> my wife. And I wish you my kind of success. 
>

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: [ANN] clj-xpath 1.3.3

2012-11-21 Thread Alex Osborne

On 21/11/12 3:10 AM, John Gabriele wrote:
Oh, thanks. My understanding was that current best practice was to 
choose a good name, and then if you're the original author, your 
project's group-id = artifact-id (and thus you get the 
https://clojars.org/my-proj url).
The thought behind Clojars' conventions is that unrelated projects 
calling themselves clj-xpath distinguished by some kind of namespace is 
never desirable as it makes it very difficult for *humans* to refer to 
them ("Oh! You mean *that* clj-xpath..."). Public-facing project names 
really should be globally unique and hence don't need to be namespaced.


Namespacing is very useful for private projects, subcomponents, 
throwaway forks etc. The reversed domain name scheme may not be great 
but it's the de facto way to do it if you do need a private namespace. 
Forks are ugly but sometimes necessary, hence give them ugly names. Save 
short, memorable and friendly names for public, canonical projects to 
encourage use.


Note this is just what we recommend for Clojars and it's deliberately 
not enforced. If your project targets a different ecosystem you should 
follow their conventions instead. If you're targeting the wider JVM 
ecosystem, you should put your project in Maven Central not in Clojars.


--
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Primitive function boxes and unboxes result value

2012-11-21 Thread Christophe Grand
I created an issue and attached a patch
http://dev.clojure.org/jira/browse/CLJ-

Now the 5 last lines of bytecode are:
   52:  goto9
   55:  goto61
   58:  pop
   59:  dload   5
   61:  dreturn

Christophe


On Tue, Nov 20, 2012 at 10:27 PM, Christophe Grand wrote:

> I think CLJ-701 is about loop in non-terminal position.
>
>
> On Tue, Nov 20, 2012 at 6:30 PM, Andy Fingerhut 
> wrote:
>
>> Any relationship to CLJ-701, other than similar symptoms?
>>
>> http://dev.clojure.org/jira/browse/CLJ-701
>>
>> Andy
>>
>> On Nov 20, 2012, at 9:15 AM, Christophe Grand wrote:
>>
>> Hi,
>>
>> It looks like, because of the recur, the compiler fails to notice that if
>> returns a primitive.
>> As far as I understand in Compiler.java, RecurExpr does not implement
>> MaybePrimitiveExpr and thus causes on canEmitPrimitive the surrounding
>> IfExpr to return false.
>>
>> Someone to confirm this analysis?
>>
>>
>> On Tue, Nov 20, 2012 at 4:34 PM, Gunnar Völkel <
>> gunnar.voel...@googlemail.com> wrote:
>>
>>> I have written a primitive function for exponentiation with integers as
>>> power using the multiply-and-square algorithm.
>>> For performance reasons I used primitive type hints for the arguments
>>> and the return value.
>>> Profiling the whole application I noticed that there are a lot of
>>> java.lang.Double/valueOf calls.
>>> Looking at the bytecode I see that in Clojure 1.3 as well as in Clojure
>>> 1.4 the result value gets boxed and unboxed like
>>> Double.valueOf(result).doubleValue().
>>>
>>> Am I doing something wrong? Is there a serious bug related to the
>>> support of primitive functions?
>>>
>>> The source code:
>>>
>>> (defn first-bit?
>>>   {:inline (fn [n] `(== 1 (clojure.lang.Numbers/and ~n, 1)) )}
>>>   [^long n]
>>>   (== 1 (clojure.lang.Numbers/and n, 1)))
>>>
>>> (defn exp-int
>>>   ^double [^double x, ^long c]
>>>   (loop [result 1.0, factor x, c c]
>>> (if (> c 0)
>>> (recur
>>>  (if (first-bit? c)
>>>(* result factor)
>>>result),
>>>  (* factor factor),
>>>  (bit-shift-right c 1))
>>>   result)))
>>>
>>> Last lines of the Java bytecode of `exp-int`:
>>> 59 dload 5;   /* result */
>>> 61 invokestatic 40;   /* java.lang.Double
>>> java.lang.Double.valueOf(double c) */
>>> 64 checkcast 85;  /* java.lang.Number */
>>> 67 invokevirtual 89;  /* double doubleValue() */
>>> 70 dreturn;
>>>
>>
>>  --
>> 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, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>>
>
>
>
> --
> Professional: http://cgrand.net/ (fr)
> On Clojure: http://clj-me.cgrand.net/ (en)
>



-- 
Professional: http://cgrand.net/ (fr)
On Clojure: http://clj-me.cgrand.net/ (en)

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

feeding leiningen a local JAR file

2012-11-21 Thread Dick Davies
I've got a couple of projects that need a newer version of a JAR
than is available in Maven.

Is there any support/syntax in project.clj that will allow me to point
at a local JAR file?

Also, is it possible to 'override' a given dependency to favour a local JAR
over the 'official' maven one?

[ specifically, I'm trying to use clj-xmpp which uses the SMACK XMPP
libraries under the hood, and the maven shipped version won't authenticate
against our ejabberd ]

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


deserialising records from Swing...

2012-11-21 Thread Jim foo.bar

Hi all,

I discovered yesterday that records cannot be deserialised from the EDT 
using the normal way (prn/read-string)...

NoClassDefFound Exception

trying the same thing from a bare repl (no swing), works just fine!!! 
Googling "deserialisng clojure records" pointed me to [1] where Stuart 
Sierra suggests (quite recently) binding *use-context-classloader*  to 
false or have an agent do the actual work...I'm going to try both as 
soon as I get back home...at the moment I'm just trying to understand 
what goes wrong and what *use-context-classloader* does...


Can anyone help?

Jim


[1] http://grokbase.com/t/gg/clojure/125v358eng/deserialization-of-a-record


--
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: lein 2.x not working on Mac OS X 10.7.5 -- Exception in thread "main" java.lang.ClassNotFoundException:

2012-11-21 Thread Dick Davies
Glad it's not me who keeps hitting this :0

"lein new app hello" seems to be more helpful for setting you up as I'd expect,
just need to wait for my fingers to learn to type it now.

On 14 November 2012 21:44, Marek Šrank  wrote:
> Yep, leiningen now doesn't create -main function in the default template
>
> Marek.
>
> On Wednesday, November 14, 2012 8:40:20 PM UTC+1, Alec Ramsay wrote:
>>
>> My bad: I did not have (defn -main[] (...)) defined.
>>
>>
>> On Wednesday, November 14, 2012 7:42:20 AM UTC-8, Alec Ramsay wrote:
>>>
>>> Thanks everyone for the feedback. To rule out any hyphen / underscore
>>> issues, I created a new project "hello". Got the same exception:
>>>
>>> Exception in thread "main" java.lang.ClassNotFoundException: hello.core
>>> at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>>> at java.security.AccessController.doPrivileged(Native Method)
>>> at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>>> at clojure.lang.DynamicClassLoader.findClass(DynamicClassLoader.java:61)
>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>>> at java.lang.Class.forName0(Native Method)
>>> at java.lang.Class.forName(Class.java:247)
>>> at clojure.lang.RT.classForName(RT.java:2039)
>>> at clojure.lang.Reflector.invokeStaticMethod(Reflector.java:199)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> at
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>> at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>> at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:93)
>>> at clojure.lang.Reflector.invokeStaticMethod(Reflector.java:207)
>>> at user$eval12.invoke(NO_SOURCE_FILE:1)
>>> at clojure.lang.Compiler.eval(Compiler.java:6511)
>>> at clojure.lang.Compiler.eval(Compiler.java:6501)
>>> at clojure.lang.Compiler.eval(Compiler.java:6477)
>>> at clojure.core$eval.invoke(core.clj:2797)
>>> at clojure.main$eval_opt.invoke(main.clj:297)
>>> at clojure.main$initialize.invoke(main.clj:316)
>>> at clojure.main$null_opt.invoke(main.clj:349)
>>> at clojure.main$main.doInvoke(main.clj:427)
>>> at clojure.lang.RestFn.invoke(RestFn.java:421)
>>> at clojure.lang.Var.invoke(Var.java:419)
>>> at clojure.lang.AFn.applyToHelper(AFn.java:163)
>>> at clojure.lang.Var.applyTo(Var.java:532)
>>> at clojure.main.main(main.java:37)
>>>
>>>
>>> I'm not using gen-class.
>>>
>>> Any other thoughts?
>>>
>>> I could be way off base, but it feels like something's not right in the
>>> repo, dependencies, or search path. Is there a way to reset all of these /
>>> make sure they're all right?
>>>
>>> Thanks ...
>>>
>>>
>>> On Tuesday, November 13, 2012 4:11:58 PM UTC-8, Alec Ramsay wrote:

 When I do "lein run" now, I get "Exception in thread "main"
 java.lang.ClassNotFoundException:".

 I'm early in the process of getting a Clojure development environment
 set up--I coded a lot of LISP years ago and want to dust off my skills with
 Clojure--and I have previously successfully done the following on Mac OS X
 10.7.5:

 Installed Leiningen using Brew--this installed a V1 version
 Created and run projects ("lein new"; "lein run"; etc.)
 Everything worked great

 However, I wanted to use nREPL in Aquamacs, so I needed lein 2.x. The
 only way I could get lein2 installed was using these steps. After 
 completing
 them, I successfully tested nREPL inside Aquamacs. Again things seemed to
 work great.

 But while "lein new" still works, "lein run" does not. I get the
 following exception:

 Exception in thread "main" java.lang.ClassNotFoundException:
 http_hello3.core
 at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
 at clojure.lang.DynamicClassLoader.findClass(DynamicClassLoader.java:61)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
 at java.lang.Class.forName0(Native Method)
 at java.lang.Class.forName(Class.java:247)
 at clojure.lang.RT.classForName(RT.java:2039)
 at clojure.lang.Reflector.invokeStaticMethod(Reflector.java:199)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:93)
 at clojure.lang.Reflector.invokeStaticMethod(Reflector.java:207)
 at user$eval12.invoke(NO_SOURCE_FILE:1)
 at clojure.lang.Compiler.eval(Compiler.jav

Re: feeding leiningen a local JAR file

2012-11-21 Thread Jim foo.bar

On 21/11/12 11:47, Dick Davies wrote:

Also, is it possible to 'override' a given dependency to favour a local JAR
over the 'official' maven one?


just install the jar into your local maven repo (~/.m2/) (with 
identifiable name)  and then pull it from whatever project you want. I 
think Leiningen will look first in your .m2 dir and only if it cannot 
find the jar it will ask maven, clojars etc etc...am I right?


Jim

--
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


macroexpand-1 for "clojurescript" macros

2012-11-21 Thread László Török
Hi,

How can I use macroexpand et. al to check an output of a clojurescript
macro?

As far as I know, clojurescript macros are clojure macros.
However if I start script/repl and enter

=> (require 'cljs.compiler)
=> (require 'cljs.core)
=> (macroexpand-1 (cljs.core/gen-apply-to))
CompilerException java.lang.RuntimeException: Unable to resolve symbol:
*unchecked-if* in this context, compiling:(NO_SOURCE_PATH:5)

Btw, if I don't require 'cljs.compiler first, I get

CompilerException java.lang.ClassNotFoundException: cljs.compiler,
compiling:(cljs/core.clj:411)

-- 
László Török

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: macroexpand-1 for "clojurescript" macros

2012-11-21 Thread Herwig Hochleitner
Try quoting the code you want to macro expand, like: (macroexpand-1
'(cljs.core/gen-apply-to))

Otherwise clojure would try to macroexpand the result of (gen-apply-to)
Am 21.11.2012 13:07 schrieb "László Török" :

> Hi,
>
> How can I use macroexpand et. al to check an output of a clojurescript
> macro?
>
> As far as I know, clojurescript macros are clojure macros.
> However if I start script/repl and enter
>
> => (require 'cljs.compiler)
> => (require 'cljs.core)
> => (macroexpand-1 (cljs.core/gen-apply-to))
> CompilerException java.lang.RuntimeException: Unable to resolve symbol:
> *unchecked-if* in this context, compiling:(NO_SOURCE_PATH:5)
>
> Btw, if I don't require 'cljs.compiler first, I get
>
> CompilerException java.lang.ClassNotFoundException: cljs.compiler,
> compiling:(cljs/core.clj:411)
>
> --
> László Török
>
>  --
> 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, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: macroexpand-1 for "clojurescript" macros

2012-11-21 Thread László Török
damn, stupid mistake of mine, thanks!

2012/11/21 Herwig Hochleitner 

> Try quoting the code you want to macro expand, like: (macroexpand-1
> '(cljs.core/gen-apply-to))
>
> Otherwise clojure would try to macroexpand the result of (gen-apply-to)
> Am 21.11.2012 13:07 schrieb "László Török" :
>
>> Hi,
>>
>> How can I use macroexpand et. al to check an output of a clojurescript
>> macro?
>>
>> As far as I know, clojurescript macros are clojure macros.
>> However if I start script/repl and enter
>>
>> => (require 'cljs.compiler)
>> => (require 'cljs.core)
>> => (macroexpand-1 (cljs.core/gen-apply-to))
>> CompilerException java.lang.RuntimeException: Unable to resolve symbol:
>> *unchecked-if* in this context, compiling:(NO_SOURCE_PATH:5)
>>
>> Btw, if I don't require 'cljs.compiler first, I get
>>
>> CompilerException java.lang.ClassNotFoundException: cljs.compiler,
>> compiling:(cljs/core.clj:411)
>>
>> --
>> László Török
>>
>>  --
>> 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, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>
>  --
> 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, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en




-- 
László Török

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Primitive function boxes and unboxes result value

2012-11-21 Thread Gunnar Völkel
I think Cristophe is on the right path. But it is possible that there is 
another Bug concerning primitive functions.
Consider the following two functions:

(defn fib ^long [^long n]
  (if (<= n 1) 1 (+ (fib (dec n)) (fib (- n 2)

(defn fib2 ^double [^double n]
  (if (<= n 1) 1 (+ (fib2 (dec n)) (fib2 (- n 2)

The bytecode of `fib` ends as expected with
42 invokestatic 81;   /* long clojure.lang.Numbers.minus(long arg0, 
long arg1) */
45 invokeinterface 77 3;  /* long invokePrim(long arg0) */
50 invokestatic 84;   /* long clojure.lang.Numbers.add(long arg0, long 
arg1) */
53 lreturn;

But `fib2` boxes and unboxes again:
45 invokestatic 83;   /* double clojure.lang.Numbers.minus(double arg0, 
long arg1) */
48 invokeinterface 79 3;  /* double invokePrim(double arg0) */
53 invokestatic 87;   /* double clojure.lang.Numbers.add(double arg0, 
double arg1) */
56 invokestatic 92;   /* java.lang.Double 
java.lang.Double.valueOf(double arg0) */
59 checkcast 94;  /* java.lang.Number */
62 invokevirtual 98;  /* double doubleValue() */
65 dreturn;

I also rewrote the multiply-and-square algorithm so that it does not use 
`loop`:
(defn multiply-and-square
  ^double [^double result, ^double factor, ^long c]
  (if (> c 0)
(recur 
   (if (first-bit? c)
 (* result factor)
 result),
   (* factor factor),
   (bit-shift-right c 1))
result))

(defn exp-int2
  ^double [^double x, ^long c]
  (multiply-and-square 1.0, x, c))

Here the bytecode of `exp-int2` looks fine, but the recursive function 
`multiply-and-square` performs the boxing and unboxing again:
43 dload_1;   /* result */
44 invokestatic 70;   /* java.lang.Double 
java.lang.Double.valueOf(double factor) */
47 checkcast 72;  /* java.lang.Number */
50 invokevirtual 76;  /* double doubleValue() */
53 dreturn;

Christophe, can you try `fib2` with your patched Clojure?

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: feeding leiningen a local JAR file

2012-11-21 Thread Shantanu Kumar


On Wednesday, 21 November 2012 17:17:40 UTC+5:30, Dick Davies wrote:
>
> I've got a couple of projects that need a newer version of a JAR 
> than is available in Maven. 
>
> Is there any support/syntax in project.clj that will allow me to point 
> at a local JAR file? 
>
> Also, is it possible to 'override' a given dependency to favour a local 
> JAR 
> over the 'official' maven one? 
>


Consider lein-localrepo; give the JAR a different version number: 
https://github.com/kumarshantanu/lein-localrepo

and the usual warning: 
https://github.com/technomancy/leiningen/wiki/Repeatability

Shantanu

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Primitive function boxes and unboxes result value

2012-11-21 Thread Christophe Grand
Hi Gunnar,

The only thing I fixed is related to recur (whose type was null and thus
not unifiable with a primitive type).

Concerning your fib2, I think the proble comes from the "then" being a long
(1) and the else a double.
Thus boxing is required to return either a long or double (well a Long and
a Double).
I think if you change fib2 to always return double you'll see the boxing
ops go away:

(defn fib2 ^double [^double n]
  (if (<= n 1) 1.0 (+ (fib2 (dec n)) (fib2 (- n 2)

Concerning multiply-and-square, since my patch deals with correctly typing
recur in a primitive context, it is solved:

   35:  dstore_1
   36:  goto0
   39:  goto44
   42:  pop
   43:  dload_1
   44:  dreturn

Christophe

On Wed, Nov 21, 2012 at 1:34 PM, Gunnar Völkel <
gunnar.voel...@googlemail.com> wrote:

> (defn fib ^long [^long n]
>   (if (<= n 1) 1 (+ (fib (dec n)) (fib (- n 2)
>



-- 
Professional: http://cgrand.net/ (fr)
On Clojure: http://clj-me.cgrand.net/ (en)

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: feeding leiningen a local JAR file

2012-11-21 Thread Dick Davies
Thanks, that's helpful to know (I was a java dev a long time ago,
before Maven took over
the world), but really I wanted to isolate this hack to a specific
project directory, rather
than globallly.

On 21 November 2012 12:00, Jim foo.bar  wrote:
> On 21/11/12 11:47, Dick Davies wrote:
>>
>> Also, is it possible to 'override' a given dependency to favour a local
>> JAR
>> over the 'official' maven one?
>
>
> just install the jar into your local maven repo (~/.m2/) (with identifiable
> name)  and then pull it from whatever project you want. I think Leiningen
> will look first in your .m2 dir and only if it cannot find the jar it will
> ask maven, clojars etc etc...am I right?
>
> Jim
>
> --
> 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, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: A Simple FeedForward NeuralNetwork (using BackPropagation)

2012-11-21 Thread Anthony McClure
Brian Ripley wrote and maintains the nnet package for R which is the basic
neural net package. He also wrote a book "Pattern Recognition and Neural
Networks" that is somewhat known by statisticians. I only have read the
first chapter but it appeared he would work out simple examples. Also, the
book has a web site http://www.stats.ox.ac.uk/~ripley/PRbook/ with
downloadable datasets. It could make for nice unit tests, Ripley's datasets
and comparison to his R package.

Good luck,
Oliver

On Tue, Nov 20, 2012 at 10:03 AM, Timothy Washington wrote:

> Nice. I'm gonna check out the Weka resources, and Russell and Norvig LISP
> programs. This is just what I'm looking for.
>
> And that Stanford 
> resourceI 
> mentioned, is part of the Coursera regimen. So It sounds like I'm on the
> right course.
>
>
> Thanks all. This helps.
> Tim
>
>
> On Tue, Nov 20, 2012 at 7:25 AM, Goldritter <
> marcus.goldritter.lind...@gmail.com> wrote:
>
>> Here is a link to the LISP programs used in "Artificial Intelligence: A
>> Modern Approach" by  Stuart Russell and Peter Norvig.
>> There is also an example for a Neural Net. I hope this might help.
>>
>> http://aima.cs.berkeley.edu/lisp/doc/overview.html
>>
>>  --
> 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, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

GPU programming (with calx) to parallise a reducer?

2012-11-21 Thread Jim - FooBar();

Hi all,

I just came back from a seminar at Manchester University where the 
speaker from ARM spent an hour talking about GPUs, OPENCL etc etc. The 
thing that is stuck in my head is that, apparently ARM  is trying to 
create this language (PENCIL) which at the moment is a c-variant but 
they are pushing for something more like Scala or OCaml and which 
basically is a 'Platform-Neutral Compute Intermediate Language' for 
Compute accelerators like GPUs.


The entire talk brought back to my mind some thoughts i was having a 
couple of months ago: isn't it possible to do a parallel 'fold' using 
GPUs? We already have reducers fork-join ready (Rich took care of that 
:)), why not deploy the fork-join tree on GPUs?



I just had a look at Zach Tellman's "calx" [1] and seems really 
nice...Of course it is just a wrapper so presumably it doesn't add 
anything new (you still have to write your C strings) but it hides away 
some horrible stuff in a clojury way. Now, assuming that I am a descent 
C programmer (which I'm not!), could I take some of my loop/recurs in my 
code or even a reducer and run them over GPUs?


In theory I would expect a 'yes', whereas in practise I'd expect a 
'no'...am I right? Perhaps Zach can enlighten me? He seems to have 
studied this area...


any thoughts?



[1] https://github.com/ztellman/calx

--
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: ANN Some backwards-incompatible changes in Cheshire 5.0.0

2012-11-21 Thread Lee Hinman

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Michael Klishin writes:

> Cheshire [1] is a mature and fast Clojure JSON serialization library by Lee
> Hinman.
>
> I am posting this here for the community to not go through the story
> we recently had with another popular JSON serializer that introduced
> major breaking changes that were never properly communicated.
>
> Cheshire 5.0.0 has some changes around serialization of custom types.
> Learn more in the change log:
> https://github.com/dakrone/cheshire/blob/master/ChangeLog.md
>
> Code examples in the README are updated and use 5.0 APIs.
>
> In case you need an example of a library that is already upgraded:
> https://github.com/clojurewerkz/support/commit/346be6bb28ef52a89f0c96ac213a4ca87ce47edd
>
> HTH,
>
> 1. https://github.com/dakrone/cheshire
> -- 
> MK

Just so everybody knows also; I did leave in all the original custom
code, so nothing will break when upgrading. The cheshire.custom
namespace has been deprecated, but will remain for quite a while until
I'm sure nobody is using it.

; Lee Hinman
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.12 (Darwin)

iQIcBAEBAgAGBQJQrPyIAAoJEJ1kZdQ6zsrgfvUQAL1Ummvx+mU+oMmdELbPjM/R
Tt9CgmKXdmwHPO/+HUmnrIifpdrpgbJB5uFzMCGGCYQ4Gtuzy6AgvEKk/qq7XlD4
9nOBg4ORJJjqzCt1z9fdw4RHX6xp2CjkBNJpPxy4lCbJTj9ekOkRaUcQQLCQrWu0
HvfIwSG9cRPqjnWaWXlxdNofHrGrH5VE57hQuvBjyyjAbqk0bTvHWA0VW3kzcWHI
H9RiXEowOrKHE1VgQ3by0N/nVB+VW9GNjgxoB6qlZ3FBNEVtIvpDYHr6vJcIrfX8
EgiM7r/b76rFIlMMWEiQ3Enry4fQxnD6TM0XJVIvds0XlFFIiW0Mb5BSD/B+8i3F
yY7B6cCQzeAFpw5K/Pi3dfTlAcx1QxpxWJJj9bfVp/AxAl72fHvcnqsPfmeS66XO
niTlwnyvALzfGLTF7dADRNtsenuYw1P3foWVhrrnrj0aMTVcq9ZVl8IC9f+0O5pB
a8HCGLW8Z3M9pMC6aBaEiKZt6ee8EaO50rjzRKQDQHs13kwf0NoxiqKYPpxrjjTu
bPhhDlt1dqewWbpS2PuE/2/gXfsJqPPdyrOj34siVGG3zvnmF2PPrunNn/PtYOYq
iaZcBFpaY8NM3F4JKjfIhXPIWRoFfmEi/3/OEo7q3A65nPHsS9UTZCnEHomGawbg
UEJxMG2HyctwIMW1pl9H
=RKnb
-END PGP SIGNATURE-

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: How to add an URL into the classpath?

2012-11-21 Thread Vladimir Tsichevski
Hi Yoshinori,

after (unsuccessfully) struggling with Clojure dynamic ClassLoaders in 
clojure-1.4, I ended up with the 'brute force' solution--just add URL 
entries to the Java system classloader. Here is a simple example on how to 
do it from clojure:

(defn add-system-classpath
  "Add an url path to the system class loader"
  [url-string]
  (let [field (aget (.getDeclaredFields java.net.URLClassLoader) 0)]
(.setAccessible field true)
(let [ucp (.get field (ClassLoader/getSystemClassLoader))]
  (.addURL ucp (java.net.URL. url-string)

(add-system-classpath "file:/some/clojure/root/")
(load "some/clojure/file") ;; load the some/clojure/file.clj from the 
/some/clojure/root/ catalog
(add-system-classpath "file:/some/java/classes/")
some.java.MyClass ;; use the some.java.MyClass in the /some/java/classes/ 
catalog

Regards,
Vladimir

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: GPU programming (with calx) to parallise a reducer?

2012-11-21 Thread Timothy Baldridge
If you are running pure arithmetic code over primitive arrays, and not
doing allocation (so no seqs, higher order functions, etc.) then it's
pretty straight forward to translate Clojure code to GPU code. Now notice
that all the above qualifications are directly opposite to "normal" Clojure
practices, so yes, it's often easier said than done.

That being said, I've written some CUDA code in the past and haven't found
it all that bad to use if you have a good wrapper. It's kind of a catch-22
though. The faster the code, the less like Clojure it will look. If you
want easier porting, you'll pay a performance price. And in GPU
programming, a simple re-alignment of memory loads can mean a 10x
performance boost at times, so that performance "price" could end up
meaning you blow away most of the usefulness of programming a GPU in the
first place.


Timothy


On Wed, Nov 21, 2012 at 9:07 AM, Jim - FooBar(); wrote:

>  Hi all,
>
> I just came back from a seminar at Manchester University where the speaker
> from ARM spent an hour talking about GPUs, OPENCL etc etc. The thing that
> is stuck in my head is that, apparently ARM  is trying to create this
> language (PENCIL) which at the moment is a c-variant but they are pushing
> for something more like Scala or OCaml and which basically is a
> 'Platform-Neutral Compute Intermediate Language' for Compute accelerators
> like GPUs.
>
> The entire talk brought back to my mind some thoughts i was having a
> couple of months ago: isn't it possible to do a parallel 'fold' using GPUs?
> We already have reducers fork-join ready (Rich took care of that :)), why
> not deploy the fork-join tree on GPUs?
>
>
> I just had a look at Zach Tellman's "calx" [1] and seems really nice...Of
> course it is just a wrapper so presumably it doesn't add anything new (you
> still have to write your C strings) but it hides away some horrible stuff
> in a clojury way. Now, assuming that I am a descent C programmer (which I'm
> not!), could I take some of my loop/recurs in my code or even a reducer and
> run them over GPUs?
>
> In theory I would expect a 'yes', whereas in practise I'd expect a
> 'no'...am I right? Perhaps Zach can enlighten me? He seems to have studied
> this area...
>
> any thoughts?
>
>
>
> [1] https://github.com/ztellman/calx
>
> --
> 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, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en




-- 
“One of the main causes of the fall of the Roman Empire was that–lacking
zero–they had no way to indicate successful termination of their C
programs.”
(Robert Firth)

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: GPU programming (with calx) to parallise a reducer?

2012-11-21 Thread Neale Swinnerton
On Wed, Nov 21, 2012 at 4:07 PM, Jim - FooBar(); wrote:

>
>
The entire talk brought back to my mind some thoughts i was having a couple
> of months ago: isn't it possible to do a parallel 'fold' using GPUs? We
> already have reducers fork-join ready (Rich took care of that :)), why not
> deploy the fork-join tree on GPUs?
>
>
The main problem with accessing any native code from JVM languages is that
you have to copy the data from JVM land to native land. For some algorithms
this is acceptable but often not. Since the data is then copied again to
GPU land, I suspect this will soon become prohibitive.

Having said that, project sumatra[2], announced at the most recent Java One
is proposing to (somehow) bring native GPU coding to the JVM. It'll be
interesting to see how this progresses and whether it'll be achievable from
clojure, still very early days. I looked at aparapi[3] linked from the
project sumatra homepage for possible use from clojure, but it takes java
byte code and transforms it for GPU, so a clojure wrapper doesn't seem
feasible.

Also, there is talk of some native 'tuple' interface to allow finer control
over memory layout of datastructures along the lines of Martin Thompsons
work [4]. That stuff is really not for the faint hearted, but this minutiae
is what kills you when you're really trying to maximize performance.

regards

Neale
{t: @sw1nn , w: sw1nn.com }


[2] http://openjdk.java.net/projects/sumatra/
[3] http://code.google.com/p/aparapi/
[4]
http://mechanical-sympathy.blogspot.co.uk/2012/10/compact-off-heap-structurestuples-in.html

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: GPU programming (with calx) to parallise a reducer?

2012-11-21 Thread Jim - FooBar();

On 21/11/12 16:22, Timothy Baldridge wrote:
If you are running pure arithmetic code over primitive arrays, and not 
doing allocation (so no seqs, higher order functions, etc.) then it's 
pretty straight forward to translate Clojure code to GPU code. Now 
notice that all the above qualifications are directly opposite to 
"normal" Clojure practices, so yes, it's often easier said than done.


 so that is the catch!!! I was sort of hoping I could parallelise 
the following function which is my bottleneck:


(definline team-moves
"Returns all the moves (a reducer) for the team with direction 'dir' on 
this board b."

[b dir exposes-check?]
`(r/mapcat
(fn [p#]
  (getMoves p# ~b ~exposes-check?)) (gather-team ~b ~dir)))


I guess I can stop dreaming now... :-!


thanks Timothy & Neal for explanations and links...


Jim

--
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Deserialization of a Record

2012-11-21 Thread Jim - FooBar();

I'm having the same problem as Chris...

Serialization and deserialization from a REPL works fine whereas from 
the GUI it doesn't...ClassNotFoundException...
binding *use-context-classloaders* to false did not help and invoking a 
future or an agent from the event handler doesn't work either...This 
must be the first time (at least for me) that Stuart suggested something 
that did not work...this is NOT a complain of course! rather a compliment...


ChrisR, how did you get around this? did you just give up and use java 
serialisation instead? cos I'm almost there...



Jim


--
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: [ANN] clj-xpath 1.3.3

2012-11-21 Thread Phil Hagelberg
Michael Klishin  writes:

> Please use a group-id, it is not that hard to come up with, even if
> you end up using org.clojars.[username].

No, please do not use org.clojars.* unless you are publishing a fork.
That convention has a specific meaning already; if you use it you will
be signaling to your potential users that they shouldn't use it.

-Phil

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: How to add an URL into the classpath?

2012-11-21 Thread Alex Ott
You can also use https://github.com/cemerick/pomegranate - it works fine...

On Wed, Nov 21, 2012 at 5:14 PM, Vladimir Tsichevski
 wrote:
> Hi Yoshinori,
>
> after (unsuccessfully) struggling with Clojure dynamic ClassLoaders in
> clojure-1.4, I ended up with the 'brute force' solution--just add URL
> entries to the Java system classloader. Here is a simple example on how to
> do it from clojure:
>
> (defn add-system-classpath
>   "Add an url path to the system class loader"
>   [url-string]
>   (let [field (aget (.getDeclaredFields java.net.URLClassLoader) 0)]
> (.setAccessible field true)
> (let [ucp (.get field (ClassLoader/getSystemClassLoader))]
>   (.addURL ucp (java.net.URL. url-string)
>
> (add-system-classpath "file:/some/clojure/root/")
> (load "some/clojure/file") ;; load the some/clojure/file.clj from the
> /some/clojure/root/ catalog
> (add-system-classpath "file:/some/java/classes/")
> some.java.MyClass ;; use the some.java.MyClass in the /some/java/classes/
> catalog
>
> Regards,
> Vladimir
>
> --
> 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, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en



-- 
With best wishes,Alex Ott
http://alexott.net/
Twitter: alexott_en (English), alexott (Russian)
Skype: alex.ott

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


[Jobs] Big Data Engineer Position at Google-backed SF Startup

2012-11-21 Thread Nathan Visconti
The Climate Corporation is Google Ventures backed  big data startup with a 
mission 
to help people adapt to climate change . We make sense 
of huge amounts of complicated data and run simulations to determine the 
risk of adverse weather, which influences 25% of GDP. We are currently 
looking for Big Data Engineers (links below). If you are interested, send a 
resume to nvisco...@climate.com or apply at climate.com/careers. 

Cheers, 

Nate

==
Software Engineer - Quant/Big Data (SF) 
Back End/Big Data Engineer (SF Or Seattle) 
Big Data Engineer (Seattle) 


*Who We Are:*

The Climate Corporation’s mission is to help all the world’s people and 
businesses manage and adapt to climate change.  To achieve our mission, we 
have built a unique technology platform to enable, for the first time, the 
real-time pricing and purchasing of customizable weather insurance. 
Managing over 200 TB of data, including 34 trillion+ weather simulation 
data points, 150 billion soil type observations, and more than 3 million 
daily weather measurements, we are one of the largest users of Amazon Web 
Services.

The Climate Corporation is focused on the enormous challenge and 
opportunity of protecting the $3 trillion global agriculture industry from 
the financial impact of adverse weather – the cause of over 90 percent of 
crop loss – with fully automated weather insurance products. We are also 
building web and mobile applications that unleash the power of our unique 
data and analyses to help farmers manage their daily work with field-level 
weather and crop insights.

At The Climate Corporation, leaving a mark on the world is in our DNA; we 
want to make a lasting and meaningful real-world impact. We relish big 
problems because they are the most interesting to tackle, the most 
rewarding, and typically, the most valuable to solve. We also thrive on 
finding the possible in the impossible.

If you are the best at what you do, you like solving interesting problems, 
and you are looking for like-minded people dedicated to having a major 
impact on the world, we are eager to talk with you.

*What We Offer:*

Our team is composed of some of the most brilliant interdisciplinary minds 
in the industry. Climatology Specialists, Big Data Engineers, 
Mathematicians, Frontend Application Engineers and more work together to 
create the most forward thinking technology in the industry. The 
environment is extremely engaging and fast-paced, with dozens of 
specialties coming together to provide the best product possible product 
and experience for our customers.  As Mark Twain said, “A great deal has 
been said about the weather, but very little has been done about it.” Our 
goal is to change that.

   - Competitive salary, excellent benefits, and some of the best perks in 
   the industry, including:
   - Generous stock options. Our success is your success
   - Catered lunch 5 days a week from a varied array of San Francisco 
   eateries
   - Endless snacks and company-paid dinner
   - On-site massages
   - “3-On 1-Off” Sprints. That means that 25% of your time is spent 
   working on your own innovations for the company
   - Company sponsored outings, including go-kart races, kayaking, holiday 
   yacht parties, and sporting events, etc.
   - An always-stocked kegerator
   - Energetic idea-driven work environment with an exciting culture
   - Exciting world-changing opportunity - we are solving problems that 
   have a massive impact on the world
   - A driven, talented team that aims to make a large-scale impact through 
   an innovative technology platform

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Primitive function boxes and unboxes result value

2012-11-21 Thread Gunnar Völkel
Of course. You are right. I did forget about the long constant.
I hope your patch will be included in Clojure 1.5.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: ClojureCLR: StackOverflowException when evaluating cond with large number of clauses

2012-11-21 Thread dmiller
The compiler uses recursive descent in its analysis.  Given a VM call stack 
that does not grow, there will always been some input that causes the 
compiler to blow stack.  In the case of cond, the macro expands into a 
nested if statements.  Given enough clauses, you get the result you have 
experienced.

There are several solutions.

(1) Rewrite the compiler to make the analysis use an explicite 
(heap-allocated) stack.That would be a lot of work.  It's not going on 
my short list anytime soon.
(2) Rewrite the compiler to run on a separate thread and create a way (a 
command-line option, for example) to configure the stack size on the 
compiler thread.
(3) Recompile (actually re-link) Clojure.Main.exe to have a larger stack 
size.   See http://msdn.microsoft.com/en-us/library/8cxs58a6(v=vs.100).aspx
(4) Edit the Clojure.Main.exe executable to have a larger stack size.  The 
EDITBIN.EXE program is often used for this. 
 See http://msdn.microsoft.com/en-us/library/xd3shwhf(v=vs.110).aspx.
(5) Break up your cond into several (non-nested) statements.

Solutions (1) through (4) require access to the CLR compiler toolset or 
Visual Studio.

-David


On Saturday, November 17, 2012 10:37:38 AM UTC-6, FC wrote:
>
> When ClojureCLR (.NET 3.5 build) evals a cond form with 1024 clauses it 
> throws a StackOverflowException.
>
> Cond example code in pastebin: http://pastebin.com/K4QQmjNF
> Save the example code to bigcond.clj and run Clojure.Main like: 
> Clojure.Main bigcond.clj
>
> The number of cond clauses needed to cause a stack overflow varies. 
>
> Stack trace:
>
> System.StackOverflowException was unhandled
>
>
> > Clojure.dll!clojure.lang.ASeq.ASeq(clojure.lang.IPersistentMap meta) 
> Line 44 + 0xa bytes C#
>   
> Clojure.dll!clojure.lang.TypedArraySeq.TypedArraySeq(clojure.lang.IPersistentMap
>  
> meta, object[] array, int index) Line 241 + 0xf bytes C#
>   
> Clojure.dll!clojure.lang.ArraySeq_object.ArraySeq_object(clojure.lang.IPersistentMap
>  
> meta, object[] array, int index) Line 734 + 0x19 bytes C#
>   Clojure.dll!clojure.lang.ArraySeq.create(object[] array) Line 41 + 0x44 
> bytes C#
>
>

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Arity problem with multi-methods

2012-11-21 Thread Christian Sperandio
Hi,

I try to define multi-methods but when I call one I get an exception.

I declared the multi-methods like below:

(defmulti new-food-item (fn [food expiration]
  (if (number? expiration)
::duration
::expiration-date)))

(defmethod new-food-item ::duration [food expiration-duration]
  (let [expiration-date (GregorianCalendar.)]
(.add expiration-date GregorianCalendar/DAY_OF_MONTH 
expiration-duration)
{:name food :expiration-date expiration-date}))

(defmethod new-food-item ::expiration-date [food expiration-date]
  {:name food :expiration-date expiration-date})


And when I do: (new-food-item "tomatoes" 5)
I get this exception:
ArityException Wrong number of args (2) passed to: core$class 
 clojure.lang.AFn.throwArity (AFn.java:437)

I don't understand where is the problem :/

Some help?

Thank you.

Chris

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: [ANN] Clojars Releases repository

2012-11-21 Thread John Gabriele
On Sunday, November 18, 2012 4:46:51 PM UTC-5, Sean Corfield wrote:
>
> On Sun, Nov 18, 2012 at 5:56 AM, Phil Hagelberg 
> > wrote:
>
>> If you don't have a key yet, generate one with `gpg --gen-key`. The
>> default settings are pretty good, though I'd recommend making it expire
>> in a year or two. Next find your key ID. It's the 8-character part after
>> the slash on the line beginning with "pub":
>>
>
> As I said at the conj, I'm looking forward to the documentation explaining 
> how to install and use gpg since it's not provided by default on either Mac 
> OS X or Windows.
>
> Then you can show it with `gpg --export -a $KEY_ID`.
>>
>
> $KEY_ID? (again, as I noted at the conj, without good documentation on the 
> Leiningen site for this, folks won't necessarily know what this is or why 
> they need to do all of this, especially the web of trust stuff you 
> discussed and key exchanges / publishing etc).
>
>
Regarding the documentation issue, I wrote this today 
https://github.com/clojuredocs/cds/blob/master/articles/ecosystem/libraries_authoring.md
 
. It should make it online to clojure-doc.org soon. I included the 
instructions Phil gave here, and went through the process with a trivial 
example lib to make sure I included any other details I ran across.

Thank you to the folks on #leiningen for helping clarify some of the points 
covered in that doc.

---John

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

nREPL status

2012-11-21 Thread Chas Emerick
FYI, an updated cut of high-level nREPL documentation is now available:

https://github.com/clojure/tools.nrepl

There's a fair bit more I plan on adding, but I think some reorganization into 
different pages for different topics is warranted at this point before the 
README gets any more unwieldy.

Of particular interest to some on this list would be this:

https://github.com/clojure/tools.nrepl/blob/master/doc/ops.md

...a generated page collecting all documentation included in nREPL's default 
middlewares' descriptors.  You can see how this page is generated by starting 
here:


https://github.com/clojure/tools.nrepl/blob/master/src/test/clojure/clojure/tools/nrepl/describe_test.clj#L34

If you have implemented your own nREPL middleware, you may want to document the 
operations it supports/implements in a similar way, and the above might be a 
reasonable starting point (though hardly a polished one, yet) for generating 
those docs.

This closes the last open issue associated with the 0.2.0 milestone.  That 
release will be hitting the wires at some point in between Thanksgiving 
festivities.

Cheers,

- Chas

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Can CLJS functions have metadata?

2012-11-21 Thread Brandon Bloom
Fixed: http://dev.clojure.org/jira/browse/CLJS-359

On Saturday, August 25, 2012 12:49:47 AM UTC-7, Shantanu Kumar wrote:
>
> Hi,
>
> I noticed that `with-meta` is not working on function objects in CLJS. 
> Compilation fails with the following error:
>
> Error: No protocol method IWithMeta.-with-meta defined for type function: 
> function (maps, x) {
>   return x;
> }
>
> I tried it out on the REPL and found the following:
>
> -- BEGIN: repl-rhino --
> ClojureScript:cljs.user> (with-meta #(do :foo) {:foo :bar})
> "Error evaluating:" (with-meta (fn* [] (do :foo)) {:foo :bar}) :as 
> "cljs.core.with_meta.call(null,(function (){\nreturn 
> \"\\uFDD0'foo\";\n}),cljs.core.ObjMap.fromObject([\"\\uFDD0'foo\"],{\"\\uFDD0'foo\":\"\\uFDD0'bar\"}));\n"
> org.mozilla.javascript.JavaScriptException: Error: No protocol method 
> IWithMeta.-with-meta defined for type function: 
> function () {
> return "\ufdd0'foo";
> }
>  (cljs/core.cljs#222)
> at cljs/core.cljs:222 (anonymous)
> at cljs/core.cljs:214 (_with_meta)
> at cljs/core.cljs:806 (with_meta)
> at :2 (anonymous)
> at :2
>
> nil
> -- END: repl-rhino --
>
> Is this supposed to be a bug? I can file an issue on JIRA if so.
>
> Shantanu
>

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Arity problem with multi-methods

2012-11-21 Thread grinnbearit
Hi Chris,

If you change multimethod arities you'll have to def the multimethod to nil 
or restart the swank/nrepl server. It doesn't update that on recompilation.

Sidhant

On Thursday, November 22, 2012 3:44:10 AM UTC+5:30, Christian Sperandio 
wrote:
>
> Hi,
>
> I try to define multi-methods but when I call one I get an exception.
>
> I declared the multi-methods like below:
>
> (defmulti new-food-item (fn [food expiration]
>   (if (number? expiration)
> ::duration
> ::expiration-date)))
>
> (defmethod new-food-item ::duration [food expiration-duration]
>   (let [expiration-date (GregorianCalendar.)]
> (.add expiration-date GregorianCalendar/DAY_OF_MONTH 
> expiration-duration)
> {:name food :expiration-date expiration-date}))
>
> (defmethod new-food-item ::expiration-date [food expiration-date]
>   {:name food :expiration-date expiration-date})
>
>
> And when I do: (new-food-item "tomatoes" 5)
> I get this exception:
> ArityException Wrong number of args (2) passed to: core$class 
>  clojure.lang.AFn.throwArity (AFn.java:437)
>
> I don't understand where is the problem :/
>
> Some help?
>
> Thank you.
>
> Chris
>
>

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

priority-map pop issue

2012-11-21 Thread JvJ
I'm not sure if this is an error or not, but priority-maps behaves 
strangely when given a function like <=.

(pop (priority-map-by <= :a 1 :b 2 :c 3))
=> {:a 1 :b 2 :c 3} ;; First element isn't popped.

Is this supposed to happen?

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: priority-map pop issue

2012-11-21 Thread Mark Engelberg
As per the other thread, remember that in Clojure sorted collections only
function properly when given a function that obeys the trichotomy property
(exactly one of the following hold: a wrote:

> I'm not sure if this is an error or not, but priority-maps behaves
> strangely when given a function like <=.
>
> (pop (priority-map-by <= :a 1 :b 2 :c 3))
> => {:a 1 :b 2 :c 3} ;; First element isn't popped.
>
> Is this supposed to happen?
>
> --
> 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, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: priority-map pop issue

2012-11-21 Thread JvJ
Thanks.  I wasn't sure if that applied to priority maps as well.

On Wednesday, 21 November 2012 21:35:54 UTC-5, puzzler wrote:
>
> As per the other thread, remember that in Clojure sorted collections only 
> function properly when given a function that obeys the trichotomy property 
> (exactly one of the following hold: a function for Clojure's sorted collections, including priority-map.  You 
> have to use something like <.
>
> On Wed, Nov 21, 2012 at 6:08 PM, JvJ >wrote:
>
>> I'm not sure if this is an error or not, but priority-maps behaves 
>> strangely when given a function like <=.
>>
>> (pop (priority-map-by <= :a 1 :b 2 :c 3))
>> => {:a 1 :b 2 :c 3} ;; First element isn't popped.
>>
>> Is this supposed to happen?
>>
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com 
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>
>
>

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Fail to run `lein bootstrap` in ClojureScript One

2012-11-21 Thread Satoru Logic
HI, all.

I'm following the instructions 
on http://clojurescriptone.com/getting-started.html, 
and run `lein bootstrap` in the `one` directory, but `lein` complains that 
*'bootstrap' 
is not a task*. 

How can I install this `bootstrap` task?

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Closure Accordion Widget

2012-11-21 Thread J Elaych
I'm designing a web interface that I hope to implement in Clojurescript. 
 I've been looking at the underlying Closure framework to make sure I have 
all the functionality I need, and I'm not finding any examples of an 
Accordion widget, like the one available in Jquery-ui.   So if Google 
doesn't provide one, perhaps someone else has an Accordion widget project 
for Closure?   I also wonder how feasible it is to write UI components in 
Clojurescript itself, rather than in Closure or JS.   Thanks in advance for 
any suggestions you can send my way.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Fail to run `lein bootstrap` in ClojureScript One

2012-11-21 Thread Sean Corfield
ClojureScript One still requires Leiningen 1.x - it hasn't been updated to
Leiningen 2.x yet.


On Wed, Nov 21, 2012 at 10:06 PM, Satoru Logic wrote:

> HI, all.
>
> I'm following the instructions on
> http://clojurescriptone.com/getting-started.html,
> and run `lein bootstrap` in the `one` directory, but `lein` complains that
> *'bootstrap' is not a task*.
>
> How can I install this `bootstrap` task?
>
> --
> 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, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en




-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Fail to run `lein bootstrap` in ClojureScript One

2012-11-21 Thread Satoru Logic
Got it.
Thanks.

On Thursday, November 22, 2012 3:12:53 PM UTC+8, Sean Corfield wrote:
>
> ClojureScript One still requires Leiningen 1.x - it hasn't been updated to 
> Leiningen 2.x yet.
>
>
> On Wed, Nov 21, 2012 at 10:06 PM, Satoru Logic 
> 
> > wrote:
>
>> HI, all.
>>
>> I'm following the instructions on 
>> http://clojurescriptone.com/getting-started.html, 
>> and run `lein bootstrap` in the `one` directory, but `lein` complains 
>> that *'bootstrap' is not a task*. 
>>
>> How can I install this `bootstrap` task?
>>
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com 
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>
>
>
>
> -- 
> Sean A Corfield -- (904) 302-SEAN
> An Architect's View -- http://corfield.org/
> World Singles, LLC. -- http://worldsingles.com/
>
> "Perfection is the enemy of the good."
> -- Gustave Flaubert, French realist novelist (1821-1880)
>  

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Arity problem with multi-methods

2012-11-21 Thread Christian Sperandio
Thank you !
I became crazy because I didn't see the problem in my code.

Why is there this issue with multi-methods? (and not with standard
functions)


Chris

Le 22 nov. 2012 à 02:34, grinnbearit  a écrit :

Hi Chris,

If you change multimethod arities you'll have to def the multimethod to nil
or restart the swank/nrepl server. It doesn't update that on recompilation.

Sidhant

On Thursday, November 22, 2012 3:44:10 AM UTC+5:30, Christian Sperandio
wrote:
>
> Hi,
>
> I try to define multi-methods but when I call one I get an exception.
>
> I declared the multi-methods like below:
>
> (defmulti new-food-item (fn [food expiration]
>   (if (number? expiration)
> ::duration
> ::expiration-date)))
>
> (defmethod new-food-item ::duration [food expiration-duration]
>   (let [expiration-date (GregorianCalendar.)]
> (.add expiration-date GregorianCalendar/DAY_OF_MONTH
> expiration-duration)
> {:name food :expiration-date expiration-date}))
>
> (defmethod new-food-item ::expiration-date [food expiration-date]
>   {:name food :expiration-date expiration-date})
>
>
> And when I do: (new-food-item "tomatoes" 5)
> I get this exception:
> ArityException Wrong number of args (2) passed to: core$class
>  clojure.lang.AFn.throwArity (AFn.java:437)
>
> I don't understand where is the problem :/
>
> Some help?
>
> Thank you.
>
> Chris
>
>  --
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Arity problem with multi-methods

2012-11-21 Thread Baishampayan Ghose
Christian,

defmulti has defonce-like semantics which I guess is to prevent the
associated defmethods from being wiped out when the form is recompiled.

Cite -
https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L1622

-BG


On Wed, Nov 21, 2012 at 11:45 PM, Christian Sperandio <
christian.speran...@gmail.com> wrote:

> Thank you !
> I became crazy because I didn't see the problem in my code.
>
> Why is there this issue with multi-methods? (and not with standard
> functions)
>
>
> Chris
>
> Le 22 nov. 2012 à 02:34, grinnbearit  a
> écrit :
>
> Hi Chris,
>
> If you change multimethod arities you'll have to def the multimethod to
> nil or restart the swank/nrepl server. It doesn't update that on
> recompilation.
>
> Sidhant
>
> On Thursday, November 22, 2012 3:44:10 AM UTC+5:30, Christian Sperandio
> wrote:
>>
>> Hi,
>>
>> I try to define multi-methods but when I call one I get an exception.
>>
>> I declared the multi-methods like below:
>>
>> (defmulti new-food-item (fn [food expiration]
>>   (if (number? expiration)
>> ::duration
>> ::expiration-date)))
>>
>> (defmethod new-food-item ::duration [food expiration-duration]
>>   (let [expiration-date (GregorianCalendar.)]
>> (.add expiration-date GregorianCalendar/DAY_OF_MONTH
>> expiration-duration)
>> {:name food :expiration-date expiration-date}))
>>
>> (defmethod new-food-item ::expiration-date [food expiration-date]
>>   {:name food :expiration-date expiration-date})
>>
>>
>> And when I do: (new-food-item "tomatoes" 5)
>> I get this exception:
>> ArityException Wrong number of args (2) passed to: core$class
>>  clojure.lang.AFn.throwArity (AFn.java:437)
>>
>> I don't understand where is the problem :/
>>
>> Some help?
>>
>> Thank you.
>>
>> Chris
>>
>>  --
> 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, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>
>  --
> 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, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>



-- 
Baishampayan Ghose
b.ghose at gmail.com

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en