Re: new Clojure Compiler...

2010-05-17 Thread Fabio Kaminski
first that dinamic languages are better for developers, but you loose some performance compared to typed languages.. and jvm was created with types in mind.. so right now clojure data structures are implemented in java and typed, when you get it in the clojure runtime its boxed already. theres

Re: Actors not good for concurrency model

2010-05-17 Thread Fabio Kaminski
far as i know..actors share a mutable queue.. so there's good possibility for dead-locks for scala theres an akka framework , that you can solve that with its actors .. that let me see.. uses a STM.. and its actors are pretty the same as .. clojures agents i think clojure are making disciples in

Re: Artificial Intelligence in Clojure

2010-05-17 Thread Fabio Kaminski
i think MIT - church http://projects.csail.mit.edu/church/wiki/Church http://projects.csail.mit.edu/church/wiki/Churchwould be a good candidate AI lib for porting to clojure On Sat, May 15, 2010 at 5:02 PM, Miki miki.teb...@gmail.com wrote: You can use Weka (java). On May 14, 10:56 pm,

Re: congomongo memory leak?

2010-05-17 Thread Andrew Boekhoff
Hi. Congomongo is a fairly thin wrapper around the MongoDB java driver. All fetch requests are proxied through the driver which handles all opening and closing of connections automatically. Its main utility is providing a smooth(er) interface between Clojure's immutable types and the mutable

Re: new Clojure Compiler...

2010-05-17 Thread Steven Devijver
On 17 mei, 08:48, Fabio Kaminski fabiokamin...@gmail.com wrote: first that dinamic languages are better for developers, but you loose some performance compared to typed languages.. and jvm was created with types in mind.. so right now clojure data structures are implemented in java and

Re: Dynamic use of protocols

2010-05-17 Thread Laurent PETIT
Yes, as David wrote, What you're describing is not single-dispatch-based polymorphism (e.g. like in java), it's double dispatch (because you want to dispatch to the implementation of the protocol function based on both the type and another parameter which may be totally dynamic, or materialized

labrepl - Enclojure/Maven integration

2010-05-17 Thread Rick Moynihan
Hi all, I ran a clojure dojo last week in Dundee, Scotland and thought we'd be able to start on a simple group project making use of a couple of libraries. I figured the most idiomatic approach to this would be to adopt leiningen, but it appears that Enclojure (used by the majority of the group

Re: Actors not good for concurrency model

2010-05-17 Thread Peter Schuller
far as i know..actors share a mutable queue.. so there's good possibility for dead-locks Actors as they work in erlang don't have mutable state (not intrinsically anyway, though of course you can implement an actor that does poke on shared data since it's your code). The 'state' in an erlang

Re: ANN: try clojure

2010-05-17 Thread Daniel Werner
Having a web-based zero-deployment-effort REPL is pretty nifty, especially for newcomers. Thanks Rayne/Heinz/etc.! Already found a small bug: HTML entities are apparently quoted twice and appear in the output. Clojure blah quot;blahquot; Clojure filter #lt;core$filter__5084

Re: setting vars with macro

2010-05-17 Thread Michael Gardner
On May 15, 2010, at 4:56 PM, islon wrote: I'm working in a simple single-thread console-based rpg game in clojure (a port from my own scala version) and didn't want to use any concurrency structure because the game is single threaded. I was thinking about a macro like (defmacro set!! [s

Re: how do I clojurize this java ?

2010-05-17 Thread Sean Devlin
Clojurize just got added to my custom dictionary :) You'll want to use the standard . syntax for creating a new object. You wrote this (new TwitterStreamFactory) It's standard to write (TwitterStreamFactory. ) So your form would look like this: (.getInstance (TwitterStreamFactory. )

Re: Dynamic use of protocols

2010-05-17 Thread Mikhail Kryshen
On 17 май, 12:07, Laurent PETIT laurent.pe...@gmail.com wrote: Yes, as David wrote, What you're describing is not single-dispatch-based polymorphism (e.g. like in java), it's double dispatch (because you want to dispatch to the implementation of the protocol function based on both the type

Style preference: (:key map) or (map :key)?

2010-05-17 Thread Michael Gardner
It appears the (:key map) style is more common than (map :key) among Clojurians. Is this true? So far I'm doing (map :key) because it's more familiar, and because it doesn't make me change styles when using something besides keywords as keys (admittedly rare so far). But I'd like to hear other

Re: Error when tried to compile with C-c C-k in emacs.

2010-05-17 Thread grav
You'll notice 90% of the I'm having trouble with Emacs posts have one thing in common: they all start with I'm trying to install without ELPA. I have this exact problem, and I have installed everything using ELPA. clojure-mode 1.7.1 slime 20100404 slime-repl 20100404 swank-clojure 1.1.0

Re: Style preference: (:key map) or (map :key)?

2010-05-17 Thread Mike DeLaurentis
I don't know if it's more common or not, but I tend to use (:key map) most of the time, because it's a visual cue that I'm getting some key from a map. Whenever you see (:key something), you know that you're getting the :key field from something. When you see (something :key), you have to be

Re: Dynamic use of protocols

2010-05-17 Thread Laurent PETIT
2010/5/17 Mikhail Kryshen mikh...@kryshen.net: On 17 май, 12:07, Laurent PETIT laurent.pe...@gmail.com wrote: Yes, as David wrote, What you're describing is not single-dispatch-based polymorphism (e.g. like in java), it's double dispatch (because you want to dispatch to the implementation

Clojure 1.2: Readsyntax for meta information

2010-05-17 Thread Stefan Kamphausen
Hi, is it correct to assume that the usual read-syntax for 1.2 will be ^ instead of #^? Will all printers emit that? Will #^ become deprecated? Unfortunately I didn't find a enlightening ticket on assembla and no information on the devel list, just the commit message (^ does what #^ does,

Atoms/Concurrency - usage pattern

2010-05-17 Thread Jules
Guys, I have a hybrid Java/Clojure project. I'm finding myself moving more and more of the concurrent code from Java to Clojure - because it is so much simpler to code in Clojure :-)... ... but I am also finding that I have a recurring problem for which Clojure only seems to have a partial

Re: Clojure 1.2: Readsyntax for meta information

2010-05-17 Thread Meikel Brandmeyer
Hi, On Mon, May 17, 2010 at 08:21:39AM -0700, Stefan Kamphausen wrote: is it correct to assume that the usual read-syntax for 1.2 will be ^ instead of #^? Will all printers emit that? Will #^ become deprecated? No. They are not equivalent and ^ is deprecated. #^ will remain doing what it

Re: Atoms/Concurrency - usage pattern

2010-05-17 Thread Meikel Brandmeyer
Hi, On Mon, May 17, 2010 at 08:49:35AM -0700, Jules wrote: The problem occurs in stateful objects when you receive an input and need to both modify your state and generate and deliver some output. I store my internal state in an atom and use swap! to update it, passing in the input and a

Re: Atoms/Concurrency - usage pattern

2010-05-17 Thread ataggart
If you are not concerned about coordination, then why not just grab the value beforehand and use compare-and-set: (let [old @my-atom new (my-fn arg)] (compare-and-set! my-atom old new) (do-stuff old new)) On the other hand, if you are concerned about coordination between multiple

Re: Clojure 1.2: Readsyntax for meta information

2010-05-17 Thread Laurent PETIT
2010/5/17 Meikel Brandmeyer m...@kotka.de: Hi, On Mon, May 17, 2010 at 08:21:39AM -0700, Stefan Kamphausen wrote: is it correct to assume that the usual read-syntax for 1.2 will be ^ instead of #^?  Will all printers emit that? Will #^ become deprecated? No. They are not equivalent and ^

Re: Clojure 1.2: Readsyntax for meta information

2010-05-17 Thread ataggart
Not quite. Syntax Before: meta: ^ type-hint: #^ Syntax After: meta: none, use meta type-hint: ^ It's already in place on 1.2: user= (set! *warn-on-reflection* true) true user= (defn foo [x] (.longValue x)) Reflection warning, NO_SOURCE_PATH:6 - reference to field longValue can't be resolved.

Re: Atoms/Concurrency - usage pattern

2010-05-17 Thread Jules
Thanks for your replies - Meikel and Alex, I considered using refs, but perhaps wrongly, came to the conclusion that they were for coordinating multiple changes atomically within an STM ? I figured that I only had one shared piece of state - current- state (input and output are both effectively

Re: setting vars with macro

2010-05-17 Thread islon
Thanks for the answers. I realized the macro wasn't a good idea and I will keep using atoms to manage state, just found the reset! function =) Islon On May 17, 10:28 am, Michael Gardner gardne...@gmail.com wrote: On May 15, 2010, at 4:56 PM, islon wrote: I'm working in a simple single-thread

Re: Clojure 1.2: Readsyntax for meta information

2010-05-17 Thread Meikel Brandmeyer
Hi, On Mon, May 17, 2010 at 09:18:15AM -0700, ataggart wrote: Not quite. Wow. I'm really disconnected from 1.2. :( Please ignore me concerning 1.2 questions. Sincerely Meikel -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group,

Re: Dynamic use of protocols

2010-05-17 Thread Sean Devlin
You could create a local instance of clojure.lang.MultiFn in a let binding, and access it directly. You can see the definition of the object here: http://github.com/richhickey/clojure/blob/master/src/jvm/clojure/lang/MultiFn.java The very good reason you DO NOT DO THIS is that this object is

Re: Clojure 1.2: Readsyntax for meta information

2010-05-17 Thread Stefan Kamphausen
Salut, On 17 Mai, 18:12, Laurent PETIT laurent.pe...@gmail.com wrote: 2010/5/17 Meikel Brandmeyer m...@kotka.de: Hi, On Mon, May 17, 2010 at 08:21:39AM -0700, Stefan Kamphausen wrote: is it correct to assume that the usual read-syntax for 1.2 will be ^ instead of #^?  Will all

Re: Which git version for cells?

2010-05-17 Thread Eric Schulte
Hi Steven, I recently put together a propagator/cell system using Clojure's actors/watchers. The code for implementing a concurrent propagator system actually came out to a little less than a single page. Take a look at the following for the full implementation. http://gist.github.com/403987

Re: Which git version for cells?

2010-05-17 Thread Steven Devijver
On 17 mei, 19:25, Eric Schulte schulte.e...@gmail.com wrote: Hi Steven, I recently put together a propagator/cell system using Clojure's actors/watchers.  The code for implementing a concurrent propagator system actually came out to a little less than a single page.  Take a look at the

a default value for get-in?

2010-05-17 Thread braver
If get-in is to be consistent with get, it better allow to specify a default value: (get-in nested-structure [k1 k2 ... kN] :default something) -- would it make sense to add that to the standard get-in? Cheers, Alexy -- You received this message because you are subscribed to the Google Groups

Re: Clojure 1.2: Readsyntax for meta information

2010-05-17 Thread Laurent PETIT
2010/5/17 Stefan Kamphausen ska2...@googlemail.com: Salut, On 17 Mai, 18:12, Laurent PETIT laurent.pe...@gmail.com wrote: 2010/5/17 Meikel Brandmeyer m...@kotka.de: Hi, On Mon, May 17, 2010 at 08:21:39AM -0700, Stefan Kamphausen wrote: is it correct to assume that the usual

When is *err* used?

2010-05-17 Thread alux
Hi, I reset *out* in a test program, and it worked fine. But when I try to do the same with *err*, I found no change, still. All Errors I produced seem to go directly to Java's System.err, not using my new *err*. Can anybody point me to a situation, when *err* is used? Thank you, and kind

Re: a default value for get-in?

2010-05-17 Thread Jay Fields
+1. I'd also like to see a default value in select-keys. On Mon, May 17, 2010 at 3:34 PM, braver delivera...@gmail.com wrote: If get-in is to be consistent with get, it better allow to specify a default value: (get-in nested-structure [k1 k2 ... kN] :default something) -- would it make

convert this to loop/recur?

2010-05-17 Thread Base
Hi All - I am trying convert a function to use loop/recur and am getting the dreded java.lang.UnsupportedOperationException: Can only recur from tail position (repl-1:414) error (at least dreded for newbies...) The function takes 2 joda dates and returns a sequence of dates starting at the

Re: swank-clojure and GNU Emacs 23 - package.el install issues

2010-05-17 Thread David Nolen
I'm running into this issue as well. On Mon, May 17, 2010 at 4:18 PM, Terrence Brannon scheme...@gmail.comwrote: Hello, I wanted to try out Clojure. It was my understanding that swank-clojure was a package GNU Emacs that would download clojure automatically. But the docs for it no longer say

Re: convert this to loop/recur?

2010-05-17 Thread Base
Thanks Mike - So I was doing a little more digging on this and came across an interesting blog posting: http://formpluslogic.blogspot.com/2009/07/clojure-lazy-seq-and-recursion.html discussing the use of recursion vs lazy sequences. To mimic Brent from his posting I created 2 fn's: (defn

Re: convert this to loop/recur?

2010-05-17 Thread Dave Fayram
Note that your recur call is wrapped in a cons. It is *not* in the tail position. (def date-seq (fn [d1 d2] (loop [b (- d1 (.dayOfMonth) (.withMinimumValue)) e d2] (cons b (if (time/before? b e) (recur (.plusMonths b 1) e)) ;; Inside

Re: Error when tried to compile with C-c C-k in emacs.

2010-05-17 Thread Robbie Vanbrabant
I am seeing the same issue, also with ELPA. Has anyone been able to resolve this issue? Used the emacs starter kit (http://github.com/technomancy/emacs- starter-kit) and then installed swank-clojure using ELPA. All the other functionality seems to be working just fine. Thanks Robbie On May 17,

Re: labrepl - Enclojure/Maven integration

2010-05-17 Thread Pratik Patel
How does labrepl integrate with Enclojure, and does anyone manage to use an IDE effectively with lein/maven? I use CCW in Eclipse, but I used Netbeans + Enclojure + labrepl in the past. I fired NB up again and did the following and it seemed to work OK. This is with Netbeans 6.8 with

Re: Actors not good for concurrency model

2010-05-17 Thread Dave Fayram
Actors in Erlang DO have mutable state, you're just discouraged from using it. ;) No really, erl -man get and set. Sometimes you're forced to use this despite the best of intentions. But I really have to ask, how composable were monads again? - dlf On Mon, May 17, 2010 at 3:04 AM, Peter

Re: swank-clojure and GNU Emacs 23 - package.el install issues

2010-05-17 Thread Paul Hobbs
Seconded, I'm having troubles with both swank-clojure and clojure. -- Paul Hobbs On Mon, May 17, 2010 at 1:18 PM, Terrence Brannon scheme...@gmail.comwrote: Hello, I wanted to try out Clojure. It was my understanding that swank-clojure was a package GNU Emacs that would download clojure

Does emacs suppress output from thread ?

2010-05-17 Thread Preecha P
I tried to play around with thread with these lines of code. It should print the value of variable but it doesn't.. In emacs. user (def x 5) #'user/x user x 5 user (import [java.lang Thread]) java.lang.Thread user (.start (Thread. (fn [] (print x nil or with agent user (def foo (agent 0))

Re: Error when tried to compile with C-c C-k in emacs.

2010-05-17 Thread Hugo Duncan
On Mon, 17 May 2010 10:38:43 -0400, grav mikk...@gmail.com wrote: clojure-mode 1.7.1 slime 20100404 slime-repl 20100404 swank-clojure 1.1.0 You'll need swank-clojure 1.2.1 to work with that version of slime. -- Hugo Duncan -- You received this message because you are subscribed to the

Re: Actors not good for concurrency model

2010-05-17 Thread patrickdlogan
i don't expect it would be hard to write an Erlang program with 2 actors that would deadlock. Of course it wouldn't. as far as i know, people use timeouts on message handling to sweep it under the carpet. Most people probably use the OTP library with well-defined behaviors is what they call

Re: convert this to loop/recur?

2010-05-17 Thread Adrian Cuthbertson
Hi Base, It's useful to think of the pattern of loop/recur and then apply it to your problem. I.e (loop [-- initial bindings --] (if --- terminating condition --- ---return result---; otherwise... (do-stuff with bindings (recur ---with new bindings--- A simple

Re: swank-clojure and GNU Emacs 23 - package.el install issues

2010-05-17 Thread Justin Kramer
Per Phil Hagelberg's suggestion on IRC, I downloaded and used his package.el, which fixed the issue for me: http://github.com/technomancy/package.el/raw/master/package.el Phil said the bug hasn't been patched upstream. Justin On May 17, 4:18 pm, Terrence Brannon scheme...@gmail.com wrote:

Re: convert this to loop/recur?

2010-05-17 Thread Meikel Brandmeyer
Hi, On May 18, 1:23 am, Base basselh...@gmail.com wrote: (defn lazy-date-seq [d1 d2]   (let [start (- d1                 (.dayOfMonth)                 (.withMinimumValue))]      (lazy-seq        (cons start          (if (joda/before? start d2)            (lazy-date-seq (.plusMonths start

Re: convert this to loop/recur?

2010-05-17 Thread Jarkko Oranen
On May 18, 2:23 am, Base basselh...@gmail.com wrote: (defn lazy-date-seq [d1 d2]   (let [start (- d1                 (.dayOfMonth)                 (.withMinimumValue))]      (lazy-seq        (cons start          (if (joda/before? start d2)            (lazy-date-seq (.plusMonths start 1)