[ANN] clj-peg is dead

2010-08-16 Thread Richard Lyman
Since Amotoen does everything that clj-peg did, and since Amotoen does it in a more maintainable way... http://github.com/richard-lyman/amotoen -Rich -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@google

Re: A useful function?

2010-08-16 Thread Sean Devlin
This comes up on the list every few months. In Clojure, this is a code smell that you should be using the destructuring constructs instead. On Aug 16, 3:31 am, Alan wrote: > (defn apply-keys [f ks] >   (zipmap ks (map f ks))) > > Trivial to write, but it can be quite useful. For example: > (defn

Re: async http client in clojure

2010-08-16 Thread Jeff Rose
You might be interested in this library: http://github.com/neotyk/ahc-clj It's a clojure layer on top of some nice Java libs for doing asynchronous HTTP. -Jeff On Aug 16, 11:12 pm, leo wrote: > I am trying to understand how efficient it would be to use Clojure to > develop an asynchronous http

[ANN] Amotoen

2010-08-16 Thread Richard Lyman
First: http://github.com/richard-lyman/amotoen Second: Amotoen is a Clojure library that supports PEG style definitions of grammars that can produce parsers. While there are academic papers available that rigorously define PEG, I've found that PEGs, or Parsing Expression Grammar(s), are best exp

Re: Identifying error-kit Throwables

2010-08-16 Thread Brian Marick
On Aug 16, 2010, at 10:56 AM, Chouser wrote: > If you *are* actually using continue or continue-with, I'd be very > interested to know your actual use cases. I thought I did, but as I wrote up the use case, I think I've convinced myself I was wrong. I'll let you know if I change my mind again.

async http client in clojure

2010-08-16 Thread leo
I am trying to understand how efficient it would be to use Clojure to develop an asynchronous http client for my webapp instead of using Java. Is there any specific way one can be better than the other? -- You received this message because you are subscribed to the Google Groups "Clojure" group.

Re: Exception when trying to require clojure.contrib.io

2010-08-16 Thread Luka Stojanovic
Actually, it started working with require, and as far as I'm concerned, I've done nothing to fix the problem. On Mon, 16 Aug 2010 20:06:32 +0200, Luka Stojanovic wrote: I have same problem: I'm using NetBeans 6.9.1/Enclojure, clojure-SNAPSHOT, running on Ubuntu 10.04 If I create Cloj

Re: Argument order / Documentation Mismatch

2010-08-16 Thread Btsai
No worries :) On Aug 16, 12:55 pm, Timothy Washington wrote: > Ahh, my bad. > > Cheers > Tim > > > > On Sun, Aug 15, 2010 at 8:40 PM, Btsai wrote: > > I think the mismatch is because page you looked at is for > > clojure.string, not clojure-contrib.string.  The documentation for the > > split fr

Re: Trouble upgrading to clojure 1.2

2010-08-16 Thread Alan
Ah, that's all it was. I thought it was available after I saw someone suggest using clojure 1.2. After changing to use RC3, swank (especially swank.core/break) works beautifully. Thanks! On Aug 16, 11:23 am, Saul Hazledine wrote: > Aug 16, 8:03 pm, Alan wrote: > > > > > $ cat project.clj > > (de

Re: A useful function?

2010-08-16 Thread wwmorgan
Sorry for the double-post. group-by actually maps outputs to inputs. But you can run into trouble even with referentially transparent functions, because of Clojure's equality semantics: user=> (def x [(list :a) (vector :a)]) #'user/x user=> (zipmap x (map class x)) {(:a) clojure.lang.PersistentVec

Re: A useful function?

2010-08-16 Thread wwmorgan
Note that if f is not referentially transparent, you can get different results depending on the order in which the collection is traversed, for unordered collections. See the API function group-by. It makes this behavior explicit by mapping each input argument to a vector of output arguments, in th

a more general chunk-file

2010-08-16 Thread cej38
Hello, I work with text files that are, at times, too large to read in all at one time. In searching for a way to read in only part of the file I came across http://meshy.org/2009/12/13/widefinder-2-with-clojure.html I am only interested in the chunk-file and read-lines-range functions. My pro

Re: multiline strings and multiline comments ?

2010-08-16 Thread Lee Spector
On Aug 16, 2010, at 4:13 PM, Meikel Brandmeyer wrote: > Every descent editor should provide a comment-selected-text functionality. So > whether multiline comments or single comments are used should be an > implementation detail. You also have to get (* *) (OCaml) nested and with /* > */ (C) you

Re: What is reference?

2010-08-16 Thread Daniel Gagnon
On Mon, Aug 16, 2010 at 11:54 AM, HB wrote: > Excellent explanation, thanks Nicolas :) > Are Refs unique to Clojure or they exist in all Lisps? > > They are a big part of why Clojure was created in the first place. -- You received this message because you are subscribed to the Google Groups "Cl

Re: multiline strings and multiline comments ?

2010-08-16 Thread Meikel Brandmeyer
Hi, Am 16.08.2010 um 21:13 schrieb Lee Spector: > I'm finding that ;, #_, and (comment ...) generally suffice but every once in > a while I do miss having block comments (like /* ... */, or Common Lisp's #| > ... |#), e.g. when I want to comment out a big chunk of partially-written > code that

Re: multiline strings and multiline comments ?

2010-08-16 Thread B Smith-Mannschott
On Mon, Aug 16, 2010 at 18:26, Andrew Gwozdziewycz wrote: > On Mon, Aug 16, 2010 at 3:34 AM, faenvie wrote: >> hi clojure-users, >> >> i wonder what the reason is, that clojure(-reader) >> does not allow >> >> 1. multiline-strings like scala: >> >>  """this is a >>   | multiline string""" > > Yes

Re: multiline strings and multiline comments ?

2010-08-16 Thread Lee Spector
On Aug 16, 2010, at 10:02 AM, Grayswx wrote: > For comments, there's (comment This is a comment ...). I'd say that > eliminates the need for /* ... */. Except that with (comment ...) the stuff in ... has to have balanced parentheses (& possibly meet other constraints since it's being parsed?).

Re: Argument order / Documentation Mismatch

2010-08-16 Thread Timothy Washington
Ahh, my bad. Cheers Tim On Sun, Aug 15, 2010 at 8:40 PM, Btsai wrote: > I think the mismatch is because page you looked at is for > clojure.string, not clojure-contrib.string. The documentation for the > split from clojure-contrib.string is here: > > > http://clojure.github.com/clojure-contri

Re: Trouble upgrading to clojure 1.2

2010-08-16 Thread Rasmus Svensson
2010/8/16 Alan : > I hear that swank.core/break has more functionality in 1.2, so I am > trying to upgrade to it, but I think I don't have a clear enough > understanding of what is going on when lein/clojure run, as I am > running into problems. > > $ cat project.clj > (defproject ddsolve "1.0.0-SN

Re: Trouble upgrading to clojure 1.2

2010-08-16 Thread Saul Hazledine
Aug 16, 8:03 pm, Alan wrote: > > $ cat project.clj > (defproject ddsolve "1.0.0-SNAPSHOT" >   :description "FIXME: write" >   :dependencies [[org.clojure/clojure "1.2.0"] >                  [org.clojure/clojure-contrib "1.2.0"]] >   :dev-dependencies [[swank-clojure "1.2.0"]]) You're doing everyt

Re: Exception when trying to require clojure.contrib.io

2010-08-16 Thread Luka Stojanovic
I have same problem: I'm using NetBeans 6.9.1/Enclojure, clojure-SNAPSHOT, running on Ubuntu 10.04 If I create Clojure project everything works OK. If I add Clojure scripts in existing Java project (and copy appropriate parts of pom.xml into that project) :require causes error as above, b

Trouble upgrading to clojure 1.2

2010-08-16 Thread Alan
I hear that swank.core/break has more functionality in 1.2, so I am trying to upgrade to it, but I think I don't have a clear enough understanding of what is going on when lein/clojure run, as I am running into problems. $ cat project.clj (defproject ddsolve "1.0.0-SNAPSHOT" :description "FIXME:

Re: What is reference?

2010-08-16 Thread nickikt
Why don't you get yourself help from Rich himself: Clojure Concurrency http://clojure.blip.tv/file/812787/ here are the slides, the video doesn't show them: http://clojure.googlegroups.com/web/ClojureConcurrencyTalk.pdf There are other great talks here: http://clojure.blip.tv/ -- You received

Re: multiline strings and multiline comments ?

2010-08-16 Thread Andrew Gwozdziewycz
On Mon, Aug 16, 2010 at 3:34 AM, faenvie wrote: > hi clojure-users, > > i wonder what the reason is, that clojure(-reader) > does not allow > > 1. multiline-strings like scala: > >  """this is a >   | multiline string""" Yes. It does, if you plug this into your repl ( user=> (use '[clojure.contr

Re: ANN: Emacs auto-complete plugin for slime users

2010-08-16 Thread sponge bob
On 15 авг, 23:18, Steve Purcell wrote: > > Could you share your nice color theme, please? > > Sure: > > http://github.com/purcell/emacs.d/blob/master/site-lisp/color-theme-s... > > There are light and dark versions, and I switch between them with "M-x light" > and "M-x dark" depending on how my

Re: A useful function?

2010-08-16 Thread Chang Min Jeon
hello alan. This link may help you. http://richhickey.github.com/clojure-contrib/index.html BR ChangMin Jeon On Mon, Aug 16, 2010 at 4:31 PM, Alan wrote: > (defn apply-keys [f ks] > (zipmap ks (map f ks))) > > Trivial to write, but it can be quite useful. For example: > (defn whatever [arg] >

Re: multiline strings and multiline comments ?

2010-08-16 Thread Grayswx
For comments, there's (comment This is a comment ...). I'd say that eliminates the need for /* ... */. On Aug 16, 3:34 am, faenvie wrote: > hi clojure-users, > > i wonder what the reason is, that clojure(-reader) > does not allow > > 1. multiline-strings like scala: > >  """this is a >    | mult

Re: multiline strings and multiline comments ?

2010-08-16 Thread Luka Stojanovic
/* this is a multiline comment */ (comment This is a multiline comment?) -- 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 - p

Re: RFC: New Clojure launcher

2010-08-16 Thread mac
Correction: you will need the jdk on windows when using the 32 bit build because the server jvm does not come with the 32 bit jre. Perhaps I should just make it prefer the server jvm, not require it. On Aug 15, 6:12 pm, mac wrote: > On Aug 15, 6:02 pm, Wilson MacGyver wrote:> This still > requi

Re: multiline strings and multiline comments ?

2010-08-16 Thread B Smith-Mannschott
On Mon, Aug 16, 2010 at 16:48, Rasmus Svensson wrote: > 2010/8/16 Rasmus Svensson : 2. multiline comments like java /* this is a   multiline comment */ >>> >>> I don't know. >>> >> >> Comment blocks are usually done by starting each line with ;; >> >> ;; this is >> ;; a comment

Re: What is reference?

2010-08-16 Thread Nicolas Oury
In Common LISP, you can modify anything, anywhere. In the ML family of language, there are refs, but, if they have the same name, they do not share the concept. They are closer of Clojure's atoms. There is no notion of transactions. Haskell and a few other languages have Software Transactional M

Re: Identifying error-kit Throwables

2010-08-16 Thread Chouser
On Mon, Aug 16, 2010 at 10:37 AM, Meikel Brandmeyer wrote: > On 15 Aug., 23:41, Brian Marick wrote: > >> I have a need to catch and handle all Java Throwables except those used by >> c.c.error-kit. I can identify an error-kit throwable like this: >> >>   (re-find #"^Error Kit Control Exception"

Re: What is reference?

2010-08-16 Thread HB
Excellent explanation, thanks Nicolas :) Are Refs unique to Clojure or they exist in all Lisps? On Aug 16, 10:22 am, Nicolas Oury wrote: > It's a clever box containing a value. > You can open the box and read the current value. > But you can't modify the content of the box directly. > > You need

Re: A useful function?

2010-08-16 Thread Saul Hazledine
On Aug 16, 8:31 am, Alan wrote: > (defn apply-keys [f ks] >   (zipmap ks (map f ks))) > > Does this seem useful to anyone else? It seems very similar to memoize in that you're mapping function arguments to their results. Saul -- You received this message because you are subscribed to the Googl

Re: Flex as a Clojure Frontend

2010-08-16 Thread Richard Lyman
On Sun, Aug 15, 2010 at 9:13 PM, nchubrich wrote: > Thanks Rich--I'm actually interested in all kinds of configurations. > For the time being, it will be a Flex frontend in the browser > communicating with Clojure on the server.  In the future, we might > want to make the Clojure part into a Java

Re: multiline strings and multiline comments ?

2010-08-16 Thread B Smith-Mannschott
On Mon, Aug 16, 2010 at 16:33, Rasmus Svensson wrote: >>> 2. multiline comments like java >>> >>> /* this is a >>>   multiline comment */ >> >> I don't know. >> > > Comment blocks are usually done by starting each line with ;; > > ;; this is > ;; a comment > ;; block > (some-code) > > Anything aft

Re: multiline strings and multiline comments ?

2010-08-16 Thread Rasmus Svensson
2010/8/16 Rasmus Svensson : >>> 2. multiline comments like java >>> >>> /* this is a >>>   multiline comment */ >> >> I don't know. >> > > Comment blocks are usually done by starting each line with ;; > > ;; this is > ;; a comment > ;; block > (some-code) > > Anything after a ; is a comment, like p

Re: Identifying error-kit Throwables

2010-08-16 Thread Meikel Brandmeyer
Hi, On 15 Aug., 23:41, Brian Marick wrote: > I have a need to catch and handle all Java Throwables except those used by > c.c.error-kit. I can identify an error-kit throwable like this: > >   (re-find #"^Error Kit Control Exception" (.toString e))) > > That does not fill me with joy. What's the

Re: multiline strings and multiline comments ?

2010-08-16 Thread Rasmus Svensson
>> 2. multiline comments like java >> >> /* this is a >>   multiline comment */ > > I don't know. > Comment blocks are usually done by starting each line with ;; ;; this is ;; a comment ;; block (some-code) Anything after a ; is a comment, like python's #. There is a convention for how many ;s t

Re: multiline strings and multiline comments ?

2010-08-16 Thread Michael Wood
On 16 August 2010 09:34, faenvie wrote: > hi clojure-users, > > i wonder what the reason is, that clojure(-reader) > does not allow > > 1. multiline-strings like scala: > >  """this is a >   | multiline string""" user=> (def s "This is a multiline string") #'user/s user=> s "This is a\nmultiline

Re: Game development in Clojure

2010-08-16 Thread Nicolas Oury
> Sadly I feel that I'm going to have to target development at the > lowest common > denominator that I think users will have (hence I'm targeting Java > 1.5+) > Escape Analysis and GC tweeking does not need to change your code. It is activated by option to the JVM. It would be interesting to try

Re: Protocols and default method implementations

2010-08-16 Thread Nicolas Oury
On Mon, Aug 16, 2010 at 3:29 AM, Matthew Phillips wrote: > ;; Now, if I want any node's in-edges, I can't just call "in-edges" > ;; because Node implementations won't have it, so I compute them in > ;; that case. > (defn node-in-edges [n] >  (if (isa? Node2) >    (in-edges n) >    (compute-node-in

Re: Game development in Clojure

2010-08-16 Thread Mike Anderson
On Aug 13, 5:33 pm, Alan wrote: > Funny you should mention this - I was about to post a question about > my own game when I saw your article. My issue is, I assume someone has > written minimax and/or alpha-beta pruning in Clojure (or a java > library that's easy to interop with). My case is sligh

Re: Swank Break Issues.

2010-08-16 Thread Ivan Willig
Thanks, That worked. Ivan Willig 818-212-4554 On Sun, Aug 15, 2010 at 11:56 AM, George Jahad wrote: > try using clojure 1.2. > > On Aug 14, 11:56 am, Ivan Willig wrote: > > Hi list, > > I am trying to use swank.core/break while bugging. The break point gets > > thrown but none of my local var

Re: AOT compilation and calling Clojure from Java

2010-08-16 Thread sebastien
Yes, it helped! Thank you! To make the story complete I put here complete code: semantic/hello.clj: (ns semantic.hello (:gen-class :name semantic.hello :methods [[sayhello [] void] [sayhello_arg [String] void]])) (defn -sayhello [this] (println "Hello from Clojure!"))

Re: Game development in Clojure

2010-08-16 Thread Mike Anderson
On Aug 13, 7:16 pm, Nicolas Oury wrote: > On Fri, Aug 13, 2010 at 2:51 PM, Mike Anderson > > wrote: > > 2. It would be great to reduce the amount of memory allocations. Yes, > > I know memory is plentiful and GC is very cheap, but it's still not as > > cheap as stack allocation and any noticeable

Re: Game development in Clojure

2010-08-16 Thread Adam Burry
On Aug 14, 2:39 am, Eric Lavigne wrote: > I discussed two problems. The first problem, which you addressed, was > mostly just a warm-up for discussing a related problem that is more > severe. Where can I put (def g) so that two files can "require" each > other? I would say this is not a clojure s

Re: Game development in Clojure

2010-08-16 Thread Mike Anderson
On Aug 14, 12:38 am, BerlinBrown wrote: > I played it, it was pretty fun. > > I have UI recommendations. I couldn't tell the difference between the > enemy and my units. > > I wish maybe you had some quick tips and recommended next actions so I > could get used to how the game works. Thanks! Gre

Re: Game development in Clojure

2010-08-16 Thread Mike Anderson
On Aug 14, 6:37 am, Wilson MacGyver wrote: > I realize that. I was pondering why I don't run into the the 2nd problem. > > In your code, how many files/name spaces are you creating? > And how many lines of code are in each file? I'm curious how you > organize your code. Sure - I'll give a quick s

Re: Game development in Clojure

2010-08-16 Thread Mike Anderson
On Aug 13, 7:06 pm, Brian Carper wrote: > Looks great.  Thanks for sharing your experiences. > > Do you plan to share the source code?  Any reason you went with Swing > instead of OpenGL? > Main reason I went with Swing was wanting to get something up and running quickly (this is my first Clojur

multiline strings and multiline comments ?

2010-08-16 Thread faenvie
hi clojure-users, i wonder what the reason is, that clojure(-reader) does not allow 1. multiline-strings like scala: """this is a | multiline string""" 2. multiline comments like java /* this is a multiline comment */ someone who can explain or point to relevant info ? thanks -- You

A useful function?

2010-08-16 Thread Alan
(defn apply-keys [f ks] (zipmap ks (map f ks))) Trivial to write, but it can be quite useful. For example: (defn whatever [arg] (let [some-list (make-list-from arg) mapped (map myfunc some-list)] (zipmap some-list mapped))) compared to (defn whatever [arg] (apply-keys myfunc (m

Re: Flex as a Clojure Frontend

2010-08-16 Thread nchubrich
Thanks Rich--I'm actually interested in all kinds of configurations. For the time being, it will be a Flex frontend in the browser communicating with Clojure on the server. In the future, we might want to make the Clojure part into a Java applet that runs on the client side and does computations w

Re: Protocols and default method implementations

2010-08-16 Thread Matthew Phillips
Yes, Haskell type classes are the sort of thing I have in mind here I think. On a type class you can specify default implementations of any or all of the functions, and they can even refer to themselves cyclically (e.g the Eq class where == and /= are defined as each other's complements): the insta

ANN: August London Clojure Dojo

2010-08-16 Thread Bruce Durling
Hi, The latest London Clojure Dojo will be at our usual venue, Thoughworks on High Holborn on 31 August. Free beer and pizza will be supplied by Thoughtworks. We'll supply our own code. We happily welcome everyone from the confused through to the expert. Come along and code with us. The sign up

Re: Protocols and default method implementations

2010-08-16 Thread Matthew Phillips
Thanks to all of you who responded. So, I think my original thesis was correct: I'm clearly misconstruing something quite fundamental here ;) And I can see now my original example was clumsy: for example something like PrettyPrintable *should* be an orthogonal protocol to Node. (Not to mention th

Re: Argument order / Documentation Mismatch

2010-08-16 Thread Btsai
I think the mismatch is because page you looked at is for clojure.string, not clojure-contrib.string. The documentation for the split from clojure-contrib.string is here: http://clojure.github.com/clojure-contrib/string-api.html#clojure.contrib.string/split On Aug 15, 5:12 pm, Timothy Washington

Identifying error-kit Throwables

2010-08-16 Thread Brian Marick
I have a need to catch and handle all Java Throwables except those used by c.c.error-kit. I can identify an error-kit throwable like this: (re-find #"^Error Kit Control Exception" (.toString e))) That does not fill me with joy. What's the right way to do it? - Brian Marick, independent co

Re: AOT compilation and calling Clojure from Java

2010-08-16 Thread Wilson MacGyver
you'd import semantic.hello then in your java code, you would first create it by doing new semantic.hello() then you can call it form java by doing .sayhello() without the - you also need to define your sayhello differently I think. it needs to be (defn -sayhello [this] (println "Hello from cl

Re: Game development in Clojure

2010-08-16 Thread Martin DeMello
On Mon, Aug 16, 2010 at 3:37 PM, Nicolas Oury wrote: > On Mon, Aug 16, 2010 at 10:51 AM, Martin DeMello > wrote: >> Sometimes there's simply no way around it. For instance, I recently >> had some python code that (stripped to its simplest form) had two >> classes, Document and Attachment, where A

Re: Game development in Clojure

2010-08-16 Thread Nicolas Oury
On Mon, Aug 16, 2010 at 10:51 AM, Martin DeMello wrote: > Sometimes there's simply no way around it. For instance, I recently > had some python code that (stripped to its simplest form) had two > classes, Document and Attachment, where Attachment was a specialised > subclass of Document, but Docum

Re: Game development in Clojure

2010-08-16 Thread Martin DeMello
On Sun, Aug 15, 2010 at 8:13 PM, Brian Hurt wrote: > > Circular dependencies between modules is a major code smell.  Code where > everything depends upon everything, or even close to that, is > unmaintainable. Sometimes there's simply no way around it. For instance, I recently had some python cod

Re: What is reference?

2010-08-16 Thread Nicolas Oury
It's a clever box containing a value. You can open the box and read the current value. But you can't modify the content of the box directly. You need to change the value in a box in a transaction. The cleverness of refs comes form the fact that all read and all write in a transaction are consisten