Re: Namespaced symbols, and errors

2013-03-09 Thread Gary Verhaegen
The reader basically transforms :: into :namespace/, which means that the remaining part must be an unqualified symbol (i.e. no / in it). The character / is not allowed in unqualified symbols. As the documentation [1] says : '/' has special meaning, it can be used once in the middle of a symbol to

Re: Windows Installation

2013-03-09 Thread BJG145
Perhaps this general anti-Windows attitude is what Windows-based newcomers to Clojure find off-putting... On Saturday, March 9, 2013 3:55:59 AM UTC, James Ashley wrote: Since I've seen a few recent posts about this experience, I figured I'd share mine: 0a) Install cygwin. I don't

Re: Windows Installation

2013-03-09 Thread Jonathan Fischer Friberg
My experience: 1. Download lein.bat 2. Run it Jonathan On Sat, Mar 9, 2013 at 10:23 AM, BJG145 benmagicf...@gmail.com wrote: Perhaps this general anti-Windows attitude is what Windows-based newcomers to Clojure find off-putting... On Saturday, March 9, 2013 3:55:59 AM UTC, James Ashley

Re: Namespaced symbols, and errors

2013-03-09 Thread Bronsa
Gary, ::foo/bar is valid syntax if foo is a valid namespace alias. Try: (alias 'foo 'clojure.core) ::foo/bar Il giorno 09/mar/2013 09.36, Gary Verhaegen gary.verhae...@gmail.com ha scritto: The reader basically transforms :: into :namespace/, which means that the remaining part must be an

Re: Windows Installation

2013-03-09 Thread BJG145
As long as you have wget, that works fine. Only problem I've found so far is that lein new app followed by lein check throws an error, but it looks like people are on the case. https://github.com/technomancy/leiningen/issues/863 On Saturday, March 9, 2013 11:24:04 AM UTC, Jonathan Fischer

Model-View-Controller in Clojure?

2013-03-09 Thread edward
So I understand that Clojure's data structures are immutable but I am not clear how that works with MVC. So I have a view that displays a model. Other processes change that model and the View presents those changes. However it's not clear to me how that would work with an immutable model.

Re: Model-View-Controller in Clojure?

2013-03-09 Thread Jim - FooBar();
You need to store your model in a ref-type (atom,agent,or ref), and attach a watcher on it (a fn which is responsible for updating the view). Now, 'mutating' your model will trigger a View update...piece of cake :) example: (def board-history Log of the state of a game. (atom [])) (defn

Re: Model-View-Controller in Clojure?

2013-03-09 Thread Jim - FooBar();
also see this for a discussion about why the need for design patterns almost disappears in Clojure: http://stackoverflow.com/questions/8902113/clojure-model-view-controller-mvc-design Jim On 09/03/13 14:24, Jim - FooBar(); wrote: You need to store your model in a ref-type (atom,agent,or ref),

Re: Namespaced symbols, and errors

2013-03-09 Thread Gary Verhaegen
On 9 March 2013 12:27, Bronsa brobro...@gmail.com wrote: Gary, ::foo/bar is valid syntax if foo is a valid namespace alias. Try: (alias 'foo 'clojure.core) ::foo/bar I did not know that. Is that documented anywhere ? I was under the impression that :: was just intended as a shorthand to

Re: Windows Installation

2013-03-09 Thread Brent Millare
Does anyone see value in a wizard for lein? Does anyone know how to write a wizard, preferably with a scripting language, or xml, rather than c++? And can you alter system variables from within the wizard? On Saturday, March 9, 2013 8:18:44 AM UTC-5, BJG145 wrote: As long as you have wget,

Re: Namespaced symbols, and errors

2013-03-09 Thread nick rothwell
I understand that ::foo is a keyword bound into the local namespace. I also understand (according to the docs) that :my.namespace/foo is the keyword foo in the namespace my.namespace. ::nsalias/foo is the keyword foo in the namespace my.namespace if I've aliased my.namespace to nsalias. But

Re: Windows Installation

2013-03-09 Thread BJG145
...I dunno. As a Windows-addict-newbie, James has a valid point when he says that Windows users expect to be able to just click next a lot, and I don't think that will get you very far with Clojure. The tools like Leiningen are pretty darn good, and not that difficult really. Simple, clear

Re: Windows Installation

2013-03-09 Thread BJG145
(...I have to say that, from reading the above, Cygwin sounds like a nighmare and I certainly won't be troubling it...! If you want Linux on a Windows machine, Virtualbox sounds like a safer bet...) On Saturday, March 9, 2013 8:31:56 PM UTC, BJG145 wrote: ...I dunno. As a

Re: clojure.core/protocol?

2013-03-09 Thread vemv
(defprototocol P ...) does two things: define a map on the current namespace, and generate an interface on a package that will have the same name as the current namespace. (defprotocol P (x [_])) ;; - P (class P) ;; - clojure.lang.PersistentArrayMap (:on-interface P) ;; - user.P (.isInterface

Re: How to ensure consistency when accessing database?

2013-03-09 Thread vemv
On the Clojure side the only thing you can do is to serialize writes to the resouce (the db connection). So at most one thread can be performing an update operation, at a given time. You can increase concurrency by mantaining read-only db connections (most likely in an ad-hoc/by-convention

Re: what is a good book about Java queues?

2013-03-09 Thread vemv
Two queues cover the 80% case: an implementation of BlockingQueue (array, linked list backed), and clojure.lang.PersistentQueue. The former provides concurrency semantics: there are no 'stale values' issues associated to mutation, and you can choose whether your reads/writes are blocking

Newbie requesting review

2013-03-09 Thread Craig Ching
Hi all, I wrote some code to generate some example data for a web ui that I'm working on and I was wondering if I could get some advice about it to ensure I'm on the right track in my clojure learning. Basically its a very simple program that generates a number of JSON files that contain

Re: :use an entire namespace full of protocols or stick with :require?

2013-03-09 Thread Korny Sietsma
[reviving a slightly old thread] Note that as of clojure 1.4 you can also do: (:require foo.bar :refer :all) in fact from comments I've seen elsewhere there is a general intention to remove :use entirely? It'd be good to have some clarity on this. The vast majority of code samples use :use,

Re: :use an entire namespace full of protocols or stick with :require?

2013-03-09 Thread Travis Vachon
Speaking strictly for myself, but as someone who spends about half his professional day writing Clojure: :use is dead, long live :require. I've found using :require [foo :refer :all] rather than :use foo has lead to cleaner, more consistent ns statements in my own code, and I've made it a policy

Composable mutual recursive function composition

2013-03-09 Thread Brent Millare
I recently asked about mutual referenced support in the prismatic library plumbing https://github.com/Prismatic/plumbing and currently its an open question about how to implement that. So I made a proof-of-concept version of a graph-like library that supports mutual recursion.

clojure.core/format localization problems

2013-03-09 Thread dabd
On my system I have: *clojure-version* {:major 1, :minor 4, :incremental 0, :qualifier nil} (java.util.Locale/getDefault) #Locale en_US (format %.1f 0.5) 0,5 (java.lang.String/format (java.util.Locale/getDefault) %.1f (to-array [0.5])) 0.5 but (java.lang.String/format %.1f (to-array

Re: clojure.core/format localization problems

2013-03-09 Thread Andy Fingerhut
What OS and version of Java are you using (output of java -version, and if on Linux lsb_release -a and uname -a). Are you doing these commands one after another in a single REPL session? If so, how did you start that REPL? I've tried the commands you mention on these OS and JDK combos with

Re: clojure.core/format localization problems

2013-03-09 Thread dabd
I am trying to run clojure on windows 7 with this java version: java version 1.7.0_05 Java(TM) SE Runtime Environment (build 1.7.0_05-b05) Java HotSpot(TM) 64-Bit Server VM (build 23.1-b03, mixed mode) The decimal separator used to be a dot but for some reason it changed to a comma recently. I

Re: clojure.core/format localization problems

2013-03-09 Thread dabd
I installed the latest 1.7.0_17 and apparently the issue is gone but I still don't know what caused it. Thanks. On Sunday, March 10, 2013 3:22:21 AM UTC, dabd wrote: I am trying to run clojure on windows 7 with this java version: java version 1.7.0_05 Java(TM) SE Runtime Environment (build

Re: what is a good book about Java queues?

2013-03-09 Thread Feng Shen
Yes, the javadoc is quite good, paste a link here: http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/BlockingQueue.html On Friday, March 8, 2013 4:32:38 AM UTC+8, larry google groups wrote: At some point on this mailist, someone suggested that to best understand concurrency in

Re: Windows Installation

2013-03-09 Thread Phil Hagelberg
James Ashley writes: 2) Download the lein install script as text from the leiningen home page. 3) Copy it over to my cygwin directory 4) Search/replace to replace the HTML entities with the real thing. I think this was a matter of amp; and gt; Can you explain how you downloaded bin/lein