Re: Clojure Scoping Rules

2009-11-23 Thread Garth Sheldon-Coulson
Hi Mark, In Clojuratica I make what I think is "good, clean, compelling use" of dynamic vars. I rewrote the code to use dynamic vars after I found that doing it the other way became unwieldy and inelegant. To simplify a little, the API consists of just one main function, let's call it math-evalua

Re: Clojure User Survey, preparation for 1.1

2009-11-23 Thread David Brown
On Mon, Nov 23, 2009 at 09:55:46PM +, the.stuart.sie...@gmail.com wrote: Since the form only lets me answer one answer for each, but reality is much more complicated. >How do you get Clojure? * > >Download release >Github >Maven or Ivy I primarily use the latest development snapshot that I p

Re: Clojure Scoping Rules

2009-11-23 Thread Mark Engelberg
Meikel's blog post quotes: "running into a lot of such trouble is a sign, that you misuse dynamic variables. Use them wisely." I'd like to see examples of what you think is a good, clean, compelling use of dynamic variables that are properly used wisely. My own experience is that if the code is s

Re: Datatypes and Protocols - early experience program

2009-11-23 Thread Krukow
On Nov 24, 4:55 am, Allen Rohner wrote: > The first stumbling point I reached is that deftypes provide an > automatic implementation for IPersistentMap, but not IFn. I attempted > to write (instance key), which exploded, but (key instance) works just > fine. My existing code uses (instance key)

Re: roll call of production use?

2009-11-23 Thread John Harrop
On Mon, Nov 23, 2009 at 9:47 PM, Richard Newman wrote: > 1- We have this license server, used to control the use of a >> professional software (this one written using delphi). > > > What are the ethics of using an open source product like Clojure to > implement DRM restrictions for some other pro

Re: roll call of production use?

2009-11-23 Thread mbrodersen
I use an internal DSL (Domain Specific Language) in Clojure to generate C++ and C# code. Cheers Morten On Nov 24, 10:00 am, Raoul Duke wrote: > hi, > > i'd be interested to hear who has successfully used clojure in > production. i know of some, as some folks have been vocal; any other > interes

Re: Datatypes and Protocols - early experience program

2009-11-23 Thread Allen Rohner
On Nov 12, 6:10 am, Rich Hickey wrote: > An early version of the code for a few important new language > features, datatypes[1] and protocols[2] is now available in the 'new' > branch[3]. Note also that the build system[4] has builds of the new > branch, and that the new branch works with curren

Re: roll call of production use?

2009-11-23 Thread Phlex
> 1- We have this license server, used to control the use of a > professional software (this one written using delphi). > > > What are the ethics of using an open source product like Clojure to > implement DRM restrictions for some other product? Seems there might > be something a bit if

Re: roll call of production use?

2009-11-23 Thread Richard Newman
> 1- We have this license server, used to control the use of a > professional software (this one written using delphi). > > What are the ethics of using an open source product like Clojure to > implement DRM restrictions for some other product? Seems there might > be something a bit iffy there

Re: roll call of production use?

2009-11-23 Thread John Harrop
On Mon, Nov 23, 2009 at 8:35 PM, Phlex wrote: > > > i'd be interested to hear who has successfully used clojure in > > production. > > Hello, > > 1- We have this license server, used to control the use of a > professional software (this one written using delphi). What are the ethics of using an

Re: PersistentStructMap Exception

2009-11-23 Thread songoku
> user=> (defstruct s1 :a :b) > #'user/s1 > user=> (s1 1 2) (struct s1 1 2) or (struct-map s1 :a 1 :b 2) --> {:a 1, :b 2} or: (struct s1 1) --> {:a 1, :b nil} (struct-map s1 :b 2) --> {:a nil, :b 2} -- You received this message because you are subscribed to the Google Groups "Clojure" group.

Re: Clojure User Survey, preparation for 1.1

2009-11-23 Thread Bill Allen
Stuart, I think there's another valid option for "getting" clojure. I got it by installing the unfortunately titled "Emacs Starter Kit" from http://github.com/technomancy/emacs-starter-kit. I has an install clojure option that does most of the work of installing clojure, clojure-contrib and setting

Re: roll call of production use?

2009-11-23 Thread Phlex
> i'd be interested to hear who has successfully used clojure in > production. Hello, 1- We have this license server, used to control the use of a professional software (this one written using delphi). This was tested with thousands of simutaneous connections, and has been working with no hicc

Annotations on the new deftype?

2009-11-23 Thread Mark Derricutt
With all the newly added/being worked on defprotocol/deftype features - I've not seen anyone mention JDK annotations being part of things, is support for annotations being worked on as part of this? Would be a -very- handy addition, esp. as more and more JVM libraries/tools are looking for them.

Re: Monad problems: finding an m-zero

2009-11-23 Thread jim
Konrad, Glad to see you're still around doing monads in Clojure. :) 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

Re: roll call of production use?

2009-11-23 Thread Wojciech Kaczmarek
On Tue, Nov 24, 2009 at 00:00, Raoul Duke wrote: > hi, > > i'd be interested to hear who has successfully used clojure in > production. i know of some, as some folks have been vocal; any other > interesting-but-so-far-silent uses people'd be willing to fess up > about? > > many thanks. I use Cloj

Re: Clojure Scoping Rules

2009-11-23 Thread André Ferreira
Would it be possible to create an implementation of delay and lazy-seq that didn't use fn to delay evaluation, or atleast captured dynamic variables? (delay (+ x 3)) reasonable semantics in current clojure (let [x x] (delay (+ x 3))) (delay (fn [y] (+ x y))) semantics should be the same it alread

Re: leiningen - a Clojure build tool

2009-11-23 Thread Alex Osborne
Krukow writes: > On Nov 18, 8:29 am, Phil Hagelberg wrote: >> I'm pleased to announce the initial release of Leiningen. >> >> Leiningen is a build tool for Clojure designed to not set your hair on fire. > > I really like it so far - particularly the combination of lein and > clojars! > > I'm not

Re: roll call of production use?

2009-11-23 Thread David Brown
On Mon, Nov 23, 2009 at 03:00:16PM -0800, Raoul Duke wrote: >i'd be interested to hear who has successfully used clojure in >production. i know of some, as some folks have been vocal; any other >interesting-but-so-far-silent uses people'd be willing to fess up >about? I've thrown together a small

roll call of production use?

2009-11-23 Thread Raoul Duke
hi, i'd be interested to hear who has successfully used clojure in production. i know of some, as some folks have been vocal; any other interesting-but-so-far-silent uses people'd be willing to fess up about? many thanks. -- You received this message because you are subscribed to the Google Gro

Re: Deep deref

2009-11-23 Thread John Harrop
On Mon, Nov 23, 2009 at 4:34 PM, Sergey Didenko wrote: > Hi, > > Andre, Danny's first approach is about "syncing" only on the root > object, so that every piece of data is behind one deref: > > (def root (ref {:persons [ ... no other refs here... ])) > > This approach is simpler to code but can le

Re: Deep deref

2009-11-23 Thread Wojciech Kaczmarek
On Mon, Nov 23, 2009 at 22:46, Sergey Didenko wrote: > BTW I'm also coding the simple persistence for Clojure data > structures. Though I took Prevayler approach (http://prevayler.org), > so I journal function calls that change my root object. > > This approach is better than simple snapshotting w

Re: Deep deref

2009-11-23 Thread Sergey Didenko
BTW I'm also coding the simple persistence for Clojure data structures. Though I took Prevayler approach (http://prevayler.org), so I journal function calls that change my root object. This approach is better than simple snapshotting when your data grows big, so you can't do the snapshots very oft

Re: Clojure Scoping Rules

2009-11-23 Thread Meikel Brandmeyer
Chris, Graham, Am 23.11.2009 um 21:21 schrieb Graham Fawcett: Very nice. A generalized version might be more useful to your readers: take an input seq, and return an output seq which is evaluated stepwise in the binding environment. Thank you for your good comments. I updated the post with a

Re: Deep deref

2009-11-23 Thread Sergey Didenko
Hi, Andre, Danny's first approach is about "syncing" only on the root object, so that every piece of data is behind one deref: (def root (ref {:persons [ ... no other refs here... ])) This approach is simpler to code but can lead to a lot of retried transactions under heavy concurrent load, as I

Clojure User Survey, preparation for 1.1

2009-11-23 Thread the . stuart . sierra
If you have trouble viewing or submitting this form, you can fill it out online: http://spreadsheets.google.com/viewform?formkey=dFJSd1p4YXh0d0VxV0xjdk42MTU5RkE6MA Clojure User Survey This user survey will help move Clojure toward an official 1.1 release. How do you get Clojure? * Download

Re: Feedback for a visitor closure generator

2009-11-23 Thread John Harrop
On Mon, Nov 23, 2009 at 2:26 PM, Sean Devlin wrote: > * Back to Multimethods * > > The power of the individual closures can be amplified when wrapped in > a multimethod. Consider our String/Symbol/Keyword group. > > (defmulti visit-string (fn [& args] (second args)) > > (defmethod visit-string cl

Re: "Oh, yeah, transients are fast!"

2009-11-23 Thread Raoul Duke
i have tried: 1.5 1.6 1.6 -server the last i did both in repl-in-emacs, and in a repl-in-straightup-shell. the numbers i get are weird. it does seem like v2 is faster than v, but never gets stupendously fast (never faster than 500 msec on a dual core macbook pro 2.2ghz core 2 duo 4gb ram), and v

Re: Monad problems: finding an m-zero

2009-11-23 Thread Konrad Hinsen
On 22 Nov 2009, at 22:10, John Harrop wrote: > Is there an explanation of monads out there that doesn't require the > reader to know Haskell to understand it? One that's generic to any > FP-capable language? Nothing I know of; you need some syntax if only for the examples. Moreover, there a

Re: Monad problems: finding an m-zero

2009-11-23 Thread Konrad Hinsen
On 22 Nov 2009, at 22:06, samppi wrote: > Yes, I see. I'm going to guess that the parser-m that I give above has > no possible m-zero, so I think I'll have to rethink how I'm going to > approach this problem. I probably am going to just define failure in > another way. (The reason why I can't use

The specificity of bound-fn: capturing specific dynamic vars

2009-11-23 Thread Garth Sheldon-Coulson
Meikel and All, On the general topic of the recent posts on the "Clojure Scoping Rules" thread: bound-fn is very nice, but I've found that capturing *all* dynamic vars is often overkill. In fact, I would argue (subject to persuasion otherwise) that capturing all dynamic vars should be the very r

Re: Clojure Scoping Rules

2009-11-23 Thread Graham Fawcett
On Sat, Nov 21, 2009 at 4:37 PM, Meikel Brandmeyer wrote: > Hi, > > Am 21.11.2009 um 05:22 schrieb Mark Engelberg: > >> Which reminds me, every once in a while I see people talking about >> this here, and brainstorming up some alternatives to binding that >> might interact better with lazy data st

Re: PersistentStructMap Exception

2009-11-23 Thread ataggart
That's not how you create a new struct instance. http://clojure.org/data_structures#toc19 On Nov 23, 6:29 am, cearl wrote: > Hi, > I'm getting a cast exception on trying to create a simple structure > and wondered if there was something obvious that I'm not doing. The > transcript below shows

Re: initialization of clojure.contrib.logging library

2009-11-23 Thread ataggart
The c.c.logging library delegates to an underlying implementation, thus for any configuration help you'll need to check the documentation of the actual logging system, e.g., log4j. On Nov 21, 7:21 am, Alex Ott wrote: > Hello all > > I have one question about logging library from contrib? How i

Re: Mysterious errors w/ protocols and types

2009-11-23 Thread samppi
I see; then that of course would be the reason. Thanks for the answer. On Nov 23, 12:24 pm, Rich Hickey wrote: > On Nov 23, 11:36 am, samppi wrote: > > > > > > > Variable-length arguments in protocols seem to be supported, but > > there's just a weird, stateful behavior. Look what happens when y

Feedback for a visitor closure generator

2009-11-23 Thread Sean Devlin
Multimethods are a great abstraction in Clojure. They are great for adapting a wide variety of inputs to a function. However, I often need to decouple the adaptation of data from the function that operates on the adapted data. Also, after the work is complete, I need to adapt the data back to th

Re: Mysterious errors w/ protocols and types

2009-11-23 Thread Rich Hickey
On Nov 23, 11:36 am, samppi wrote: > Variable-length arguments in protocols seem to be supported, but > there's just a weird, stateful behavior. Look what happens when you > call foo first with one argument twice (it fails both times), then two > arguments (it succeeds), then one argument again

Re: Clojure Scoping Rules

2009-11-23 Thread Meikel Brandmeyer
Hi, On Nov 23, 3:32 pm, nchubrich wrote: > Meikel, is get-thread-bindings only in a development version of > Clojure?  I have 1.09.11 and don't see it documented or usable (or in > the online docs). I'm not sure what 1.09.11 means, but the following commits added push-/ pop-/get-thread-bindings

Re: Clojure Scoping Rules

2009-11-23 Thread Meikel Brandmeyer
Hi, On Nov 23, 3:36 pm, Chouser wrote: > >http://kotka.de/blog/clojure/Taming_the_Bound_Seq.html > > That's excellent Meikel, thanks.  Any reson you didn't use the > with-bindings macro to make your final example a bit simpler? Woops. The reason might be the time of day (23 o'clock after gettin

Re: making rlwrap Clojure friendly

2009-11-23 Thread Sergey Didenko
So simple :) Thanks! On Mon, Nov 23, 2009 at 4:47 PM, Chouser wrote: > The shell script I use to start my Clojure REPLs includes this: > > rlwrap --remember --complete-filenames \ >   --history-filename ~/.clojure/history \ >   --break-chars "\"\\'(){}[],^%$#@;:|" \ >   > -- You received this

PersistentStructMap Exception

2009-11-23 Thread cearl
Hi, I'm getting a cast exception on trying to create a simple structure and wondered if there was something obvious that I'm not doing. The transcript below shows my version of java. Running on Mac Book Pro, Snow Leopard 5.6.1 bash-3.2$ java -version java version "1.6.0_15" Java(TM) SE Runtime En

Re: Clojure & Terracotta - TIM

2009-11-23 Thread Sergey Didenko
Hi Paul, This time I tested it under Linux, following the instructions exactly and it worked. Though when I opened the second REPL it failed with a NullPointerException. I repeated the step and had two REPLs with the same vars. For some reason it failed earlier on Windows, I will try to make it

Re: Mysterious errors w/ protocols and types

2009-11-23 Thread samppi
Variable-length arguments in protocols seem to be supported, but there's just a weird, stateful behavior. Look what happens when you call foo first with one argument twice (it fails both times), then two arguments (it succeeds), then one argument again (it succeeds now too!). Is this a Clojure bug?

Re: Performance tuning for a simple SLE solver

2009-11-23 Thread luskwater
I replaced the calls to get-in with a my-get-in macro that "compiled" them to nested calls on the map or vector: (my-get-in sle [:A 1 2]) => (((sle :A) 1) 2) The form (data key) seems to be about 10 to 15 times faster than the equivalent (get-in data [key]) on my laptop. It cut the runtime

Re: Improving Clojure startup time with -Xbootclasspath

2009-11-23 Thread Armando Blancas
I added the contrib lib expecting it to fail but it worked, and loaded (in half the usual time) some code from the user.clj as well: >java -Xbootclasspath/a:clojure\clojure.jar;clojure-contrib\clojure-contrib.jar >clojure.main Clojure 1.1.0-alpha-SNAPSHOT user=> I had been reading in this paper:

Re: Mysterious errors w/ protocols and types

2009-11-23 Thread Krukow
On Nov 23, 7:36 am, samppi wrote: > The following code contains an error, and I cannot figure out what it > is at all. When I run StateMeta's test once, the statement marked with > a comment above fails. When I run it again, it succeeds. This has been > causing very weird bugs in my code. I've r

Re: making rlwrap Clojure friendly

2009-11-23 Thread Chouser
On Sat, Nov 21, 2009 at 7:30 AM, Sergey Didenko wrote: > Hi, > > has anybody tried to make rlwrap lexer more Clojure friendly? Just > adding "-" to the "word characters" would be a big gain (to enjoy > auto-completion.) > > I spent some time looking through rlwrap sources but has not find a > good

Re: Clojure Scoping Rules

2009-11-23 Thread Chouser
On Sat, Nov 21, 2009 at 4:37 PM, Meikel Brandmeyer wrote: > Hi, > > Am 21.11.2009 um 05:22 schrieb Mark Engelberg: > >> Which reminds me, every once in a while I see people talking about >> this here, and brainstorming up some alternatives to binding that >> might interact better with lazy data st

Re: Clojure Scoping Rules

2009-11-23 Thread nchubrich
Meikel, is get-thread-bindings only in a development version of Clojure? I have 1.09.11 and don't see it documented or usable (or in the online docs). -- 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: Datatypes and Protocols - early experience program

2009-11-23 Thread Krukow
On Nov 12, 1:10 pm, Rich Hickey wrote: > An early version of the code for a few important new language > features, datatypes[1] and protocols[2] is now available in the 'new' > branch[3]. Note also that the build system[4] has builds of the new > branch, and that the new branch works with curren

Re: leiningen - a Clojure build tool

2009-11-23 Thread Krukow
On Nov 18, 8:29 am, Phil Hagelberg wrote: > I'm pleased to announce the initial release of Leiningen. > > Leiningen is a build tool for Clojure designed to not set your hair on fire. I really like it so far - particularly the combination of lein and clojars! I'm not sure if this is the place f

Re: Datatypes and Protocols - early experience program

2009-11-23 Thread Krukow
On Nov 20, 5:24 pm, Rich Hickey wrote: > Yup. The fixed field access to deftypes via keyword literal lookup is > the fastest offered by any Clojure data structure. > > Rich While we are talking performance. Is there a simple way to explain the performance characteristics of protocols versus int

initialization of clojure.contrib.logging library

2009-11-23 Thread Alex Ott
Hello all I have one question about logging library from contrib? How i can configure it to write data into log files? P.S. I'm not Java developer, and may be don't know many of java's logging tricks -- With best wishes, Alex Ott, MBA http://alexott.blogspot.com/http://xtalk.msk.su/~ott

Re: Improving Clojure startup time with -Xbootclasspath

2009-11-23 Thread Meikel Brandmeyer
Hi, On Nov 23, 9:57 am, Dmitry Ulanov wrote: > Very interesting tip! Also, like vimclojure, you can run nailgun > (http://martiansoftware.com/nailgun/background.html) locally or on your > server via ssh. I'd also like to mention clj-server: http://github.com/Neronus/clj-server. Sincerely Meik

Re: Does a standard function exist that acts like assoc except it applies fns to vals

2009-11-23 Thread Meikel Brandmeyer
Hi, Am 22.11.2009 um 22:32 schrieb samppi: (defn vary [coll & keys-and-fns] (let [fn-map (apply arrray-map keys-and-fns) keys-and-vals (mapcat #((val %) (get coll (key %))) fn-map)] (apply assoc-args coll keys-and-vals))) As Jon said: update-in. (-> coll (update-in [:x] fn-x)

Re: Clojure Scoping Rules

2009-11-23 Thread Meikel Brandmeyer
Hi, Am 21.11.2009 um 05:22 schrieb Mark Engelberg: Which reminds me, every once in a while I see people talking about this here, and brainstorming up some alternatives to binding that might interact better with lazy data structures. Has there been any real progress on this, or has every propos

Re: making rlwrap Clojure friendly

2009-11-23 Thread Sergey Didenko
Probably it can be done with Rlwrap filters, I have not tried it yet. On Sat, Nov 21, 2009 at 2:30 PM, Sergey Didenko wrote: > Hi, > > has anybody tried to make rlwrap lexer more Clojure friendly? Just > adding "-" to the "word characters" would be a big gain (to enjoy > auto-completion.) > > I s

making rlwrap Clojure friendly

2009-11-23 Thread Sergey Didenko
Hi, has anybody tried to make rlwrap lexer more Clojure friendly? Just adding "-" to the "word characters" would be a big gain (to enjoy auto-completion.) I spent some time looking through rlwrap sources but has not find a good place to do the changes. Regards, Sergey. -- You received this mes

Re: Datatypes and Protocols - early experience program

2009-11-23 Thread Rich Hickey
On Thu, Nov 19, 2009 at 12:39 PM, Krukow wrote: > On Nov 19, 12:01 am, samppi wrote: >> Question: are the general mechanisms for accessing and setting fields >> their keywords and assoc respectively: >>   (deftype Bar [a b c d e]) >>   (def b (Bar 1 2 3 4 5)) >>   (:c b) >>   (def c (assoc b :e 2

Re: leiningen - a Clojure build tool

2009-11-23 Thread Gilbert
Leiningen and Clojar are LEGEN... wait for it... DARY! Anyways, just wanted to say thanks. On Nov 19, 1:23 pm, Alex Osborne wrote: > meb wrote: > > Was the name Leiningen inspired by the Esquire short story "Leiningen > > vs. Ants"? That would be a brilliantly obscure way to challenge the >

Re: Holding onto your head & step functions -- confusion

2009-11-23 Thread Garth Sheldon-Coulson
Scratch this question. I think I've figured out that the "step" function in some people's code is there for aesthetic reasons only. As long as the step function contains the same code as would otherwise go directly inside the (lazy-seq ... ) there's no difference. That is, (let [step (fn [a b] )

Re: AOT'd namespaces lose their metadata

2009-11-23 Thread Lauri Pesonen
2009/11/23 Phil Hagelberg : > > I noticed an odd bug when working on the help command for leiningen. It > uses docstrings on metadata for help output, but when AOTing the > project, the docstrings (as well as all other metadata) would be > lost. Note that this doesn't happen when metadata is added

Re: Improving Clojure startup time with -Xbootclasspath

2009-11-23 Thread Dmitry Ulanov
Very interesting tip! Also, like vimclojure, you can run nailgun ( http://martiansoftware.com/nailgun/background.html) locally or on your server via ssh. On Mon, Nov 23, 2009 at 5:07 AM, Alex Osborne wrote: > We were discussing Clojure startup time (in the context of Leiningen) > and Phil Hagelb