Re: Help optimizing array-to-integer operation?

2010-03-24 Thread ataggart
It was added here: http://github.com/richhickey/clojure/commit/d0e1eef26abd215668ed27357839b2bba4ba095c Not automatically overflowing numbers is a Good Thing. For example: http://seclists.org/fulldisclosure/2010/Mar/447 Though the behavior now deviates from the java casting behavior where the

Re: destructuring / rest (was: Re: Counting vowels, take II.)

2010-03-24 Thread Meikel Brandmeyer
Hi, On Mar 24, 2:22 am, Douglas Philips d...@mac.com wrote: would (let [s1 (first seq1)              s1tail (rest seq1)] ...) be any better? rest says it calls seq on its argument, and that would   force as well? Hmmm... So only things like map are able to realize first without   realizing

Re: Clojure/LLVM

2010-03-24 Thread mac
Like Per says, if you want to compile Clojure to LLVM code that's probably a huge project, have you looked at VMKit? I think that's a JVM/CLR implementation based on LLVM, perhaps it could run Clojure? If you just want to use LLVM from Clojure however, you can use my C FFI clj-native with the C

Re: Introduction + question re. diff between 'Programming Clojure'

2010-03-24 Thread Konrad Hinsen
On 23 Mar 2010, at 21:04, Robert Lally wrote: Is there a technical reason that one should prefer the (.method object) syntax over the (. object method) variant or is it purely a style that the community has converged on? It's purely style. You can easily verify that (.method object) is

Re: Clojure/LLVM

2010-03-24 Thread Konrad Hinsen
On 24 Mar 2010, at 07:40, mac wrote: If you just want to use LLVM from Clojure however, you can use my C FFI clj-native with the C interface for LLVM. I actually made it because I wanted to play around with LLVM but I never got around to actually doing that again once I had a working version of

Re: ANN: labrepl, making Clojure more accessible

2010-03-24 Thread Alex Ott
Hello Mark Derricutt at Wed, 24 Mar 2010 09:30:26 +1300 wrote: MD 1.3.2 is the latest version of the plugin and fixes some issues with the replScript settings ( it actually continues to run the repl, and not MD just exits - doh!) Yes, I already fixed this in my repo and created pull request

Re: Why I have chosen not to employ clojure

2010-03-24 Thread Konrad Hinsen
On 23 Mar 2010, at 19:53, Lee Spector wrote: I'm intrigued by what I've read here about labrepl, but can someone tell me if it's possible that the lein installation step will mess up my existing setup in any way? I don't think so. Unless you have an existing script called lein on your

Re: Help optimizing array-to-integer operation?

2010-03-24 Thread Per Vognsen
I never said automatic overflowing is a good thing per se. The problem is that the expectations set by hexadecimal notation are violated. When I write 0xFF, I don't mean the abstract mathematical number 255; I mean the number whose bit representation (e.g. one's complement for signed integers)

Re: Clojure/LLVM

2010-03-24 Thread mac
Clarification of lettersoup: JNI = java native interface, the C/C++ interface to java. JNA = java native access, an API that aims to simplify java/C interop. clj-native is built upon JNA and is at present a rather thin wrapper so it's good to learn a bit about JNA to get the most out of clj-

Re: Introduction + question re. diff between 'Programming Clojure'

2010-03-24 Thread Laurent PETIT
2010/3/24 Konrad Hinsen konrad.hin...@fastmail.net: On 23 Mar 2010, at 21:04, Robert Lally wrote: Is there a technical reason that one should prefer the (.method object) syntax over the (. object method) variant or is it purely a style that the community has converged on? It's purely style.

Re: ANN: labrepl, making Clojure more accessible

2010-03-24 Thread Lee Spector
Thanks to all who reassured me on the non-interference of lein/labrepl with my existing setup. I did follow the labrepl getting started instructions, get it working, and see that there's some great stuff in there. Very much appreciated and I may want to use this if I teach Clojure in the

Re: web starting clojure apps without Java code

2010-03-24 Thread Eugen Dück
Hi Zmitro, you should see kanjis being detected as you draw the strokes. Maybe the app didn't re-layout properly, that's why you didn't see the kanji panel on the right hand side. I changed the jar slightly, and if the re-layout thing was the reason, it could be fixed now. if you still only see a

Re: ANN: labrepl, making Clojure more accessible

2010-03-24 Thread Laurent PETIT
Hi Lee, Please note that Stuart added to the README the tutorial for Eclipse/ccw. I wrote it so that if every step works as expected (it did with my own tests), there is no pre-requisite but having a JVM on your machine : no need to know/install Git on the command line, no need to know/install

Re: listing factors of a number

2010-03-24 Thread Glen Rubin
it looks like that code will suffice. Thanks!! On Mar 23, 9:38 pm, Per Vognsen per.vogn...@gmail.com wrote: I'm sure that code would be useful if he were looking for a slow implementation of a slow algorithm. I believe he asked for an optimized algorithm. An example might be Lenstra's

Re: destructuring / rest (was: Re: Counting vowels, take II.)

2010-03-24 Thread Douglas Philips
On 2010 Mar 24, at 2:39 AM, Meikel Brandmeyer wrote: On Mar 24, 2:22 am, Douglas Philips d...@mac.com wrote: would (let [s1 (first seq1) s1tail (rest seq1)] ...) be any better? rest says it calls seq on its argument, and that would force as well? Hmmm... So only things like map are

determining index number for item in list

2010-03-24 Thread Glen Rubin
I wrote the following code to produce a lazy sequence of the triangle numbers. (triangle numbers are the series of numbers: 1, 1+2, 1+2+3, etc...) (defn tri-nums [] prduce a lazy sequence of triangle numbers (let [triangles (map #(range 1 %) (iterate inc 2))] (map #(reduce + %)

Re: ANN: labrepl, making Clojure more accessible

2010-03-24 Thread Zmitro Lapcjonak
On Mar 23, 4:13 pm, Stuart Halloway stuart.hallo...@gmail.com wrote: The labrepl project (http://github.com/relevance/labrepl) is a   tutorial environment for learning Clojure. ... (2) CounterClockwise integration: Ditto above but for Eclipse/ I followed the steps and successfully runned the

Re: determining index number for item in list

2010-03-24 Thread Meikel Brandmeyer
Hi, On Mar 24, 2:21 pm, Glen Rubin rubing...@gmail.com wrote: (loop [x 1 y (first (tri-nums))] ...    (recur (inc x) (first (rest (tri-nums You call tri-nums twice. So you get fresh seqs each time. You have to work on a single seq. (loop [counter 1 tris(tri-nums)] (let [t

Re: ANN: labrepl, making Clojure more accessible

2010-03-24 Thread Zmitro Lapcjonak
On Mar 23, 10:18 pm, Rob Wolfe r...@smsnet.pl wrote: Stuart Halloway stuart.hallo...@gmail.com writes: The labrepl project (http://github.com/relevance/labrepl) is a What about creating standalone ZIP file, which will contain all necessary components: Clojure, Leiningem and Labrepl? I

Re: determining index number for item in list

2010-03-24 Thread Per Vognsen
On Wed, Mar 24, 2010 at 8:21 PM, Glen Rubin rubing...@gmail.com wrote: I wrote the following code to produce a lazy sequence of the triangle numbers.  (triangle numbers are the series of numbers: 1, 1+2, 1+2+3, etc...) (defn tri-nums []  prduce a lazy sequence of triangle numbers  (let

Re: ANN: labrepl, making Clojure more accessible

2010-03-24 Thread Laurent PETIT
2010/3/24 Zmitro Lapcjonak idob...@gmail.com: On Mar 23, 4:13 pm, Stuart Halloway stuart.hallo...@gmail.com wrote: The labrepl project (http://github.com/relevance/labrepl) is a tutorial environment for learning Clojure. ... (2) CounterClockwise integration: Ditto above but for Eclipse/ I

Re: Clojure/LLVM

2010-03-24 Thread Konrad Hinsen
On 24.03.2010, at 11:22, mac wrote: With regards to copying of data, clj-native expects nio buffers to be used as input where a native function requires a typed pointer. These buffers can be allocated outside of the JVM heap specifically to avoid copying. For example

Re: ANN: labrepl, making Clojure more accessible

2010-03-24 Thread Zmitro Lapcjonak
On Mar 24, 3:53 pm, Laurent PETIT laurent.pe...@gmail.com wrote: 2010/3/24 Zmitro Lapcjonak idob...@gmail.com: On Mar 23, 4:13 pm, Stuart Halloway stuart.hallo...@gmail.com wrote: The labrepl project (http://github.com/relevance/labrepl) is a tutorial environment for learning Clojure.

Re: ANN: labrepl, making Clojure more accessible

2010-03-24 Thread Laurent PETIT
Cool ! 2010/3/24 Zmitro Lapcjonak idob...@gmail.com: On Mar 24, 3:53 pm, Laurent PETIT laurent.pe...@gmail.com wrote: 2010/3/24 Zmitro Lapcjonak idob...@gmail.com: On Mar 23, 4:13 pm, Stuart Halloway stuart.hallo...@gmail.com wrote: The labrepl project

Re: web starting clojure apps without Java code

2010-03-24 Thread Eugen Dück
I just tried starting it from a Windows box, and for some reason, the kanjis are not displayed there. Maybe it's a font issue, not sure yet. Will investigate. On Mar 24, 9:06 pm, Eugen Dück eu...@dueck.org wrote: Hi Zmitro, you should see kanjis being detected as you draw the strokes. Maybe

Completions and XREFs [Re: Introduction + question re. diff between 'Programming Clojure']

2010-03-24 Thread Terje Norderhaug
On Mar 24, 2010, at 3:53 AM, Laurent PETIT wrote: 2010/3/24 Konrad Hinsen konrad.hin...@fastmail.net: The original version (. object method) still could have an interest where IDEs could guess the method names to propose based on what they could infer from the object arg. With the (.methodName

Re: ANN: labrepl, making Clojure more accessible

2010-03-24 Thread invis
I am trying to start labrepl with emacs. Labrepl is working nice, but I cant slime-connect :( Have this message: open-network-stream: make client process failed: connection refused, :name, SLIME Lisp, :buffer, nil, :host, 127.0.0.1, :service, 4005 Could you tell me how to fix it ? -- You

Re: The end goal

2010-03-24 Thread Michael Richter
On 23 March 2010 22:43, Joel Martin nos...@martintribe.org wrote: I'll know that this problem is solved when the Setup and Getting Started sections of the main Getting Started page resemble this: - For debian and Ubuntu users: apt-get install clojure For Fedora and CentOS users:

Re: Can't call public method of non-public class

2010-03-24 Thread Mark J. Reed
On Tue, Mar 23, 2010 at 7:38 PM, Stuart Campbell stuart.william.campb...@gmail.com wrote: From JDK docs (http://java.sun.com/j2se/1.5.0/docs/api/java/lang/ProcessBuilder.html#environment%28%29): The behavior of the returned map is system-dependent. A system may not allow modifications to

RE: labrepl, making Clojure more accessible

2010-03-24 Thread Kevin
Help wanted: (5) Out-of-box experience audit. Is the leiningen-based setup easy enough? If not, please make something simpler (maybe shell scripts that pull the libs from a download site?) (6) Better windows instructions/integration. Very nice! I'm looking at it now, on windows XP;

Re: Help optimizing array-to-integer operation?

2010-03-24 Thread Josh Arnold
 I can't think of many cases where a downcast is used *and* the original value is expected to ever be larger than the target type. I can. Particularly when casting to a byte, I'm often more interested in the bit pattern than the integer value. (Admittedly, sometimes this is due to java API

Re: Can't call public method of non-public class

2010-03-24 Thread Mark J. Reed
This looks like the old type erasure problem - the returned map is of a private class, so clojure looks for a public version of the put method in one of the interfaces/base classes - but does an exact comparison on parameter types, so put(String, String) doesn't match put(Object, Object) and the

Re: Help optimizing array-to-integer operation?

2010-03-24 Thread Raph
Thank you, Konrad. Unrolling the bit-or computations helped; total time for 8,000,000 iterations was 1305 msecs. Per, you are correct. The byte issue (0xFF out of range) is why I have to include the mask. I think this is more Java's limitation than anything. 0xFF is not a valid value for a byte

Operational Transformations

2010-03-24 Thread drrobot
Hi Clojurians, Clojure's STM seems great for maintaining consistent state on a single machine with concurrent processes, but what about synchronizing state across multiple computers with higher latency? I've been wondering a lot lately how Google wave works considering all the significant latency

Re: Can't call public method of non-public class

2010-03-24 Thread Konstantin Barskiy
Thanks a lot! Is there way to do the same thing using 'doto'? e.g. (doto (.environment pb) (.put Var1 myValue)) I can't figure out where to place #^Map hint... On Mar 24, 5:19 am, Armando Blancas armando_blan...@yahoo.com wrote: You want Clojure to treat 'env' as a Map instead of its

Re: Can't call public method of non-public class

2010-03-24 Thread Mark J. Reed
As far as I can tell, you're doing nothing wrong and just hitting a bug in Clojure. Which is still in 1.2.0-master... On Tue, Mar 23, 2010 at 11:43 AM, Konstantin Barskiy zuftw...@gmail.com wrote: I'm trying to reproduce ProcessBuilder example from java documentation

Re: determining index number for item in list

2010-03-24 Thread Tobias Hauth
Hi, I think you want to use 'indexed' from clojure.contrib with your tri-nums to get a lazy indexed sequence. Tobias On Wed, Mar 24, 2010 at 2:21 PM, Glen Rubin rubing...@gmail.com wrote: I wrote the following code to produce a lazy sequence of the triangle numbers. (triangle numbers are

Parsing parameters in clojure.core

2010-03-24 Thread Thomas
Hi all, I've been reading through clojure.core to see examples of fine clojure style. One thing I've noticed is (what I consider) a weird notation when parsing parameters for function. As an example, consider the function juxt: (defn juxt Alpha - name subject to change. Takes a set of

Re: Would it be possible to make a dumped clojure, a la dumped emacs?

2010-03-24 Thread Alex Coventry
My impression from reading Remco van 't Veer's posts about his experience running clojure on Android is that it tends to be slow in general because introspection is expensive in Dalvik. So while you can sprinkle typehints throughout your own code, you really don't want to do that to the core, and

Re: ANN: labrepl, making Clojure more accessible

2010-03-24 Thread Shawn Hoover
On Wed, Mar 24, 2010 at 11:59 AM, invis invi...@gmail.com wrote: I am trying to start labrepl with emacs. Labrepl is working nice, but I cant slime-connect :( Have this message: open-network-stream: make client process failed: connection refused, :name, SLIME Lisp, :buffer, nil, :host,

Re: determining index number for item in list

2010-03-24 Thread Glen Rubin
Of course! I keep making stupid mistakes like thisarg!!! On Mar 24, 9:28 am, Meikel Brandmeyer m...@kotka.de wrote: Hi, On Mar 24, 2:21 pm, Glen Rubin rubing...@gmail.com wrote: (loop [x 1 y (first (tri-nums))] ...    (recur (inc x) (first (rest (tri-nums You call

^#'

2010-03-24 Thread HiHeelHottie
Why does ^#' get you the meta data? http://clojure.org/special_forms user= ^#'mymax -{:name mymax, :user/comment this is the best fn ever!, I couldn't find it documented in http://clojure.org/reader. #' seems to match Var-quote (#'), but why does ^ get you metadata when that page uses

Interfaces, Method/Constructor signatures, and ClassCastExceptions (bug?)

2010-03-24 Thread Jeremy Wall
I'm not sure if I've found a bug or I'm just doing it wrong, or I'm just trying to do something I shouldn't try to do. But I'm currently having an issue when trying to set up a clojure appengine project. you can see my offending code snippet here: http://gist.github.com/341873 but setting up the

RE: ANN: labrepl, making Clojure more accessible

2010-03-24 Thread Kevin
The labrepl project (http://github.com/relevance/labrepl) is a tutorial environment for learning Clojure. ... (2) CounterClockwise integration: Ditto above but for Eclipse/ I followed the steps and successfully runned the labrepl with Eclipse and CCW. Good ! Which environment

Re: The end goal

2010-03-24 Thread Ramakrishnan Muthukrishnan
On Wed, Mar 24, 2010 at 8:36 AM, Michael Richter ttmrich...@gmail.com wrote: I don't know the process, but I'm willing to endure the tedium of packaging clojure for Ubuntu (and by extension Debian) if this is the kind of thing that can be a two-person job. clojure and clojure-contrib are

Re: ^#'

2010-03-24 Thread Meikel Brandmeyer
Hi, On Mar 24, 5:40 am, HiHeelHottie hiheelhot...@gmail.com wrote: user= ^#'mymax -{:name mymax,    :user/comment this is the best fn ever!, I couldn't find it documented inhttp://clojure.org/reader.  #' seems to match Var-quote (#'), but why does ^ get you metadata when that page uses

Re: listing factors of a number

2010-03-24 Thread Mark Engelberg
Check out clojuratica. It interfaces Clojure to a free version of mathematica which has a very fast implementation called FactorInteger. --Mark -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Parsing parameters in clojure.core

2010-03-24 Thread Sean Devlin
It's a (drastic) performance improvement. The magic number of 3 appears to cover a lot of use cases. Once you get larger than three, it typically is a large number of inputs, i.e. the tail flattens off. On Mar 23, 5:00 pm, Thomas thomas.g.kristen...@gmail.com wrote: Hi all, I've been reading

Re: Interfaces, Method/Constructor signatures, and ClassCastExceptions (bug?)

2010-03-24 Thread .Bill Smith
Jeremy, Try this instead: (.cast SomeInterface SomeInterfaceImplInstance) Example: user= (.cast (class java.util.Set) (java.util.HashSet.)) java.lang.ClassCastException (NO_SOURCE_FILE:0) user= (.cast java.util.Set (java.util.HashSet.)) #HashSet [] On Mar 23, 9:07 pm, Jeremy Wall

Re: Clojure/LLVM

2010-03-24 Thread mac
I think get/put are pretty fast but there is also the possibility of slicing arrays in and out of nio buffers on the java side which maybe could be faster if you want to modify many values and have some memory to spare. For example if you have a nio buffer several hundred megabytes big and you

Re: Interfaces, Method/Constructor signatures, and ClassCastExceptions (bug?)

2010-03-24 Thread Jeremy Wall
That seems to work but doesn't fix the clojure problem. Since clojure is preforming the cast on my behalf in a call to Reflector.boxArg On Mar 24, 12:29 pm, .Bill Smith william.m.sm...@gmail.com wrote: Jeremy, Try this instead: (.cast SomeInterface SomeInterfaceImplInstance) Example: user=

Re: ANN: labrepl, making Clojure more accessible

2010-03-24 Thread Tchavdar Roussanov
(3) IDEA integration: Ditto but for IDEA/La Clojure. I have tested labrepl on IntelliJ IDEA Ultimate 9 on Mac: Here are the steps to install and run: 1. One time setup: * Get labrepl from github (no need for leiningen). * Install La Clojure plugin: * Prefereneces/Plugins/Available,

Re: Help optimizing array-to-integer operation?

2010-03-24 Thread Mark J. Reed
On Tue, Mar 23, 2010 at 8:19 PM, Raph mart...@gmail.com wrote: (My opinion, anyway.I think a byte should be 8 bits and I should be able to use all of them.) Er, it is, and you can. A Java byte still gives you all 8 bits' worth of 256 different possible values; the interpretation of those

How to name a byte array class/type for multi-method dispatch?

2010-03-24 Thread Frank Siebenlist
The following repl session shows my attempt to dispatch a multimethod on type: ... user (defmulti mm type) #'user/mm user (type a) java.lang.String user (defmethod mm java.lang.String [s] (println string)) #MultiFn clojure.lang.mult...@41e3a0ec user (mm a) string nil user (type (.getBytes a)) [B

Re: Interfaces, Method/Constructor signatures, and ClassCastExceptions (bug?)

2010-03-24 Thread .Bill Smith
How big is your project? Can you reproduce it using something smaller? On Mar 24, 12:44 pm, Jeremy Wall jw...@google.com wrote: That seems to work but doesn't fix the clojure problem. Since clojure is preforming the cast on my behalf in a call to Reflector.boxArg -- You received this message

Re: Interfaces, Method/Constructor signatures, and ClassCastExceptions (bug?)

2010-03-24 Thread .Bill Smith
Never mind -- didn't realize those classes are part of the Google app engine. On Mar 24, 1:06 pm, .Bill Smith william.m.sm...@gmail.com wrote: How big is your project?  Can you reproduce it using something smaller? On Mar 24, 12:44 pm, Jeremy Wall jw...@google.com wrote: That seems to work

Re: Interfaces, Method/Constructor signatures, and ClassCastExceptions (bug?)

2010-03-24 Thread .Bill Smith
Jeremy, try it this way instead: http://gist.github.com/342607 On Mar 24, 1:22 pm, .Bill Smith william.m.sm...@gmail.com wrote: Never mind -- didn't realize those classes are part of the Google app engine. On Mar 24, 1:06 pm, .Bill Smith william.m.sm...@gmail.com wrote: How big is your

Re: Interfaces, Method/Constructor signatures, and ClassCastExceptions (bug?)

2010-03-24 Thread Jeremy Wall
I could whip up something small using an interface and and two classes that would do it I think. and provide a jar with that reproduces the problem with clojure source code. Would that help? .Bill Smith wrote: Never mind -- didn't realize those classes are part of the Google app engine. On

Re: Help optimizing array-to-integer operation?

2010-03-24 Thread ataggart
Quite right. My comment was mainly aimed at something like casting 0xABC to a byte, and didn't consider the signed value problem. I think this is a good case for a separate function, such as the one you provided. On Mar 24, 8:21 am, Josh Arnold josharnol...@gmail.com wrote:  I can't think of

Re: Confused about =, native java arrays and seqs...

2010-03-24 Thread André Ferreira
Arrays are mutable, seqs immutable. Clojure ='s compares immutable structures by value, and mutable structures by reference (for the objects that it is aware of, for others it just prays that they have a resoanable equals method). This behaviour is described in the very interisting Henry Baker's

Re: Help optimizing array-to-integer operation?

2010-03-24 Thread ataggart
Done: https://www.assembla.com/spaces/clojure/tickets/284-cannot-cast-0xff-to-a-byte-(fails-out-of-range-check) On Mar 24, 10:57 am, Mark J. Reed markjr...@gmail.com wrote: On Tue, Mar 23, 2010 at 8:19 PM, Raph mart...@gmail.com wrote: (My opinion, anyway.I think a byte should be 8 bits and I

Re: Confused about =, native java arrays and seqs...

2010-03-24 Thread Frank Siebenlist
Thanks for the response - guess it is the best one can do living in this mixed mutable/immutable world. Has the seq'ed version of the java byte array become immutable or do we have to pray that nobody changes the underlying array values? -FS. On Mar 24, 2010, at 12:40 PM, André Ferreira

Re: Confused about =, native java arrays and seqs...

2010-03-24 Thread Chouser
On Wed, Mar 24, 2010 at 4:17 PM, Frank Siebenlist frank.siebenl...@gmail.com wrote: Thanks for the response - guess it is the best one can do living in this mixed mutable/immutable world. Has the seq'ed version of the java byte array become immutable or do we have to pray that nobody

Re: Nubie Question

2010-03-24 Thread WoodHacker
Actually, swap! doesn't seem to work in my case.I should state what I'm trying to do.I'm writing a graphics editing program where I want the user to be able to choose and save color values. I start out with a vector containing blank and white. When the user selects a new color and wants

Re: Nubie Question

2010-03-24 Thread David Nolen
On Wed, Mar 24, 2010 at 5:43 PM, WoodHacker ramsa...@comcast.net wrote: Actually, swap! doesn't seem to work in my case.I should state what I'm trying to do.I'm writing a graphics editing program where I want the user to be able to choose and save color values. I start out with a

Re: Nubie Question

2010-03-24 Thread Brendan Ribera
Also, you need to use swap! on an atom, so you'll need to make savedColors one. Read here: http://clojure.org/atoms On Wed, Mar 24, 2010 at 2:51 PM, David Nolen dnolen.li...@gmail.com wrote: On Wed, Mar 24, 2010 at 5:43 PM, WoodHacker ramsa...@comcast.net wrote: Actually, swap! doesn't seem

Re: How to name a byte array class/type for multi-method dispatch?

2010-03-24 Thread ataggart
For type-hinting #^[B works, but for obtaining and passing the class to defmethod, the best I can come up with is (Class/forName [B). On Mar 24, 11:02 am, Frank Siebenlist frank.siebenl...@gmail.com wrote: The following repl session shows my attempt to dispatch a multimethod on type: ...

Re: Nubie Question

2010-03-24 Thread Meikel Brandmeyer
Hi, On Wed, Mar 24, 2010 at 02:43:49PM -0700, WoodHacker wrote: (def savedColors [black, white]) (def savedColors (atom [black white])) Exception in thread AWT-EventQueue-0 java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to clojure.lang.Atom This message should be

Re: How to name a byte array class/type for multi-method dispatch?

2010-03-24 Thread Frank Siebenlist
Right - not very different from the (class (byte-array 1)) that I came up with in the mean time... all not very clojuresque. -FS. On Mar 24, 2010, at 3:03 PM, ataggart wrote: For type-hinting #^[B works, but for obtaining and passing the class to defmethod, the best I can come up with is

Re: listing factors of a number

2010-03-24 Thread Glen Rubin
Except Mathematica is kind of expensive $250 for the home edition. It looks like there is also Incanter which is a similar project using R free statistical computing environment On Mar 24, 12:55 pm, Mark Engelberg mark.engelb...@gmail.com wrote: Check out clojuratica.  It interfaces Clojure to

Re: listing factors of a number

2010-03-24 Thread Mark Engelberg
Like I said, Clojuratica works with the free edition of Mathematica: http://www.wolfram.com/products/player/ I found it tricky to get it all set up the first time, but it is definitely nice to have access to some of those really fast Mathematica functions. On Wed, Mar 24, 2010 at 3:57 PM, Glen

Re: ANN: labrepl, making Clojure more accessible

2010-03-24 Thread Mark Engelberg
I tried following Rob Wolfe's zip file instructions. The bin\lein deps command seemed to work fine, but when I then invoked bin\repl, I got the following error: CLASSPATH=;C:\labrepl-package\lib\ant-1.6.2.jar;C:\labrepl-package\lib\ant-laun

Re: The end goal

2010-03-24 Thread Michael Richter
On 25 March 2010 00:05, Ramakrishnan Muthukrishnan vu3...@gmail.com wrote: On Wed, Mar 24, 2010 at 8:36 AM, Michael Richter ttmrich...@gmail.com wrote: I don't know the process, but I'm willing to endure the tedium of packaging clojure for Ubuntu (and by extension Debian) if this is the

Re: The end goal

2010-03-24 Thread Ramakrishnan Muthukrishnan
On Thu, Mar 25, 2010 at 6:38 AM, Michael Richter ttmrich...@gmail.com wrote: On 25 March 2010 00:05, Ramakrishnan Muthukrishnan vu3...@gmail.com wrote: On Wed, Mar 24, 2010 at 8:36 AM, Michael Richter ttmrich...@gmail.com wrote: I don't know the process, but I'm willing to endure the

Re: How to name a byte array class/type for multi-method dispatch?

2010-03-24 Thread ataggart
The java version would look like: Class c = byte[].class; But since the clojure way to obtain a class is simply to use its name literal, e.g.: user= (type String) java.lang.Class the only way to get the class of an array would involve either a function call or a change to the reader. And java

Beginning Clojure. Recursion

2010-03-24 Thread jfr
Hello, I've just started to play a little bit with clojure to get a feel for the language. It seems to be quite interesting (and it's a relief to leave my clumsy IDE behind and use Emacs). Concerning immutable data: Is the following code ok or should (must) I use transients as variables for the

Re: How to name a byte array class/type for multi-method dispatch?

2010-03-24 Thread ataggart
Ok, after looking into how clojure resolves class literal symbols, it turns out it is already smart enough to recognize symbol names that start with [; the problem is it's a pain to type such symbols into code. Your code can work this way: user= (defmethod mm (resolve (symbol [B)) [b] (println

Re: Beginning Clojure. Recursion

2010-03-24 Thread ataggart
Looks fine. The maps are immutable, but the 'word-map symbol is rebound on each loop to the map returned from merge-with. On Mar 24, 2:15 pm, jfr janfrider...@googlemail.com wrote: Hello, I've just started to play a little bit with clojure to get a feel for the language. It seems to be quite

Re: Interfaces, Method/Constructor signatures, and ClassCastExceptions (bug?)

2010-03-24 Thread Jeremy Wall
That almost worked I just had to add one more piece (into-array #^LocalServiceTestConf [helper-conf#]) So that clojure made the array the right type. Thanks for the help!! On Mar 24, 1:40 pm, Jeremy Wall jw...@google.com wrote: I could whip up something small using an interface and and two

Re: How to name a byte array class/type for multi-method dispatch?

2010-03-24 Thread Frank Siebenlist
Nice research - so is it then the reader that doesn't allow us to escape the [B such that we can write it such that it can be interpreted as a symbol [B ? -Frank. On Mar 24, 2010, at 7:27 PM, ataggart wrote: Ok, after looking into how clojure resolves class literal symbols, it turns out it

Re: Beginning Clojure. Recursion

2010-03-24 Thread Miki
Hello, (defn count-words [words]   Counts the occurrences of all words in the given string. Returns a map with the words as keys, their frequency as values   (loop [my-words (re-seq #[a-zA-ZöäüÖÄÜß]+ words) word-map {}]     (if (empty? my-words)       word-map       (recur (rest my-words)

Re: The end goal

2010-03-24 Thread Michael Richter
On 25 March 2010 09:20, Ramakrishnan Muthukrishnan vu3...@gmail.com wrote: On Thu, Mar 25, 2010 at 6:38 AM, Michael Richter ttmrich...@gmail.com wrote: On 25 March 2010 00:05, Ramakrishnan Muthukrishnan vu3...@gmail.com wrote: On Wed, Mar 24, 2010 at 8:36 AM, Michael Richter

Re: How to name a byte array class/type for multi-method dispatch?

2010-03-24 Thread ataggart
Nope, though thinking further on it, I'm really not a fan of people having to know java's class name encoding scheme for arrays. Personally, I'd prefer writing (array-class String), or have some clojure-specific syntax to denote an array of a class (though some would say clojure has enough syntax

Re: The end goal

2010-03-24 Thread Ramakrishnan Muthukrishnan
On Thu, Mar 25, 2010 at 9:01 AM, Michael Richter ttmrich...@gmail.com wrote: Weird.  I'm showing 1.0 for those. mich...@isolde:~$ aptitude search clojure p   clojure                                                   - a Lisp dialect for the JVM mich...@isolde:~$ aptitude show clojure

Re: Can't call public method of non-public class

2010-03-24 Thread Armando Blancas
You probably can't. I think hints only go in binding declarations. I'd use 'env', as you're probably doing already. But let's keep an eye on Mark's patch, as it'd be much better to avoid an explicit upcasting. On Mar 23, 7:38 pm, Konstantin Barskiy zuftw...@gmail.com wrote: Thanks a lot! Is