Re: Unable to resolve var

2009-10-11 Thread Meikel Brandmeyer
Hi, On Oct 12, 4:34 am, gL wrote: > (use 'clojure.contrib.combinatorics) > > (defn run-euler-024 [] >   (binding [max 0] >     (let [perms (take 100 (lex-permutations [0 1 2 3 4 5 6 7 8 > 9]))] >       (doseq [perm perms] >         (set! max perm))) >     max)) > > The solution only works w

Dealing with StringTemplate template paths

2009-10-11 Thread Baishampayan Ghose
Hello, I am using StringTemplate with Clojure here and I have this issue with setting the template path for StringTemplate. I don't want to hard code the absolute path in the code, and thus I have used a relative path for the template directory. But every time I have to cd (I use SLIME) to the r

Re: Agents for managing threads

2009-10-11 Thread Garth Sheldon-Coulson
Hi All, Thanks for the great replies. John, the self-send-off idea is terrific and hadn't occurred to me. I'll be using a variant of what you proposed. Garth On Sun, Oct 11, 2009 at 10:29 PM, John Harrop wrote: > On Sun, Oct 11, 2009 at 5:28 PM, Raoul Duke wrote: > >> >> will actors actually

Re: Is there a standard function transforming a map's vals

2009-10-11 Thread John Harrop
On Sun, Oct 11, 2009 at 3:17 PM, Daniel Werner < daniel.d.wer...@googlemail.com> wrote: > On Oct 11, 6:02 am, samppi wrote: > > Oops, you're right; I was thinking about something else. And I have > > another mistake in my function too—I meant: > > > > (defn transform-map [f a-map] > > (into

Re: Unable to resolve var

2009-10-11 Thread Alex Osborne
gL wrote: > The solution only works with a var name that equals to a Clojure name > (here "max"). That's because (binding) only works with a var that already exists, it doesn't create a new one. To create your own var (instead of abusing a clojure core one) just use "with-local-vars" instead o

Unable to resolve var

2009-10-11 Thread gL
Hello working on Project Euler exercise 24 I solved the right answer with this solution (use 'clojure.contrib.combinatorics) (defn run-euler-024 [] (binding [max 0] (let [perms (take 100 (lex-permutations [0 1 2 3 4 5 6 7 8 9]))] (doseq [perm perms] (set! max perm)))

Re: Duplicated keys in maps

2009-10-11 Thread John Harrop
On Sun, Oct 11, 2009 at 8:55 PM, Angel Java Lopez wrote: > Hi people! > > I just discovered that maps support duplicated keys: > > user=> {:a 1 :b 2 :a 3} > {:a 1, :b 2, :a 3} > > It was not clear to me, from documentation. I presumed that maps are like > dictionaries. > > What is the rationale be

Re: Proposal: New Reader Macro #s{ ... }

2009-10-11 Thread John Harrop
How about borrowing a page from LaTeX? That has a \verb+text+ which can use any desired delimiter character. My thought is to have something like $+.+ turning whatever was between the character following $ (here, +) until the next occurrence of that character into a literal string. A way to esc

Re: Duplicated keys in maps

2009-10-11 Thread Alex Osborne
On Oct 12, 11:55 am, Angel Java Lopez wrote: > I just discovered that maps support duplicated keys: > What is the rationale behind this behaviour? No, maps don't support duplicate keys. What you're seeing is due to an implementation detail in how array-maps are created from literals. You'll not

File and Regex Utils

2009-10-11 Thread Robert Stehwien
While doing some scripting and as a learning I put together some file and regex utilities. Reading though parts of clojure-contrib was a great eye opener. Still needs some cleanup, doc, and maybe a few more functions. I could wrap all the java.io.File functions but most are just a thin wrapper;

Re: Agents for managing threads

2009-10-11 Thread John Harrop
On Sun, Oct 11, 2009 at 5:28 PM, Raoul Duke wrote: > >> will actors actually do the queued function w/in a reasonable > >> timeframe? i don't think there are any guarantees of it so if one is > >> hoping to get really nicely periodic behaviour... just curious because > >> i'd thought of using age

Duplicated keys in maps

2009-10-11 Thread Angel Java Lopez
Hi people! I just discovered that maps support duplicated keys: user=> {:a 1 :b 2 :a 3} {:a 1, :b 2, :a 3} It was not clear to me, from documentation. I presumed that maps are like dictionaries. What is the rationale behind this behaviour? Is it this feature used in some way by clojure library?

Re: Proposal: New Reader Macro #s{ ... }

2009-10-11 Thread Mark Derricutt
{"quoted" text} is also a map, so conflicts with existing syntax. On Mon, Oct 12, 2009 at 10:38 AM, Greg wrote: >(replace {"quoted" text} my-str {"quoted" string}) > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: Proposal: New Reader Macro #s{ ... }

2009-10-11 Thread Mark Derricutt
Ignore that, replied before reading fully to see #s{...} :( On Mon, Oct 12, 2009 at 3:18 PM, Mark Derricutt wrote: > {"quoted" text} is also a map, so conflicts with existing syntax. > > On Mon, Oct 12, 2009 at 10:38 AM, Greg wrote: > >>(replace {"quoted" text} my-str {"quoted" string})

Re: Is there a standard function transforming a map's vals

2009-10-11 Thread Stuart Sierra
On Oct 10, 8:40 pm, samppi wrote: > (defn transform-map [f a-map] > (into {} (map #(vector (key %) (f (val %))) a-map))) I always find map transformations easier to write with reduce: (defn transform-map [f mm] (reduce (fn [m [k v]] (assoc m k (f v))) {} mm)) -SS --~--~-~--~---

Re: Proposal: New Reader Macro #s{ ... }

2009-10-11 Thread Greg
On Oct 11, 2009, at 9:01 PM, Greg wrote: > The purpose of which would be primarily to make writing regular > expressions easier, but also to deal with strings that have quotes > in time Sorry, that should read "quotes in them". ;-) --~--~-~--~~~---~--~~ You re

Re: Proposal: New Reader Macro #s{ ... }

2009-10-11 Thread Greg
> Reader macros have full access to the text stream, so it would be > straightforward to define a Perlish heredoc syntax for big literals, > e.g. Sure, heredoc could be done, it has the nice advantage of being flexible, guaranteeing that you can escape any text. The only issue is that like Pe

Re: Proposal: New Reader Macro #s{ ... }

2009-10-11 Thread Richard Newman
> True, and it is why newLISP uses two delimiters for this purpose, {} > and [text][/text]. The latter might not work well in clojure though > because of its use of arrays. Reader macros have full access to the text stream, so it would be straightforward to define a Perlish heredoc syntax for b

Re: Proposal: New Reader Macro #s{ ... }

2009-10-11 Thread Greg
True, and it is why newLISP uses two delimiters for this purpose, {} and [text][/text]. The latter might not work well in clojure though because of its use of arrays. The former is used for short strings, often for the purpose of regular expressions or to avoid quoting quotes, and the latte

Re: ClojureCLR limitations

2009-10-11 Thread David Miller
Latest commit adds support for letfn. --David On Oct 11, 12:20 am, David Miller wrote: > For limitations and unimplemented features, go to the github site and > check out the Issues tab and in the wiki, look at  the 'To Do' page > and the bottom of the 'CLR Interop' page. > > I just added the n

Re: Proposal: New Reader Macro #s{ ... }

2009-10-11 Thread James Reeves
What if you need to use braces? It seems to me that any syntax for representing long strings needs a terminator that is unlikely to occur within the string itself. For example, Python uses """, and XML CDATA uses ]]>, both of which are character sequences unlikely to turn up in a string. By contra

Proposal: New Reader Macro #s{ ... }

2009-10-11 Thread Greg
Dear Clojure group and developers, In a recent discussion on #clojure it was pointed out that another language called newLISP has an excellent feature that would be neat to adopt into clojure, namely its special text delimiters {} and [text][/ text]. It uses these delimiters to specify verba

Statics in clojure.lang.RT

2009-10-11 Thread Manuel Woelker
Hi, While hacking on counterclockwise I noticed that the clojure.lang code uses a lot of static variables and methods. As far as I can tell this makes it almost impossible to have two or more separate instances of the clojure running in one application. Other JVM hosted scripting languages allow

Re: using library.path

2009-10-11 Thread Folcon
Thanks for that! btw, is there a cannonical way to create executable jar files? I'm having some success to make this a web start application but every time I compile I keep getting could not find main class. my namespace contains (:gen-class :main true) with the main function I want to declare

Re: api html page not working in firefox?

2009-10-11 Thread Richard Newman
> it seems to get chopped off part way down the page for me, of late. > (it doesn't get chopped off in ie for me.) You wouldn't happen to be tunneling to a proxy via PuTTY, would you? I've seen that happen in the past to a lot of people. --~--~-~--~~~---~--~~ Yo

Re: api html page not working in firefox?

2009-10-11 Thread Jonathan Smith
its fine in firefox 3.0.14 on Ubuntu here. On Oct 11, 5:29 pm, Raoul Duke wrote: > it seems to get chopped off part way down the page for me, of late. > (it doesn't get chopped off in ie for me.) --~--~-~--~~~---~--~~ You received this message because you are subs

api html page not working in firefox?

2009-10-11 Thread Raoul Duke
it seems to get chopped off part way down the page for me, of late. (it doesn't get chopped off in ie for me.) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to cloj

Re: Agents for managing threads

2009-10-11 Thread Raoul Duke
>> will actors actually do the queued function w/in a reasonable >> timeframe? i don't think there are any guarantees of it so if one is >> hoping to get really nicely periodic behaviour... just curious because >> i'd thought of using agents for periodic stuff, too. > > In practice, they seem to.

Re: idomatic sudoku?

2009-10-11 Thread Matt Wilson
My approach (which I might upload once I've tidied it up a bit) was to use a hash-map of [x y] cell coordinates to a set of all remaining numbers. So, something like: {[0 0] #{1 2 3 4} [0 1] #{5 6 7 8} …} Then I just made some functions that mapped an [x y] pair to all it's peers -- e.g. unit, r

Re: Performance tuning for a simple SLE solver

2009-10-11 Thread B Smith-Mannschott
On Fri, Oct 9, 2009 at 13:38, andi.xeno...@googlemail.com wrote: > > Hi, > > I'm new to Clojure, and let me first say that I love it! At least I > love the language, but I have some concerns regarding performance: > > My first try was to implement a Gauß elemination algorithm for solving > a syst

Re: Is there a standard function transforming a map's vals

2009-10-11 Thread Daniel Werner
On Oct 11, 6:02 am, samppi wrote: > Oops, you're right; I was thinking about something else. And I have > another mistake in my function too—I meant: > > (defn transform-map [f a-map] > (into {} (map #(vector (key %) (f (val %))) a-map))) > > It's unfortunate that it's not in any standard l

Re: On using GPL libs in Clojure

2009-10-11 Thread Michael Wood
2009/10/11 Tassilo Horn : > > Miron Brezuleanu writes: > > Hi Miron, > >> This thread is getting confusing. The initial question was about >> GPL'ed libraries, yet the example used is clojure.jar. Isn't Clojure >> licensed under the EPL? > > It is.  The question was about licensing issues when bu

Re: On using GPL libs in Clojure

2009-10-11 Thread Tassilo Horn
Miron Brezuleanu writes: Hi Miron, > This thread is getting confusing. The initial question was about > GPL'ed libraries, yet the example used is clojure.jar. Isn't Clojure > licensed under the EPL? It is. The question was about licensing issues when building GPLed stuff using clojure. Bye,

Re: On using GPL libs in Clojure

2009-10-11 Thread Miron Brezuleanu
Hello, This thread is getting confusing. The initial question was about GPL'ed libraries, yet the example used is clojure.jar. Isn't Clojure licensed under the EPL? What am I missing? Why the GPL talk about clojure.jar? Why ask the FSF about clojure.jar licensing issues if the Clojure web site c

Re: Odd ns metadata compile error

2009-10-11 Thread Robert Stehwien
On Sun, Oct 11, 2009 at 8:49 AM, John Harrop wrote: > It's attempting to attach the metadata to the next following expression. In > this case all it finds is a close paren. > => (list #^{:foo 'bar} 'sym) > (sym) > => (list #^{:foo 'bar}) > # > > I'm not sure how to attach metadata to a namespace,

Re: Odd ns metadata compile error

2009-10-11 Thread John Harrop
It's attempting to attach the metadata to the next following expression. In this case all it finds is a close paren. => (list #^{:foo 'bar} 'sym) (sym) => (list #^{:foo 'bar}) # I'm not sure how to attach metadata to a namespace, but I'd try putting the metadata before the (ns ...) form instead of

Re: Why JVM (and not .NET) is the "primary" platform for Clojure?

2009-10-11 Thread Kelvin Pompey
Here's another URL. http://www.computerworld.com/s/article/9136528/The_A_Z_of_Programming_Languages_Clojure?taxonomyId=11 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send em

Re: Odd ns metadata compile error

2009-10-11 Thread Robert Stehwien
> > Metadata goes before the symbol, not after it. So: > > > (ns com.arcanearcade.clojure.utils.regex-utils > > #^{:author "Robert Stehwien", > > :doc "Clojure regular expression utilities"} > > (:require [clojure.contrib.java-utils :as ju])) > > Is actually putting the metadata on the (:r

Re: Odd ns metadata compile error

2009-10-11 Thread James Reeves
On Oct 11, 1:59 pm, Robert Stehwien wrote: > Using clojure 1.1.0-alpha-SNAPSHOT I get an unexpected error when compiling > a ns with metadata but nothing else.  The same metadata with a require or > use form works.  Should I be using something else or is this an actual bug? Metadata goes before

Re: Why JVM (and not .NET) is the "primary" platform for Clojure?

2009-10-11 Thread Michael Wood
2009/10/11 Michael Wood : > 2009/10/11 Florian Weimer : >> >> * Kelvin Pompey: >> >>> The following is an interview with Rich Hickey where he answers your >>> question. >>> http://www.computerworld.com.au/article/313989/-z_programming_languages_clojure?rid=-301 >> >> Have you got another URL for t

Re: Why JVM (and not .NET) is the "primary" platform for Clojure?

2009-10-11 Thread Michael Wood
2009/10/11 Florian Weimer : > > * Kelvin Pompey: > >> The following is an interview with Rich Hickey where he answers your >> question. >> http://www.computerworld.com.au/article/313989/-z_programming_languages_clojure?rid=-301 > > Have you got another URL for this article?  It seems that IDG forg

Odd ns metadata compile error

2009-10-11 Thread Robert Stehwien
Using clojure 1.1.0-alpha-SNAPSHOT I get an unexpected error when compiling a ns with metadata but nothing else. The same metadata with a require or use form works. Should I be using something else or is this an actual bug? This ns compiles: - (ns com.arcanearcade.clojure.utils.regex-utils

Re: Why JVM (and not .NET) is the "primary" platform for Clojure?

2009-10-11 Thread Konrad Hinsen
On 11 Oct 2009, at 09:56, Florian Weimer wrote: > * Kelvin Pompey: > >> The following is an interview with Rich Hickey where he answers your >> question. >> http://www.computerworld.com.au/article/313989/-z_programming_languages_clojure?rid=-301 > > Have you got another URL for this article? It

Clojure persistent immutable priority queue and jobs.

2009-10-11 Thread John Harrop
I've implemented a Clojure persistent, immutable priority queue data structure (built on a heap, in turn built on a Clojure vector). The namespace below exports the heap operations as well as the priority queue operations in case that's useful. These operations return a new data structure instead o

Re: On using GPL libs in Clojure

2009-10-11 Thread tfgordon
> It still holds.  And telling your users to download the clojure.jar > doesn't change anything.  The problem is not distributing something with > a GPL-incompatible license, but that simply using clojure and the > stdlibs makes it a derivated work.  (I was in the same situation like > you and dr

Re: Why JVM (and not .NET) is the "primary" platform for Clojure?

2009-10-11 Thread Florian Weimer
* Kelvin Pompey: > The following is an interview with Rich Hickey where he answers your > question. > http://www.computerworld.com.au/article/313989/-z_programming_languages_clojure?rid=-301 Have you got another URL for this article? It seems that IDG forgot to renew idg.net.au (it's currently