Re: Leiningen in Python

2009-12-20 Thread John
oes 'lein.py new' E:\keep\clojure\helloworld>E:\etc\clojure\Leiningen\lein.py new Wrong number of arguments to task new. E:\keep\clojure\helloworld>E:\etc\clojure\Leiningen\lein.py version Leiningen nil on Java 1.6.0_18-ea Java HotSpot(TM) Client VM This seems to be a different issue (poss

Re: Leiningen in Python

2009-12-19 Thread John
or (index 4).) I have tried many guesses (I am not familiar with python (V2.6)). Can anyone make some suggestions? Regards, John. On Dec 12, 10:31 pm, Rob Wolfe wrote: > Mike K writes: > > All, > > > I tried to use this script on Windows and it blew up real good!  I'

Re: Clojure newbie question regarding compile time type checking.

2009-12-15 Thread Tayssir John Gabbour
On Dec 15, 1:23 pm, Baishampayan Ghose wrote: > PS - If you are worried about "compile time type checking", I think it's > prudent to mention now that Clojure is a dynamically typed programming > language where types are checked at run-time and not compile time. Actually, there are Common Lisp co

Re: Funding Clojure 2010

2009-12-15 Thread John Bell
he individual donor is okay with it). Everyone can contribute something, it doesn't have to be money. I don't see anything wrong with making contributing an expectation even if it's not a requirement. John -- You received this message because you are subscribed to the Google Gro

Is it possible to define ordering functions for own type?

2009-12-06 Thread John Ky
Hi, Is it possible to define the functions >, <, >=, <=, ==, min, and max for my own defstruct type? My type is: (defstruct deadline :value) where I initialise value with an object of type long. Thanks -John -- You received this message because you are subscribed to the G

Re: Generalizing -> & ->>

2009-12-05 Thread John Harrop
On Fri, Dec 4, 2009 at 2:49 PM, Richard Newman wrote: > > The problem is that it is an unreasonably high barrier to entry. > > There MUST be an electronic-only way (and it must not require a cell > > phone, CC#, &c.) if the full potential of this community is to be > > unleashed upon clojure-cont

Re: simple journal-based persistenсe for Clojure

2009-12-05 Thread John Harrop
On Fri, Dec 4, 2009 at 7:40 PM, Luc Préfontaine wrote: > I was about to say that. There's no need for the id's to be "contiguous", > only to get them to grow to preserve ordering. > If you can find a way in your design to increment the atom each time a > transaction is retried then you would > p

Re: Clojure development environments

2009-12-04 Thread John Newman
> your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > -- John -- You received this message because you are subscribed to the Goo

Re: Generalizing -> & ->>

2009-12-04 Thread John Harrop
On Fri, Dec 4, 2009 at 8:57 AM, Miron Brezuleanu wrote: > On Fri, Dec 4, 2009 at 2:33 PM, John Harrop wrote: > > The problem is that it is an unreasonably high barrier to entry. There > MUST > > be an electronic-only way (and it must not require a cell phone, CC#, >

Re: Generalizing -> & ->>

2009-12-04 Thread John Harrop
On Fri, Dec 4, 2009 at 6:51 AM, Meikel Brandmeyer wrote: > Hi, > > On 4 Dez., 05:17, John Harrop wrote: > > > The rules on contrib are that the work must be original to the author. > Even > > > with Andrew's disclaimer that it be considered public do

Re: simple journal-based persistenсe for Clojure

2009-12-04 Thread John Harrop
On Fri, Dec 4, 2009 at 6:50 AM, Sergey Didenko wrote: > Without the global transaction counter another problem arises. > > Suppose transaction B depends on ( results of ) transaction A. And they are > executed from different threads. However they have the right order when > executing the first tim

Re: Getting Started in Mac OS X Snow Leopard

2009-12-04 Thread John Harrop
On Fri, Dec 4, 2009 at 4:41 AM, Lauri Pesonen wrote: > 2009/12/2 Matthew Williams : > > Using the Cocoa build of Emacs 23 (http://www.emacsformacosx.com) I > > was able to get up and running extremely quickly with Technomancy's > > swank-clojure install. > > This is very much off-topic, but... >

Re: simple journal-based persistenсe for Clojure

2009-12-04 Thread John Harrop
On Thu, Dec 3, 2009 at 6:31 PM, Sergey Didenko wrote: > Well, I'm not fluent with git yet. I'll create the github project, that can > not be hard. > > In comparison with Prevayler, the persister does not block the reads, > because it relies on Clojure STM. However it blocks the writes as > Prevay

Re: Generalizing -> & ->>

2009-12-04 Thread John Harrop
On Thu, Dec 3, 2009 at 10:41 AM, Stephen C. Gilardi wrote: > > On Dec 3, 2009, at 10:31 AM, Roman Roelofsen wrote: > > Are there any plans to add -$> to core or contrib? > > The rules on contrib are that the work must be original to the author. Even > with Andrew's disclaimer that it be considered

Re: Minimum value in a vector

2009-12-02 Thread John Harrop
On Wed, Dec 2, 2009 at 7:59 PM, Don wrote: > I still can't figure it out. If have this set. > > a [2 4 6 7] > b [1 3 9 2] > c [2 4 5 6] > d [6 1 3 8] > e [4 8 2 1] > > If I do (reduce min (map #(get % 0) (list a b c d e))) > > It grabs the min value from index 0 of the five vectors and retu

Re: Minimum value in a vector

2009-12-02 Thread John Harrop
On Wed, Dec 2, 2009 at 5:43 PM, Don wrote: > I am having difficulty approaching this problem. I'm not sure if it > can be done in one swoop, or requires a few steps. > > I have 5 vectors as such: > > a [2 4 6 7] > b [1 3 9 2] > c [2 4 5 6] > d [6 1 3 8] > e [4 8 2 1] > > And I want to take the m

Re: Handling XML

2009-12-02 Thread Tayssir John Gabbour
're a bit overwhelmed by all the stuff that xml-> accepts, just note that much of it is syntactic sugar, for your convenience. Tayssir On Dec 2, 7:41 pm, Tayssir John Gabbour wrote: > Hi! > > Taking minor liberties with your code (for clarity), the following > gives pr

Re: Handling XML

2009-12-02 Thread Tayssir John Gabbour
Hi! Taking minor liberties with your code (for clarity), the following gives pretty much the same result as your handle-xml function: (ns blah (:require [clojure.xml :as xml] [clojure.zip :as zip]) (:use clojure.contrib.zip-filter.xml)) (defn my-test [] (doseq [x (xml-> (zip/x

Re: Clojure as a first programming language?

2009-12-01 Thread Tayssir John Gabbour
ze how they print to screen. So for instance, an eBay order might print like this: # emphasizing only order# and payment status, rather than its in-memory representation as a big XML structure. And when I do want to examine big representations, I use a "pretty printer" to format them readably.

Re: Clojure as a first programming language?

2009-12-01 Thread John Harrop
On Tue, Dec 1, 2009 at 8:30 PM, Alex Osborne wrote: > Clojure would be challenging language to start with, as (all?) the books > and documentation are aimed at people who are already programmers. But > if you like a challenge then perhaps that's even a good thing. If > you're already a techie t

Re: Non-blocking I/O

2009-12-01 Thread John Harrop
On Tue, Dec 1, 2009 at 11:10 AM, Ivan Sagalaev wrote: > Hello! > > I'm looking at Clojure for a couple of days, having watched two of > Rich's video presentations. So I'm not yet familiar with Clojure's > practical patterns but I can read the code :-). > > My question is how to model a non-blockin

Re: Clojure as a first programming language?

2009-12-01 Thread John Newman
gt; 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 with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com &g

Re: Clojure as a first programming language?

2009-12-01 Thread Tayssir John Gabbour
Interestingly, there's this book which is a crash course on building a computer stack from the ground up: from logic gates, to a compiler, to an OS. And the simulator, in which you build all these things, is in Java. Nisan/Schocken's _The Elements of Computing Systems_:

Re: Clojure as a first programming language?

2009-12-01 Thread Tayssir John Gabbour
Interestingly, there's this book which is a crash course on building a computer stack from the ground up: from logic gates, to a compiler, to an OS. And the simulator, in which you build all these things, is in Java. Nisan/Schocken's _The Elements of Computing Systems_: Luke Gorrie mentioned por

Re: Clojure as a first programming language?

2009-12-01 Thread Tayssir John Gabbour
Interestingly, there's this book which is a crash course on building a computer stack from the ground up: from logic gates, to a compiler, to an OS. And the simulator, in which you build all these things, is in Java. Nisan/Schocken's _The Elements of Computing Systems_: Luke Gorrie mentioned por

Re: Clojure as a first programming language?

2009-12-01 Thread Tayssir John Gabbour
Hi, As an occasional Clojure user, and someone who's used Common Lisp a lot, I'd venture that Clojure is a good first choice. But let me metion areas of difficulty first. Geoffrey Teale discussed the big things, so let me mention some little ones: - Java's classpath currently demands that you res

Re: Clojure as a first programming language?

2009-12-01 Thread John Harrop
> > So, Clojure programmers, am I wrong? Should I pass on Clojure in favor > of another langauge? Or learn Common Lisp or Scheme first, then try my > hand at Clojure? Am I mistaken for a different reason? Or perhaps > there are some criteria I should consider before diving in? > I, for one, think

Re: Query blobs in clojure.contrib.sql?

2009-12-01 Thread John Harrop
On Mon, Nov 30, 2009 at 9:57 PM, Base wrote: > Hi > > I have a database that has a table with complex java objects stored in > a binary field. > > In java i would do something like: > > protected Object read(byte[] buf){ > Object obj = null; > if (buf==null) return obj; > try { >

Re: reduce with-precision using BigDecimal

2009-11-30 Thread John Harrop
On Mon, Nov 30, 2009 at 7:07 AM, Joseph Smith wrote: > setScale returns a new BigDecimal with a given scale, it does not change > the original value. > I did not claim otherwise. The effect of with-precision is like an implicit (.setScale foo) around every BigDecimal "foo", only more efficient s

Re: reduce with-precision using BigDecimal

2009-11-30 Thread John Harrop
On Mon, Nov 30, 2009 at 12:22 AM, Joseph Smith wrote: > What you want is to set the 'scale' of the BigDecimal. > > There doesn't seem to be a nice clojure macro for it, but this works: >user=> (.setScale (reduce + [15.00M 15.01M 3.00M 3.01M]) 3) >36.020M > That's what with-precision does

One benefit of having a REPL

2009-11-28 Thread John Harrop
One benefit of having a REPL: it makes regular expressions usable. So easy to test and tweak your RE compared to the traditional compile/test/debug cycle! I never even bothered with the java.util.regex package before Clojure as it was too painful to use. -- You received this message because you a

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: 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 >>

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: 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

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: Question about future

2009-11-26 Thread John Harrop
On Thu, Nov 26, 2009 at 2:11 AM, Christophe Grand wrote: > On Thu, Nov 26, 2009 at 8:05 AM, Robert Campbell wrote: > >> If you have this: >> >> user> (def f (future (Thread/sleep 2) :done)) >> #'user/f >> user> @f ; this immediate deref blocks for 20 sec, finally returning >> :block >> :done

Re: Recursions under lazy-seq - how does it work?

2009-11-25 Thread John Harrop
On Wed, Nov 25, 2009 at 12:40 PM, Gabi wrote: > Very interesting indeed. I am not sure I understand completely, but by > intuition I presume that the recursive call actually creates a new > heap allocated LazySeq (with the function definition inside) . Not quite; it creates a Java object one me

Re: problem with resolve

2009-11-24 Thread John Harrop
On Tue, Nov 24, 2009 at 6:01 AM, kony wrote: > Hi, > > I found that resolve does not work correctly (I guess) when it is > called from other thread than main: > > e.g. > > let define > > (def zz 123) > > and afterwords call: > > (.start (new Thread #(println (resolve 'zz > > for me it does no

Re: roll call of production use?

2009-11-24 Thread John Harrop
On Tue, Nov 24, 2009 at 1:04 AM, Meikel Brandmeyer wrote: > Hi, > > On Nov 24, 6:06 am, John Harrop wrote: > > > Oh, I have no problem with making money by using open source software, > when > > it's done in the manner that companies like Red Hat do it. It&#

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 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: 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: 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: Monad problems: finding an m-zero

2009-11-22 Thread John Harrop
On Sun, Nov 22, 2009 at 4:25 PM, Martin DeMello wrote: > On Mon, Nov 23, 2009 at 2:40 AM, 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 &g

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

2009-11-22 Thread John Harrop
On Sun, Nov 22, 2009 at 4:32 PM, samppi wrote: > Does a function that does this: > (vary coll :x fn-x, :y fn-y) > ; Equivalent to (assoc coll :x (fn-x (:x coll)), :y (fn-y (:y > coll))) > exist in the core or contrib APIs? > > I'm surprised that I can't find any. It's a very natural extension o

Re: Monad problems: finding an m-zero

2009-11-22 Thread John Harrop
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? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@g

Re: How to make this a non-reflecting call?

2009-11-22 Thread John Harrop
On Sun, Nov 22, 2009 at 12:55 PM, David Brown wrote: > java.nio.channels.FileChannel contains some .write methods: > > [27] write : int (ByteBuffer) > [28] write : int (ByteBuffer,long) > [29] write : long (ByteBuffer[]) > [30] write : long (ByteBuffer[],int,int) > > I have an array of ByteBufers

Re: leiningen - a Clojure build tool

2009-11-22 Thread John Harrop
How is it pronounced anyway, at the start? LINE... or LANE...? -- 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 with your

Re: positions

2009-11-22 Thread John Harrop
On Sun, Nov 22, 2009 at 7:54 AM, Emeka wrote: > John, > > You should have added that you code came from Programming Clojure. > It didn't. If it's the same as, or closely similar to, code from there, it's entirely coincidental. In Clojure there's usually several

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

2009-11-22 Thread John Harrop
you know the likely culprit and it isn't > > Clojure's transients. :) > > To be fair, John, you've had an issue or two with the REPL provided by > your modern IDE too :) > Nothing so serious as a hang, though, and at least I can do basic things in my IDE without reaching

Re: One place where interop needs improvement

2009-11-21 Thread John Harrop
On Sat, Nov 21, 2009 at 11:43 PM, Alex Osborne wrote: > John Harrop wrote: > > On Sat, Nov 21, 2009 at 9:03 PM, Alex Osborne > > > (:import package1 class class class) (:import package2 class class) > > > > > > I am. Especially since the latter already works.

Re: tree-shaking a jarred Clojure app?

2009-11-21 Thread John Harrop
On Sat, Nov 21, 2009 at 11:21 PM, David Brown wrote: > On Sat, Nov 21, 2009 at 11:14:52PM -0500, John Harrop wrote: > > >1 second instead of 1/6 of a second. Yeah, like users will notice that > >difference in startup times. :) > > I'm not actually complaining, but I

Re: One place where interop needs improvement

2009-11-21 Thread John Harrop
On Sat, Nov 21, 2009 at 9:03 PM, Alex Osborne wrote: > John Harrop wrote: > > > 1: Improvements to the ns macro, such as described in a previous thread. > > Particularly I'd like to see > > > > (:import package class class class) > > > > work. Thi

Re: tree-shaking a jarred Clojure app?

2009-11-21 Thread John Harrop
On Sat, Nov 21, 2009 at 8:57 PM, David Brown wrote: > On Sat, Nov 21, 2009 at 08:42:26PM -0500, John Harrop wrote: > > >Are you talking about binding things like String.class to vars referenced > by > >symbols like String? > > Not just String.class, every single

Re: Weird Java Interop Behaviour

2009-11-21 Thread John Harrop
On Sat, Nov 21, 2009 at 8:47 PM, David Brown wrote: > On Fri, Nov 20, 2009 at 03:54:45PM -0800, Mike Hinchey wrote: > >It's the . special form that makes the difference. In (. System > >(getProperty)), the dot interprets System as a class and looks for a > static > >method (at read/compile time)

Re: tree-shaking a jarred Clojure app?

2009-11-21 Thread John Harrop
On Sat, Nov 21, 2009 at 8:30 PM, David Brown wrote: > On Fri, Nov 20, 2009 at 06:37:18PM +, Jim Downing wrote: > > >I might have misunderstood, but isn't the problem the same as in Java; > >you can't know from a static analysis which classes are going to be > >loaded? > > Except that Clojure

One place where interop needs improvement

2009-11-21 Thread John Harrop
One place where interop needs improvement: imports. This is ridiculous: # sandbox=> # sandbox=> # sandbox=> # sandbox=> # sandbox=> I shouldn't have to play guessing games or keep reaching for reference materials. We need at least two improvements here. 1: Improvements to the ns macro, such as

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

2009-11-20 Thread John Harrop
On Fri, Nov 20, 2009 at 5:16 PM, Raoul Duke wrote: > > Try with a 1.6 JVM... > > wow. it actually got worse than when i was using 1.5. ... so much for > hallowed write-once-run-the-same-anywhere-ish of the jvm, d'oh. > > Clojure 1.1.0-alpha-SNAPSHOT > user=> (load-file "/tmp/test.clj") > #'user/v

Re: tree-shaking a jarred Clojure app?

2009-11-20 Thread John Harrop
On Fri, Nov 20, 2009 at 2:28 PM, Richard Newman wrote: > > But I should be able to know, through class inspection, whether my > > 'main' program depends on a class which uses, say, the clojure.zip > > namespace, and decide whether or not to include it. Or so I am > > wondering. > > There are impe

Re: take repeatedly alternative?

2009-11-19 Thread John Harrop
On Thu, Nov 19, 2009 at 9:17 PM, Mark Triggs wrote: > A good example is: > > (take 10 (repeatedly #(rand-int 100))) > > to get a bunch of random integers. I actually quite like this idiom, > even if there's a bit of ascii involved :) > Why not abstract it some, though? (defn rand-seq [range]

Re: positions

2009-11-19 Thread John Harrop
On Thu, Nov 19, 2009 at 7:51 PM, Alex Osborne wrote: > John Harrop wrote: > > This is just (sort (concat [1 2 3 4 5 6 7] [3 2 7])) though. > > > > > > I think he also wants the original order of the first input coll to be > > preserved, though. Sort woul

Re: positions

2009-11-19 Thread John Harrop
On Thu, Nov 19, 2009 at 7:15 PM, Alex Osborne wrote: > John Harrop wrote: > > On Thu, Nov 19, 2009 at 7:00 PM, Sean Devlin > <mailto:francoisdev...@gmail.com>> wrote: > > > > That's why there are two separate functions do do what you suggest > >

Re: positions

2009-11-19 Thread John Harrop
On Thu, Nov 19, 2009 at 7:00 PM, Sean Devlin wrote: > That's why there are two separate functions do do what you suggest > > user=>(interleave [1 2 3 4] [1 2 3 4]) > (1 1 2 2 3 3 4 4) > > user=> (concat [1 2 3 4] [1 2 3 4]) > (1 2 3 4 1 2 3 4) > Poor choice of example. I think he meant even if he

Re: unsubscribe

2009-11-19 Thread John Harrop
On Thu, Nov 19, 2009 at 2:39 PM, Timothy McDowell wrote: > unsubscribe Interesting. Most mailing lists I subscribe to get one of these a week, or even a day. This is the first missent unsubscribe the clojure list's had in months. -- You received this message because you are subscribed to the G

Re: positions

2009-11-19 Thread John Harrop
On Thu, Nov 19, 2009 at 1:23 PM, Sean Devlin wrote: > Try clojure.contrib.seq-utils :) > > As a learning exercise, I'd recommend re-writing it to be lazy. Your > version is eager because it uses loop. In order to make it lazy, > you'd want to construct a lazy-seq. See the macro w/ the same name

Re: swap two elements in an arbitrary collection

2009-11-19 Thread John Harrop
On Thu, Nov 19, 2009 at 4:31 AM, Lauri Pesonen wrote: > (clojure.walk/macroexpand-all '(cond (even? 2) :foo (odd? 2) :bar :else > :baz)) > (if (even? 2) :foo (if (odd? 2) :bar (if :else :baz nil))) Eeeuw. Perhaps the cond macro should check if the last condition is self-evaluating and, if it is

Re: Proposal: Extend behavior of hash-map

2009-11-17 Thread John Harrop
On Tue, Nov 17, 2009 at 6:24 PM, Richard Newman wrote: > > I wonder if perhaps (into {} a-java-map) should work but no other > > substitutions of a potentially-mutable map for a Clojure map. > > Baby, bathwater. Making a persistent map out of a Java map is > expensive. Not everything that impleme

Re: Proposal: Extend behavior of hash-map

2009-11-17 Thread John Harrop
On Tue, Nov 17, 2009 at 5:06 PM, Sean Devlin wrote: > Heh. Learn something new every day. > > This also works > > (into {} (System/getProperties)) And I'd much prefer it. Passing a mutable Java map around to functions that expect a map but assume it will never change out from under them creates

Re: def a generated symbol?

2009-11-17 Thread John Harrop
On Tue, Nov 17, 2009 at 4:22 PM, Chouser wrote: > On Tue, Nov 17, 2009 at 4:11 PM, John Harrop wrote: > > On Tue, Nov 17, 2009 at 3:59 PM, nchubrich > > wrote: > >> > >> How do you def a symbol that you make using (symbol)? I.E. if I try >

Re: def a generated symbol?

2009-11-17 Thread John Harrop
On Tue, Nov 17, 2009 at 3:59 PM, nchubrich wrote: > How do you def a symbol that you make using (symbol)? I.E. if I try > to do (def (symbol "x") 2) I get: > java.lang.Exception: Second argument to def must be a Symbol. (And > why does it say the \second argument must be a symbol?) > Special fo

Re: A typo on the website about vars

2009-11-17 Thread John Harrop
On Tue, Nov 17, 2009 at 2:31 PM, Chouser wrote: > On Tue, Nov 17, 2009 at 8:40 AM, Jacek Laskowski > wrote: > > > > I'm wondering what part is missing in "which provides a means for > > nested contexts to communicate with code before it the call stack." at > > http://clojure.org/vars? I think th

Re: No names with trailing % allowed but with a leading one?

2009-11-17 Thread John Harrop
On Tue, Nov 17, 2009 at 2:17 PM, Stefan Kamphausen wrote: > Hi, > > On Nov 17, 8:12 pm, John Harrop wrote: > > On Tue, Nov 17, 2009 at 1:46 PM, Sean Devlin >wrote: > > > > > I *THINK* what is meant by the "non-numeric" is anything that matches

Re: No names with trailing % allowed but with a leading one?

2009-11-17 Thread John Harrop
On Tue, Nov 17, 2009 at 1:46 PM, Sean Devlin wrote: > I *THINK* what is meant by the "non-numeric" is anything that matches > > #"[a-zA-z]" > Nah, it'll be anything that's allowed elsewhere AND is not a digit. -- You received this message because you are subscribed to the Google Groups "Clojure

Re: A typo on the website about vars

2009-11-17 Thread John Harrop
On Tue, Nov 17, 2009 at 8:40 AM, Jacek Laskowski wrote: > Hi, > > I'm wondering what part is missing in "which provides a means for > nested contexts to communicate with code before it the call stack." at > http://clojure.org/vars? I think the wording is broken at the end. > Probably "in": "whic

Re: Remote REPL problem when connecting to RMI Client VM

2009-11-16 Thread John Harrop
On Mon, Nov 16, 2009 at 7:20 PM, Kent wrote: > Hi, > > I am trying to use clojure to implement a "plugin" for some vendor > supplied software. > > Here is a little background on the vendor supplied software. It > expects me to implement a particular interface and then put the jar > file containi

Re: A Clojure Highlife

2009-11-16 Thread John Harrop
On Mon, Nov 16, 2009 at 12:42 AM, solussd wrote: > I just finished an implementation of the Conway's Game of Life > derivative, Highlife, in Clojure. It consists of a simple swing GUI > and makes good use of Refs for coordinating grid updates. A more > detailed description, source, and jars can b

Re: local constants in functions or static locals/Hilbert curve in clojure (no images:)

2009-11-16 Thread John Harrop
On Sun, Nov 15, 2009 at 8:28 PM, Rich Hickey wrote: > On Sun, Nov 15, 2009 at 4:49 AM, ajuc wrote: > > On 15 Lis, 00:21, John Harrop wrote: > >> On Sat, Nov 14, 2009 at 3:03 PM, ajuc wrote: > >> > I have to install java one more time, when I try to sta

Re: Datatypes and Protocols - early experience program

2009-11-16 Thread John Harrop
On Mon, Nov 16, 2009 at 2:16 AM, Michael Wood wrote: > This is what I get with or without rlwrap from the command line. No > IDE or anything like that: > > Clojure 1.1.0-alpha-SNAPSHOT > user=> ; some comment > user=> #! something > (println "blah") > blah > nil > user=> > > i.e. the same as Dav

Re: Datatypes and Protocols - early experience program

2009-11-15 Thread John Harrop
On Sun, Nov 15, 2009 at 8:17 PM, David Brown wrote: > On Sun, Nov 15, 2009 at 04:20:19PM -0500, John Harrop wrote: > > >That's weird. It's not documented anywhere on the site. And it seems to > hang > >the REPL: > > > >user=> nil #!foo > > &

Re: local constants in functions or static locals/Hilbert curve in clojure (no images:)

2009-11-15 Thread John Harrop
On Sun, Nov 15, 2009 at 7:32 PM, Alex Osborne wrote: > ajuc wrote: > > I would like to somehow hide the global hilbert-map into my function, > > but I can't see how to do that. > > > > Is this possible? I know that I can just inert literal into my let, > > but that degrades performance, when func

Re: local constants in functions or static locals/Hilbert curve in clojure (no images:)

2009-11-15 Thread John Harrop
Interesting. It looks like Clojure's missing a few obvious optimizations, and is reconstructing the literal structure each time the function is called, or each time the value is used if the literal is directly at point of use. On the other hand, deref of a global is not exactly blindingly fast eit

Re: Datatypes and Protocols - early experience program

2009-11-15 Thread John Harrop
On Sun, Nov 15, 2009 at 8:45 AM, Michael Wood wrote: > 2009/11/14 John Harrop : > > On Sat, Nov 14, 2009 at 1:42 PM, Richard Newman > wrote: > >> > >> I like CL's package support for this kind of situation, where > >> unexported symbols can still be

Re: Map a list of agents to a list of their values

2009-11-15 Thread John Harrop
On Sat, Nov 14, 2009 at 6:03 PM, Meikel Brandmeyer wrote: > Hi, > > Am 14.11.2009 um 20:31 schrieb John Harrop: > > > For situations like this, I find it handy to discover what reader-macros >> are expanding to. This works well: >> >> user=>(defmacro expan

Re: local constants in functions or static locals/Hilbert curve in clojure (no images:)

2009-11-15 Thread John Harrop
On Sun, Nov 15, 2009 at 4:49 AM, ajuc wrote: > On 15 Lis, 00:21, John Harrop wrote: > > On Sat, Nov 14, 2009 at 3:03 PM, ajuc wrote: > > > I have to install java one more time, when I try to start java - > > > server, I get: > > > Error: no `server

Re: Map a list of agents to a list of their values

2009-11-14 Thread John Harrop
On Sat, Nov 14, 2009 at 3:24 PM, John Harrop wrote: > On Sat, Nov 14, 2009 at 2:51 PM, Kevin Q wrote: > >> Hi, >> Thanks for the hint. I tried (map deref agents) and it did work. I >> don't know if this is a bug? > > > Nah, it's just being really sneak

Re: Map a list of agents to a list of their values

2009-11-14 Thread John Harrop
On Sat, Nov 14, 2009 at 2:51 PM, Kevin Q wrote: > Hi, > Thanks for the hint. I tried (map deref agents) and it did work. I > don't know if this is a bug? Nah, it's just being really sneaky. > > (fn* [p1__6536] ((clojure.core/deref p1__6536))) > Even I didn't notice it before. There's an extr

Re: local constants in functions or static locals/Hilbert curve in clojure (no images:)

2009-11-14 Thread John Harrop
On Sat, Nov 14, 2009 at 3:03 PM, ajuc wrote: > I have to install java one more time, when I try to start java - > server, I get: > Error: no `server' JVM at `F:\Program Files\Java\jre6\bin\server > \jvm.dll > You need to use the one in F:\Program Files\Java\jdk6 instead. I'm surprised your IDE

Re: Datatypes and Protocols - early experience program

2009-11-14 Thread John Harrop
On Sat, Nov 14, 2009 at 1:42 PM, Richard Newman wrote: > I like CL's package support for this kind of situation, where > unexported symbols can still be reached via foo::bar, at the cost of > an obvious "code smell". This suggests an alternate fix for the private functions in macros problem: 1

Re: Map a list of agents to a list of their values

2009-11-14 Thread John Harrop
On Sat, Nov 14, 2009 at 12:49 PM, Kevin Q wrote: > I have a list of agents, each of which has a hasmap state. I want to > get a list of values from the list of agents, naturally I used the map > function and print the result of the map: > > (println > (map #(@%) agents)) > > However, when I run

Re: Deep deref

2009-11-14 Thread John Harrop
On Sat, Nov 14, 2009 at 2:11 PM, John Harrop wrote: > On Sat, Nov 14, 2009 at 11:42 AM, André Thieme < > splendidl...@googlemail.com> wrote: > >> Dereferencing *persons* will result in: >> {"Tina" #, >> "Jeff" #, >> "Karl&

Re: Deep deref

2009-11-14 Thread John Harrop
On Sat, Nov 14, 2009 at 11:42 AM, André Thieme wrote: > Dereferencing *persons* will result in: > {"Tina" #, > "Jeff" #, > "Karl" #} > Great so far. > > People can become friends, so we need > (defn add-friend [#^String person #^String friend] > (dosync >(let [p (get @*persons* person) >

Re: local constants in functions or static locals/Hilbert curve in clojure (no images:)

2009-11-14 Thread John Harrop
On Sat, Nov 14, 2009 at 6:19 AM, ajuc wrote: > > > I would like to somehow hide the global hilbert-map into my function, > > > but I can't see how to do that. > > > > Just put the literal directly into the function. > > > > > Is this possible? I know that I can just inert literal into my let, > >

Re: why a defn- but not a def- ?

2009-11-14 Thread John Harrop
On Sat, Nov 14, 2009 at 8:55 AM, Albert Cardona wrote: > On Fri, Nov 13, 2009 at 11:26 PM, Mike Hogye > wrote: > > Why is there an easy way to def a private function (defn-), but no > > similarly easy way to def an arbitrary var as private? > > > The way I see it, def- would encourage gratuitous

Re: Datatypes and Protocols - early experience program

2009-11-14 Thread John Harrop
On Sat, Nov 14, 2009 at 3:45 AM, Mark Engelberg wrote: > On Fri, Nov 13, 2009 at 12:58 AM, Konrad Hinsen > wrote: > > Coming from a Python background, I don't think access restrictions are > > necessary. However, flagging fields as "not meant for use by > > outsiders" could be of interest for doc

Re: Datatypes and Protocols - early experience program

2009-11-13 Thread John Harrop
On Fri, Nov 13, 2009 at 8:50 PM, Mark Engelberg wrote: > Rich, thanks for the extended explanation of the overlap between the > old and new constructs; I found this explanation much clearer than > what is currently on the wiki. Basically, the key for me was > realizing that these new constructs a

Re: local constants in functions or static locals/Hilbert curve in clojure (no images:)

2009-11-13 Thread John Harrop
On Fri, Nov 13, 2009 at 6:48 PM, ajuc wrote: > Hello. > > I've tried to translate nice Hilbert-curve-index calculating function > to clojure (http://blog.notdot.net/2009/11/Damn-Cool-Algorithms- > Spatial-indexing-with-Quadtrees-and-Hilbert-Curves). > > I've got sth like that: > > (def hilbert-ma

Re: Better documentation and error messages are needed for the ns macro

2009-11-13 Thread John Harrop
On Fri, Nov 13, 2009 at 1:23 PM, Chouser wrote: > On Wed, Nov 11, 2009 at 4:24 PM, John Harrop wrote: > > One question: how would Java class imports be dealt with? I think it > should > > be unified: > > (ns foo > > (uses java.io :only [File FileInputStream] :as

Re: Gensym collisions can be engineered.

2009-11-11 Thread John Harrop
On Wed, Nov 11, 2009 at 10:46 PM, Kevin Tucker wrote: > Yeah, sorry, missed that. > > How does making the gensyms unreadable make things worse for > macroexpand than they are in CL? It doesn't. Just worse than they currently are in Clojure. :) -- You received this message because you are subsc

<    4   5   6   7   8   9   10   11   12   13   >