Re: bound?

2009-03-26 Thread mikel
On Mar 26, 7:59 pm, "Stephen C. Gilardi" wrote: > On Mar 26, 2009, at 7:24 PM, mikel wrote: > > > How would you write bound? (or alternatively, what is the name of   > > the function that serves the same purpose)? > > > This hypothetical function would return true if and only if its   > > argum

Re: bound?

2009-03-26 Thread Stephen C. Gilardi
On Mar 26, 2009, at 7:24 PM, mikel wrote: How would you write bound? (or alternatively, what is the name of the function that serves the same purpose)? This hypothetical function would return true if and only if its argument refers to a Var with a binding in the namespace where the refer

bound?

2009-03-26 Thread mikel
How would you write bound? (or alternatively, what is the name of the function that serves the same purpose)? This hypothetical function would return true if and only if its argument refers to a Var with a binding in the namespace where the reference appears. Such a function is useful for writin

Re: oo

2009-03-26 Thread Laurent PETIT
2009/3/26 Konrad Hinsen > > On 26.03.2009, at 14:59, Rich Hickey wrote: > > > Plus the inability to dispatch on other than class or eql, the > > inability to superimpose another taxonomy without redefining the > > class, the inability to have multiple independent taxonomies... > > The ability to

Re: oo

2009-03-26 Thread mikel
On Mar 26, 8:59 am, Rich Hickey wrote: > On Mar 25, 6:47 am, mikel wrote: [...my misgivings snipped...] > I wonder about the generality of this concern. Defining new methods > that break existing code implies both defining new methods on existing > super-types *and* some crosscutting multipl

Re: Slime integration

2009-03-26 Thread Tassilo Horn
vseguip writes: > Hi I tried your code but still no luck with errors. Then I don't know. I use ut-to-date versions of swank-clojure, clojure-mode, SLIME and clojure all from their version control systems. Maybe that makes the difference. Bye, Tassilo --~--~-~--~~~

Re: z/OS and codepage issues?

2009-03-26 Thread Laurent PETIT
Hello Stephen, Well, it seems that javac (java compilation tool) accepts this option : *-encoding* *encoding* Set the source file encoding name, such as EUCJIS/SJIS. If *-encoding* is not specified, the platform default converter is used.So maybe something along those lines for everything that is

Re: Slime integration

2009-03-26 Thread vseguip
Hi I tried your code but still no luck with errors. This is what I get from the*slime events* buffer: (:emacs-rex (swank:compile-file-for-emacs "/home/vseguip/uoc/IA2/practica/ main.clj" t 'nil) "practica-main" t 5) (:indentation-update (("rec-seq" . 1))) (:return (:ok (:compilation-resul

Re: z/OS and codepage issues?

2009-03-26 Thread Stephen C. Gilardi
On Mar 26, 2009, at 2:44 PM, David Andrews wrote: Great catch, Steve. Thanks! My z/OS system now tells me: $ java -Dfile.encoding=ISO8859-1 -Dconsole.encoding=IBM-1047 -cp clojure.jar clojure.lang.Repl Clojure user=> (+ 1 1) 2 You're quite welcome, David. I gather (via Google search) that

Re: z/OS and codepage issues?

2009-03-26 Thread David Andrews
Great catch, Steve. Thanks! My z/OS system now tells me: $ java -Dfile.encoding=ISO8859-1 -Dconsole.encoding=IBM-1047 -cp clojure.jar clojure.lang.Repl Clojure user=> (+ 1 1) 2 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Go

Re: file io

2009-03-26 Thread Victor Rodriguez
On Tue, Mar 24, 2009 at 11:05 PM, Korny Sietsma wrote: > It'd be nice to have a macro that worked more like the first example - > "spit" is great for one-liners, but the fact that it opens and closes the > file each time you call it seems a bit painful for anything more complex. > Something that

Re: z/OS and codepage issues?

2009-03-26 Thread Stephen C. Gilardi
On Mar 10, 2009, at 1:03 PM, David Andrews wrote: One person suggested to me that "The code is probably doing something odd with how it reads input, making bad assumptions about the codepage being "ASCII". Running with ISO8859-1 as the file encoding usually fixes this, but apparently not in thi

Re: z/OS and codepage issues?

2009-03-26 Thread Rich Hickey
On Mar 10, 1:03 pm, David Andrews wrote: > I'm having difficulty running Clojure underz/OS. If I download a > current Clojure onto my Gentoo Linux system and build it so: >svn checkouthttp://clojure.googlecode.com/svn/trunk/clojure-read- > only >cd clojure-read-only >ant > Then I c

Re: Trying to get a list of random numbers using repeat

2009-03-26 Thread Paul Drummond
2009/3/26 Jon : > You probably figured this out, but what you want is something like: > (map rand-int (repeat SIZE MAX)) In fact - I didn't think of this - thanks! This is what I used: (map rand-int (repeat Integer/MAX_VALUE)) I have been around since the beginning of Clojure but my journey to

Re: Trying to get a list of random numbers using repeat

2009-03-26 Thread Jon
You probably figured this out, but what you want is something like: (map rand-int (repeat SIZE MAX)) On Mar 23, 7:43 pm, Paul Drummond wrote: > Hi all, > > user=> (repeat 10 (rand-int 49)) > (4 4 4 4 4 4 4 4 4 4) > > Can someone please tell me why this doesn't work? > > It must be something obvi

Re: oo

2009-03-26 Thread Konrad Hinsen
On 26.03.2009, at 14:59, Rich Hickey wrote: > Plus the inability to dispatch on other than class or eql, the > inability to superimpose another taxonomy without redefining the > class, the inability to have multiple independent taxonomies... The ability to have multiple taxonomies is indeed very

Book erratum (was: Clojure + Java compilation and IntelliJ IDEA plugin)

2009-03-26 Thread Stuart Halloway
Ilya, I have checked in a unit test for the tasklist example that demonstrates it working correctly locally. Can you try it and see what's different for you? Git repos: http://github.com/stuarthalloway/programming-clojure/tree/master Then "bin/runtests.sh" or "bin\runtests.bat" depending on

Re: oo

2009-03-26 Thread Rich Hickey
On Mar 25, 6:47 am, mikel wrote: > On Mar 25, 4:13 am, Mark Engelberg wrote: > > > On Wed, Mar 25, 2009 at 1:44 AM, Konrad Hinsen > > > wrote: > > > Could you elaborate a bit on this? I haven't met any major obstacles > > > with multimethods yet. The dispatch functions give quite a lot of > >

Re: Is there already a function to apply functions to maps by key?

2009-03-26 Thread David Sletten
On Mar 26, 2009, at 2:31 AM, Christophe Grand wrote: > (def foo {:a 5 :b 7}) > (merge-with #(%2 %1) foo {:a inc :b #(+ 5 %)}) > ;; should return {:a 6 :b 12} So then we can do this: (defstruct programmer :name :language :iq) (defn upgrade [programmer] (merge-with #(%2 %1) programmer {:langu

Re: Is there already a function to apply functions to maps by key?

2009-03-26 Thread Christophe Grand
(def foo {:a 5 :b 7}) (merge-with #(%2 %1) foo {:a inc :b #(+ 5 %)}) ;; should return {:a 6 :b 12} On Wed, Mar 25, 2009 at 11:27 PM, kinghajj wrote: > > If not, I think it's pretty useful. There should be an easy way to > apply functions to maps' values by keys. > > (defn update > [m & keyfuns]

Re: Is there already a function to apply functions to maps by key?

2009-03-26 Thread Christian Vest Hansen
user=> (def foo {:a 5 :b 7}) #'user/foo user=> (update-in foo [:a] inc) {:a 6, :b 7} user=> On Wed, Mar 25, 2009 at 11:27 PM, kinghajj wrote: > > If not, I think it's pretty useful. There should be an easy way to > apply functions to maps' values by keys. > > (defn update >  [m & keyfuns] >    

Is there already a function to apply functions to maps by key?

2009-03-26 Thread kinghajj
If not, I think it's pretty useful. There should be an easy way to apply functions to maps' values by keys. (defn update [m & keyfuns] (let [[key fun & rest] keyfuns] (if (and key fun) (recur (assoc m key (fun (key m))) rest) m))) (def foo {:a 5 :b 7}) (def bar (updat

Re: oo

2009-03-26 Thread Marko Kocić
On 25 мар, 21:41, mikel wrote: > Tinyclos is decent, and lots of people have made good use of it. For > example, it's a "standard" extension to Chicken Scheme (insofar as > anything to do with Chicken Scheme can be called "standard") and has > lots of enhancements provided by Felix. I'll take

Re: Clojure + Java compilation and IntelliJ IDEA plugin

2009-03-26 Thread Christian Vest Hansen
On Thu, Mar 26, 2009 at 6:33 AM, AlamedaMike wrote: > >>> It's very good question, and to be honest I don't know exact question for > it. I may imagine both cases from Clojure to Java and vise versa. > Making > first variant default I was followed by one letter I had received. It > was > about so

Re: exposing specific functions via namespace

2009-03-26 Thread Parth
On Mar 26, 8:35 am, "John D. Hume" wrote: > On Wed, Mar 25, 2009 at 12:05 PM, Parth wrote: > > I have split up the foo namespace across multiple files. So, > > I have the following now: > > > src/org/ppm/foo.clj -> org.ppm.foo > > src/org/ppm/bar.clj -> org.ppm.foo > > src/org/ppm/baz.clj -> o

Re: Slime integration

2009-03-26 Thread Tassilo Horn
vseguip writes: Hi! > Just responding to myself, the issue seems to have been fixed by > itself. OTOH compiler errors don't popup like before. I can see them > in the *SLIME Compilation* buffer but clicking on them doesn't lead to > the source code. The faulty lines are also not highlighted in