Re: Atomic reloads and snapshots of namespaces

2009-11-27 Thread John Harrop
On Fri, Nov 27, 2009 at 7:48 PM, André Thieme wrote: > Let‘s say we have the functions A, B, C, D, E, F and G. > A is calling B, B is calling C, C is calling D, and so on. > Now a request R1 comes in, function A is called and this chain > continues to, > say, E. > Now a reload happens. Some functi

Re: Krishnamurthi's Automata in Clojure (OutOfMemoryError)

2009-11-27 Thread Mark Triggs
Hi Charles, I notice I can stop your version from running out of memory with a very small change. Changing from: ;; the [f & args] form of trampoline (trampoline init start-stream) to: ;; the [f] form of trampoline (trampoline #(init start-stream)) seems to work as expected. I would

Re: Atomic reloads and snapshots of namespaces

2009-11-27 Thread André Thieme
On 27 Nov., 04:33, pmf wrote: > On Nov 26, 7:39 pm, Richard Newman wrote: > > > "Re consistency: I seem to recall Pascal Costanza working on   > > activation of layers, so you can swap a whole set of stuff across your   > > program. He spoke about it at ILC2009, but I'm not sure I've found the  

Krishnamurthi's Automata in Clojure (OutOfMemoryError)

2009-11-27 Thread Charles Gordon
I've been working on a problem that requires me to write a small state machine for processing XML documents. Out of curiousity (I'm new to functional programming) I hit Google to see how automata are written in other functional languages. I found Shriram Krishnamurthi's paper: http://lambda-the-ul

Re: Functions and vars and meta-data

2009-11-27 Thread DTH
On Nov 27, 5:46 pm, Richard Newman wrote: > > I don't support the view that it's OK for programmers to not know what > they're doing, which in this case means knowing that 'foo reads as > (quote foo). FWIW I *strongly* agree; getting reader macros straight in my head was a *big* help in macro wri

Re: Functions and vars and meta-data

2009-11-27 Thread Alex Osborne
Stefan Kamphausen writes: >>   (meta '#^{a 1} greet) > > To be honest, I think it looks even worse. There is some reader macro > which by happy accident works in a certain way together with the other > read syntax. No, I don't think it should work. I agree this is ugly and unintuitive and I wo

Re: Functions and vars and meta-data

2009-11-27 Thread Richard Newman
> Whoa! Cool example. This is rather an important point, I think. I > mean it's not important, when your "only" programming with Clojure, > which will usally work, and you always have the REPL... But it > becomes more important for those, trying to understand. It's about > grokking a language'

Re: Functions and vars and meta-data

2009-11-27 Thread Stefan Kamphausen
Hi, On Nov 27, 11:06 pm, "Alex Osborne" wrote: > > A *new* symbol?   I would have thought I'm getting the original symbol > > again. > > Yes, one of the differences between symbols and keywords is that symbols > are created fresh each time while keywords are interned: > > (identical? 'foo 'foo) ;

Re: AOT'd namespaces lose their metadata

2009-11-27 Thread Phil Hagelberg
Tom Faulhaber writes: > I'm super-excited about Leiningen, btw. I've been thinking about how > to turn my autodoc stuff into a Leiningen plugin so that we can get > easy doc for any project. Awesome. We've already got someone started working on a doc plugin; please join the leiningen mailing lis

Re: performance issues with multi-dimensional array

2009-11-27 Thread Christophe Grand
On Thu, Nov 26, 2009 at 11:49 AM, Amnon wrote: > I did, and it works like a charm. Couldn't figure out how to hint an > array of objects (what should I put instead of the old #^objects? > I still get it to work in 300 ms (which is not great but something I > can live with). > You have to replace

Re: Functions and vars and meta-data

2009-11-27 Thread Alex Osborne
Stefan Kamphausen writes: >> I don't think the documentation is *wrong* per se, it just only seems to >> cover the immutable types. > > Which is kind of wrong, isn't it? I strongly believe that this should > be changed. Indeed. > While I understand that the mutating functions will not apply to

Re: Strange little difference with the reader and the java float parsers

2009-11-27 Thread Ron Thomas
user=> (- (new Double "1786.28") (read-string "1786.28")) 0.0 Following uip on what Hugo said, modifying your code to a double returns the following. On Nov 27, 1:32 pm, "Hugo Duncan" wrote: > On Fri, 27 Nov 2009 14:50:27 -0500, Nathan Cunningham   > > wrote: > > Apparently there are cases whe

Re: Functions and vars and meta-data

2009-11-27 Thread John Harrop
On Fri, Nov 27, 2009 at 1:23 PM, John Harrop wrote: > On Fri, Nov 27, 2009 at 12:46 PM, Richard Newman wrote: > >> > Maybe this ought to be fixed; i.e., if the reader sees #^{meta} 'foo >> > it applies the metadata to foo first, then quotes it, resulting in >> > the same thing as (quote #^{meta}

Re: Functions and vars and meta-data

2009-11-27 Thread John Harrop
On Fri, Nov 27, 2009 at 12:46 PM, Richard Newman wrote: > > Maybe this ought to be fixed; i.e., if the reader sees #^{meta} 'foo > > it applies the metadata to foo first, then quotes it, resulting in > > the same thing as (quote #^{meta} foo). > > Why introduce that special case, when you can sim

Re: Strange little difference with the reader and the java float parsers

2009-11-27 Thread Joost
On Nov 27, 9:32 pm, "Hugo Duncan" wrote: > read-string returns a Double for me... Yeah: user> (class (read-string "1786.28")) java.lang.Double user> (- (new Double "1786.28") (read-string "1786.28")) 0.0 -- You received this message because you are subscribed to the Google Groups "Clojure" gro

Re: Space leak with lazy sequences.

2009-11-27 Thread David Brown
On Fri, Nov 27, 2009 at 01:52:05PM +0200, Miron Brezuleanu wrote: >not sure if it works here, but what about adapting advice from Stuart >Halloway's Programming Clojure (pages 159-160, 'Losing your head') and >use a function returning a sequence instead of a 'bound by let' name >(the actual advice

Re: Strange little difference with the reader and the java float parsers

2009-11-27 Thread Hugo Duncan
On Fri, 27 Nov 2009 14:50:27 -0500, Nathan Cunningham wrote: > Apparently there are cases where read will return a slightly different > float then the Float constructor will. For example: > > (- (new Float "1786.28") (read-string "1786.28")) > 2.929687502728484E-5 read-string returns a Double

Strange little difference with the reader and the java float parsers

2009-11-27 Thread Nathan Cunningham
I was working on a system that used the reader / pprint to load and save data too and from the disk and I ran into a strange issue when I reloaded my work from a JTable Apparently there are cases where read will return a slightly different float then the Float constructor will. For example: (- (n

Re: Lein adding repos

2009-11-27 Thread David Nolen
Yes this worked for me. I was trying to add JOGL jars a dependency to a project. Unfortunately now running into java.lang.Security Exceptions because the JOGL jars are signed. blech. On Fri, Nov 27, 2009 at 1:28 PM, Phil Hagelberg wrote: > On Nov 27, 10:09 am, Luke Renn wrote: > > On Nov 27, 12:

Re: Lein adding repos

2009-11-27 Thread Phil Hagelberg
On Nov 27, 10:09 am, Luke Renn wrote: > On Nov 27, 12:40 pm, David Nolen wrote: > > > Is there currently a simple way to add new maven2 repos to download from? > > I haven't done it, but looking at the code you just add :repositories > [[id url]] to your project.clj. That's correct. I'll try to

Re: Sneak Peek

2009-11-27 Thread jim
I discovered a rather subtle bug as I was coding an example web-app, so I haven't got the code out yet. Will ASAP. That tutorial is going to take a little time to write, because as the Haskell folks note, "Here be dragons!". The continuation monad is one of the most powerful and can be considered

Re: Lein adding repos

2009-11-27 Thread Luke Renn
On Nov 27, 12:40 pm, David Nolen wrote: > Is there currently a simple way to add new maven2 repos to download from? I haven't done it, but looking at the code you just add :repositories [[id url]] to your project.clj. Luke -- You received this message because you are subscribed to the Google G

Re: Query regarding `conj'

2009-11-27 Thread Richard Newman
> (rest *v1) is equal to *v2 in the below mentioned example. Then why > `conj' operation on them is returning different things. rest is giving you a seq. conj is thus producing a cons where the first is 0 and the rest is that seq. (Essentially, seqs are treated as lists, and thus print with

Re: Functions and vars and meta-data

2009-11-27 Thread Richard Newman
> Maybe this ought to be fixed; i.e., if the reader sees #^{meta} 'foo > it applies the metadata to foo first, then quotes it, resulting in > the same thing as (quote #^{meta} foo). Why introduce that special case, when you can simply do the second? I don't support the view that it's OK for p

Re: Query regarding `conj'

2009-11-27 Thread Lauri Pesonen
Hi Nipra, 2009/11/27 nipra : > Hi, >  (rest *v1) is equal to *v2 in the below mentioned example. Then why >  `conj' operation on them is returning different things. > > user> (def *v1 [1 2 3 4 5]) > #'user/*v1 > user> (def *v2 [2 3 4 5]) > #'user/*v2 > user> (= (rest *v1) *v2) > true > user> (def

Lein adding repos

2009-11-27 Thread David Nolen
Is there currently a simple way to add new maven2 repos to download from? David -- 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 p

Re: Sneak Peek

2009-11-27 Thread Martin Coxall
On Nov 25, 2:59 pm, Konrad Hinsen wrote: > On 25.11.2009, at 15:32, jim wrote: > > > That's exactly what it is. I used the continuation monad from > > clojure.contrib.monads. After I get the code out, I'll be writing a > > tutorial on how it works which will also explain the continuation > > mon

Re: reordering agent messages sent from a locked area, is it possible?

2009-11-27 Thread Sergey Didenko
I wrote a simple test to check it and it does not see reordering on multiprocessing system. But it does not prove anything of course. (def transaction-lock (java.util.concurrent.locks.ReentrantLock.) ) (def transaction-counter (atom 0)) (def counting-agent (agent {:count 1})) (defn check [

Re: combining vimclojure, classpaths and leiningen

2009-11-27 Thread Meikel Brandmeyer
Hi, On Nov 27, 4:16 pm, bOR_ wrote: > using vimclojures' nailgun, I would have a line like this added to > my .vimrc file. Can I still use that? > > let vimclojure#NailgunClient = "/home/boris/opt/vimclojure/ng" You still need this. Leiningen only starts the server, will this is the client. Wit

Re: roll call of production use?

2009-11-27 Thread John Harrop
We're maintaining a large database of tagged images and had a need to perform "fuzzy search" of the database. The existing search tool takes exact queries only. So it was necessary to hack up a little tool to sit between the query source and the engine and transform the query into a "fuzzy query".

Re: Functions and vars and meta-data

2009-11-27 Thread John Harrop
On Fri, Nov 27, 2009 at 8:45 AM, Stefan Kamphausen wrote: > > Why? Well because #^ attaches the metadata to the next read form. > > What's the next read form? It's 'greet. But in fact 'greet is just > > sugar for (quote greet). So we're actually affixing the metadata to a > > list containing t

reordering agent messages sent from a locked area, is it possible?

2009-11-27 Thread Sergey Didenko
Hi, Can I assume that messages sent to an agent inside a locked area will keep their order ( the locking order)? Or is it still possible for them to be reordered like in general case when you send the messages from different threads? The following code will be run from different threads: (lockin

Re: Functions and vars and meta-data

2009-11-27 Thread Meikel Brandmeyer
Hi, On Nov 27, 2:45 pm, Stefan Kamphausen wrote: > A *new* symbol?   I would have thought I'm getting the original symbol > again. If you get back the original symbol back, it can't carry metadata... > Definitely, and I don't like the distinction too much either. But it makes sense. A Var rep

Query regarding `conj'

2009-11-27 Thread nipra
Hi, (rest *v1) is equal to *v2 in the below mentioned example. Then why `conj' operation on them is returning different things. user> (def *v1 [1 2 3 4 5]) #'user/*v1 user> (def *v2 [2 3 4 5]) #'user/*v2 user> (= (rest *v1) *v2) true user> (def *v3 (conj (rest *v1) 0)) #'user/*v3 user> *v3 (0

Re: combining vimclojure, classpaths and leiningen

2009-11-27 Thread Meikel Brandmeyer
Hi, On Nov 27, 1:43 pm, "Alex Osborne" wrote: > Just add it to :dev-dependencies in your project.clj.  Then you should > be able to just do: > > lein nailgun And make sure that the vimclojure.jar is in your classpath. It will happily use whatever nailgun is there. Sincerely Meikel -- You rec

Re: Sneak Peek

2009-11-27 Thread Martin Coxall
On Nov 25, 2:32 pm, jim wrote: > Graham, > > That's exactly what it is. I used the continuation monad from > clojure.contrib.monads. Mention it on the website, and you instantly win +50 bonus Web 2.0 points for buzzword-compliance. Congraturation! > After I get the code out, I'll be writing a

Re: Functions and vars and meta-data

2009-11-27 Thread Meikel Brandmeyer
Hi, On Nov 27, 10:19 am, Stefan Kamphausen wrote: > As far as the documentation says, Vars can't have metadata: > > "Symbols and collections support metadata," --http://clojure.org/metadata > > "Symbols, Lists, Vector, Sets and Maps can have metadata" > --http://clojure.org/reader > > I tried t

Re: A Clojure Highlife

2009-11-27 Thread John Harrop
On Thu, Nov 26, 2009 at 4:37 AM, Chris Jenkins wrote: > > (defn flip-cell [b x y] > (let [row (nth b y) > cell (nth row x) > new-cell (- 1 cell) > new-row (assoc row x new-cell)] > (assoc b y new-row))) > (defn flip-cell [b x y] (update-in b [y x] #(- 1 %))) :) -- You receive

Re: combining vimclojure, classpaths and leiningen

2009-11-27 Thread bOR_
Got it working. The only thing I need next to leiningen to set up my working environment + project is the ng client from vimclojure, the correct lines in .vimrc and the vimclojure vim plugin parts (in .vim) Good! On Nov 27, 4:16 pm, bOR_ wrote: > using vimclojures' nailgun, I would have a line l

Re: combining vimclojure, classpaths and leiningen

2009-11-27 Thread bOR_
Hmm. Need a bit of handholding (can't find any documentation yet on this either.) There is a vimclojure coming with adding [[lein-nailgun/lein-nailgun "0.1.0"]] to dev-dependencies (org/clojars/gilbert1/vimclojure). Do I add that to the dependencies as well? On Nov 27, 4:16 pm, bOR_ wrote: > us

Re: combining vimclojure, classpaths and leiningen

2009-11-27 Thread bOR_
using vimclojures' nailgun, I would have a line like this added to my .vimrc file. Can I still use that? let vimclojure#NailgunClient = "/home/boris/opt/vimclojure/ng" On Nov 27, 1:43 pm, "Alex Osborne" wrote: > bOR_ writes: > > I think I cannot escape spelling out the ~/.m2/paths to clojure.j

Re: Functions and vars and meta-data

2009-11-27 Thread Stefan Kamphausen
Hi, that have been some really embarrassing typos in my post (typing too fast in too stupid an interface, I think). On Nov 27, 12:52 pm, "Alex Osborne" wrote: > Stefan Kamphausen writes: > > On Nov 8, 3:46 am, Alex Osborne wrote: > > As far as the documentation says, Vars can't have metadata:

Re: combining vimclojure, classpaths and leiningen

2009-11-27 Thread Alex Osborne
bOR_ writes: > I think I cannot escape spelling out the ~/.m2/paths to clojure.jar > and clojure-contrib.jar in vimclojures' local.properties file, but is > there any way I can get start the nailgun server from my projects' > directory and it just takes ./lib as its classpath? java -cp 'src:clas

combining vimclojure, classpaths and leiningen

2009-11-27 Thread bOR_
Hi All, Is there any obvious way by which you can combine vimclojure and leiningen easily? If I use leiningen to download and arrange all my jar dependencies, they all end up in a ~/.m2/repositories/... etc directory, and in the /lib directory of whatever project. I think I cannot escape spelling

Re: Functions and vars and meta-data

2009-11-27 Thread Alex Osborne
Stefan Kamphausen writes: > On Nov 8, 3:46 am, Alex Osborne wrote: > As far as the documentation says, Vars can't have metadata: > > "Symbols and collections support metadata," -- http://clojure.org/metadata > > "Symbols, Lists, Vector, Sets and Maps can have metadata" -- > http://clojure.org/re

Re: Space leak with lazy sequences.

2009-11-27 Thread Miron Brezuleanu
Hi, not sure if it works here, but what about adapting advice from Stuart Halloway's Programming Clojure (pages 159-160, 'Losing your head') and use a function returning a sequence instead of a 'bound by let' name (the actual advice in the book is to use functions returning sequences instead of va

Re: Functions and vars and meta-data

2009-11-27 Thread Stefan Kamphausen
Hi Alex, first of all thank your this exhaustive explanation. I still don't get some things, though, and kindly ask for more enlightenment. On Nov 8, 3:46 am, Alex Osborne wrote: > So after resolving, it then has a Var object.  A Var, is as it's > name suggests, a variable.  It consist of a nam