Re: Abstract data types in functional languages

2009-04-24 Thread David Nolen
~@(map defget* syms))) (defn replace-syms [code kvs] (loop [loc (z/seq-zip code)] (if (z/end? loc) (z/root loc) (recur (z/next (if-let [match (some #{(z/node loc)} (keys kvs))] (z/replace loc (get kvs match)) loc)) On Fri, Apr 24, 2009 at 8:07 PM, Ma

Re: Abstract data types in functional languages

2009-04-26 Thread David Nolen
You're right. The following includes code for handling this case via setin and getin. I've also ditched macros, because that code couldn't support new lexical scopes in the setter/getter definition. setin getin support works by dynamically resolving getters and setters, thus this is slower than dir

Re: Abstract data types in functional languages

2009-04-26 Thread David Nolen
t; (prop-foo obj) ; --> returns the property prop-foo > (prop-foo obj newval) ; --> returns a new version of obj with prop-foo > property set to newval > > Terse and uniform :-) > > ? > > > > 2009/4/26 David Nolen : > > You're right. The following inclu

Re: Abstract data types in functional languages

2009-04-27 Thread David Nolen
th"}) ; -> "Bob Smith" (acc-name {} "Bob Smith") ; -> {:first "Bob", :last "Smith"}'s On Sun, Apr 26, 2009 at 10:27 PM, David Nolen wrote: > GENIOUS idea Laurent ;) > Extremely terse and uniform. Also because I switched the implementation t

Re: Stack Overflow problem with Maps

2009-04-27 Thread David Nolen
Can you post your code, always helpful :) On Mon, Apr 27, 2009 at 4:07 PM, fitzpatrick...@googlemail.com < fitzpatrick...@googlemail.com> wrote: > > Hi, > I am working with a very long list and populating it to a map. What i > have is three pieces of data from the list; > -Row Number > -Heading i

Re: update/update-in

2009-04-29 Thread David Nolen
Because update-in can use any function to do the update. On Wed, Apr 29, 2009 at 6:54 PM, mifrai wrote: > > Hi, > > I was wondering why there was no "update" to "update-in"? But there is > an "assoc" to "assoc-in" and a "get" to a "get-in". > > - Mike > > > --~--~-~--~~~

Re: update/update-in

2009-04-29 Thread David Nolen
xperience there tends be really good reasons behind > these kinds of decisions and I'm just curious. > > On Apr 29, 4:05 pm, David Nolen wrote: > > Because update-in can use any function to do the update. > > > > On Wed, Apr 29, 2009 at 6:54 PM, mifrai wrote: > > &

Re: Clojure 1.0

2009-05-04 Thread David Nolen
Congrats exciting times! On Mon, May 4, 2009 at 8:58 AM, Rich Hickey wrote: > > After a sustained period of API stability and minimal bugs reports, > I'm happy to announce the release of Clojure 1.0! > > http://clojure.googlecode.com/files/clojure_1.0.0.zip > > Numbered releases will enable peop

Re: Got a Clojure library?

2009-05-04 Thread David Nolen
Name: clj-contURL: http://github.com/swannodette/clj-cont/ Author: David Nolen Tags: continuations License: MIT Dependencies: clojure-contrib (error-kit) Description: Port of Common Lisp cl-cont library. Adds support for delimited continuations by transforming regular Clojure code into

Re: Help: Newbie question get contributed libraries to work

2009-05-05 Thread David Nolen
What environment are you using? VimClojure? Emacs+SLIME? I will say that Enclojure+NetBeans does make things really simple if you're just trying things out. David On Tue, May 5, 2009 at 1:20 PM, Leotis buchanan wrote: > Hey Guys, > > I am trying to use a few of the cool clojure contributed libr

Re: Enlive questions

2009-05-05 Thread David Nolen
Seems to be working great now. On Wed, May 6, 2009 at 1:36 AM, Christophe Grand wrote: > > Hello Ryan, > > rzeze...@gmail.com a écrit : > > Either I've missed something, or Enlive *appears* to have problems > > handling comment tags. > > > Indeed. I pushed a fix, please tell me whether it works f

Re: CL libraries - Newbie question

2009-05-08 Thread David Nolen
Not unless you port it ;) Between what's in clojure-contrib and the fact that you have full access to Java XML processing libraries you shouldn't have a problem with dealing with XML. Depending on your needs you should also give Enlive a spin. It's like XPath+XSLT but it doesn't suck. On Fri, May

Re: java faster than clojure?(probably not)

2009-05-09 Thread David Nolen
I would set your *warn-on-reflection* flag of course to see if you're missing out on any type hinting. Also watch out for math ops that involve more than 2 arguments: ;; takes ~400ms on my machine (time (dotimes [x 100] (* 1 2 3))) ;; takes ~50ms on my machine (time (dotimes [x 100] (* 1

Re: java faster than clojure?(probably not)

2009-05-09 Thread David Nolen
Also type hinting your math ops like mad on tight loops helps: ;; ~20ms (time (dotimes [x 100] (* (float 1.0) (* (float 2.0) (float 3.0) ;; ~65ms (time (dotimes [x 100] (* 1.0 (* 2.0 3.0 Another 3x increase. On May 9, 6:53 pm, Julien wrote: > I'm interested to

Re: cloggle: OpenGL library for Clojure

2009-05-09 Thread David Nolen
Cool, I couldn't get this to work, I get an exception like the following: Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: wrong number of arguments The original version works alright for me. Also you should organize the library folder in the standard way so that your li

Re: java faster than clojure?(probably not)

2009-05-09 Thread David Nolen
What's a sample set of values you would pass to this function? On Sat, May 9, 2009 at 7:35 PM, Julien wrote: > > > > Out of curiosity, how long does that function take to execute in Java? > > The java version is much faster even with much more work to do, which > put me perplex. > I didn't check

Re: java faster than clojure?(probably not)

2009-05-09 Thread David Nolen
(set! *warn-on-reflection* true) (defn byte-array-sound [frequency sample-rate nb-frame] (let [sample-array (make-array (. Byte TYPE) (* nb-frame 2)) sample-interval (/ (float frequency) (float sample-rate)) limit (alength sample-array)] (loop [sample-index 0 impulse-train (float 0)]

Re: java faster than clojure?(probably not)

2009-05-10 Thread David Nolen
This particular case also looks easy parallelize. Using agents you can divide the execution time by number of available CPUs. On Sun, May 10, 2009 at 9:35 AM, Julien wrote: > > here's a improved version of the byte-array-sound function which is > probably easier to understand. based upon a real

Re: cloggle: OpenGL library for Clojure

2009-05-10 Thread David Nolen
, May 9, 2009 at 10:02 PM, philip.hazel...@gmail.com < philip.hazel...@gmail.com> wrote: > > On May 10, 12:37 am, David Nolen wrote: > > Cool, I couldn't get this to work, I get an exception like the following: > > Exception in thread "AWT-EventQueue-0" >

Re: Clojure Poetry

2009-05-13 Thread David Nolen
I notice this code is using lists instead of vectors, this quite a performance hit, on my machine: (def my-vector (vec (range 0 1000))) (def my-list (apply list (range 0 1000))) ;; ~30ms (time (dotimes [x 100] (nth my-vector 999))) ;; ~9000ms (time (dotimes [x 100] (nth my-list 999))) On

Colored parentheses highlighting for Emacs Clojurians

2009-05-13 Thread David Nolen
This works really well: http://nschum.de/src/emacs/highlight-parentheses/ --~--~-~--~~~---~--~~ 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 To unsubscribe f

Re: Google App Engine - best workflow

2009-05-13 Thread David Nolen
Since deployed GAE apps use something that works like Jetty you could just develop against Compojure and make sure you aren't doing anything that launches a new thread. Then do sanity checks against the dev server before deploying. This way you get the speed of REPL style development, and only get

Re: Help with Type Hint

2009-05-14 Thread David Nolen
This baffled me as well. You need to cast to int. On Thu, May 14, 2009 at 11:22 AM, tmountain wrote: > > I'm trying to optimize some code I've written, and I have set warn on > reflection as advised. I'm having a hard time getting a simple > statement to avoid reflection. > > user=> (== (byte 0x

Re: Help with Type Hint

2009-05-14 Thread David Nolen
(== (int (byte key)) (int (byte (aget coll i >true >(recur (inc i)) > > Travis > > On May 14, 11:40 am, tmountain wrote: > > If that's the case, would I even get a performance increase, or would > > the cast overhead cost more than the impl

Why do Refs implement IFn and Atoms don't?

2009-05-14 Thread David Nolen
Just curious about the reasoning behind this decision? ((ref +) 3 4) ; -> 7 ((atom +) 3 4) ; Exception --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@goog

Re: Colored parentheses highlighting for Emacs Clojurians

2009-05-14 Thread David Nolen
> > On May 13, 5:53 pm, David Nolen wrote: > > This works really well:http://nschum.de/src/emacs/highlight-parentheses/ > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clo

Re: Speed up network transfers?

2009-05-15 Thread David Nolen
It looks like you're reading one byte at a time. Why not create a buffer and read up to 1024 bytes at a time? (defn write-file [ins outs] (let [buffer (make-array Byte/TYPE 1024)] (loop [len (.read ins buffer)] (if (not (neg? len)) (do (.write outs buffer 0 len) (recur (.read ins bu

Re: list vs vector

2009-05-15 Thread David Nolen
And here are some numbers from my machine: (def my-list (list 'a 'b 'c 'd 'e 'f 'g 'h 'i 'j)) (def my-vector ['a 'b 'c 'd 'e 'f 'g 'h 'i 'j]) ; ~44ms (time (dotimes [x 100] (conj my-list 'k))) ; ~26ms (time (dotimes [x 100] (pop my-list))) ; ~100ms (time (dotimes [x 100] (conj my-vec

Re: Question about building modular code in Clojure

2009-05-17 Thread David Nolen
Have you looked at the immigrate function in Compojure? This imports public vars from a different namespace into a namespace as if they were defined there. Maybe this is enough to get the behavior that you want? On Sun, May 17, 2009 at 9:12 PM, Mark Engelberg wrote: > > On Sun, May 17, 2009 at 2:

Re: Question about building modular code in Clojure

2009-05-17 Thread David Nolen
rav-stats) On Mon, May 18, 2009 at 12:11 AM, Mark Engelberg wrote: > > On Sun, May 17, 2009 at 8:12 PM, David Nolen > wrote: > > Have you looked at the immigrate function in Compojure? This imports > public > > vars from a different namespace into a namespace as if they w

Re: CLJDB: Using Emacs/JDB mode with Clojure

2009-05-20 Thread David Nolen
Wow this sounds fantastic. Wanna put this on GitHub so people can fork it and work on it concurrently? ;) On Wed, May 20, 2009 at 1:51 PM, George Jahad wrote: > > Hi Kids: > > I've been working on integrating Emacs JDB, (command line java debug > interface,) mode with Clojure. It still a work in

Re: CLJDB: Using Emacs/JDB mode with Clojure

2009-05-20 Thread David Nolen
Wow, that was quick thanks. On Wed, May 20, 2009 at 3:26 PM, George Jahad wrote: > > > > On May 20, 11:20 am, David Nolen wrote: > > Wow this sounds fantastic. Wanna put this on GitHub so people can fork it > > and work on it concurrently? ;) > > > > Good ide

Re: Call for Help!: Clojure Code for JavaOne Talk

2009-05-23 Thread David Nolen
Put them in a namespace. (ns prime-seive) ... definitions ... On Saturday, May 23, 2009, michaelg wrote: > > Thanks Chouser, very nice! I am quite aware of the performance boost > of using ints instead of strings -- this was an intentional choice on > my part. When I first solved the problem,

Re: CLJDB: Using Emacs/JDB mode with Clojure

2009-05-25 Thread David Nolen
implement? Thanks for creating this! Being able to step through and examine locals is a fantastic thing. On Wed, May 20, 2009 at 3:26 PM, George Jahad wrote: > > > > On May 20, 11:20 am, David Nolen wrote: > > Wow this sounds fantastic. Wanna put this on GitHub so people ca

Re: CLJDB: Using Emacs/JDB mode with Clojure

2009-05-25 Thread David Nolen
, May 25, 2009 at 8:35 PM, George Jahad wrote: > > > > On May 25, 4:51 pm, David Nolen wrote: > > Just got around to messing with this today, this is great. > > I note that cljdb can't point to the exact location inside of Clojure > source > > files (it works

Re: (Potentially stupid) Question about recursion / trampoline

2009-06-10 Thread David Nolen
The examples given for Scheme and Common Lisp also blow the stack (I checked the Scheme example in PLT Scheme). Consider the following: ;; cannot be tail call optimized (define (add n) (if (= n 0) 0 (+ 1 (add (- n 1) ;; can be tail call optimized (define (add-tail n) (add-iter n

Re: Simple idiom in clojure, mutate a value

2009-06-11 Thread David Nolen
Not totally clear what you are trying to accomplish, but would something like the following work? (defn get-value [start-value] (loop [updateable start-value line (.readline reader)] (if (or (empty? line) (> line-num max-num)) (+ updateable (somefunc)) (recur (.readLine reader)))

Re: Simple idiom in clojure, mutate a value

2009-06-11 Thread David Nolen
Why isn't the following satisfactory for your needs? get-value takes a value returns a new value based on it. do-something can 'do something' to/with this new value. (defn get-value [start-value] (loop [updateable start-value line (.readline reader)] (if (or (empty? line) (> line-num max-num

Re: Improved Error Messages - Part XXXVIII

2009-06-25 Thread David Nolen
FWIW, this is the kind of problem that paredit mode in Emacs eliminates almost entirely. On Thu, Jun 25, 2009 at 11:14 AM, Rich Hickey wrote: > > > > On Jun 25, 9:36 am, Mark Addleman wrote: > > On Jun 25, 4:26 am, Rich Hickey wrote: > > > > > > > > > > > > > On Thu, Jun 25, 2009 at 7:03 AM, J

Re: What does RT stand for?

2009-07-28 Thread David Nolen
RunTime I believe. On Tue, Jul 28, 2009 at 2:29 PM, eyeris wrote: > > I've been browsing the Clojure code. Everything seems to depend on > clojure.lang.RT. What does RT stand for? > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to

Re: How to create structure with a seq of keys

2009-08-09 Thread David Nolen
Sounds like you want apply: (apply fn args) On Sun, Aug 9, 2009 at 4:28 PM, Dragan Djuric wrote: > > Hi, > > I would like to achieve something like this: > > (def k [:key1 :key2 :key3]) > (def mystruct (create-structure k)) > > Unfortunately, create structure treats the whole vector of params (or

Re: current rule of thumb for optimization?

2009-08-10 Thread David Nolen
The only thing I've ever seen in Clojure that is "slow" is tight loops on primitives. Most of the time that people bring up Clojure performance, it's usually about tight loops on primitives. For starters, this isn't even something you could really optimize in popular dynamic languages like Python o

Re: Uncle Bob looking for clojure help!

2009-08-13 Thread David Nolen
http://github.com/swannodette/convex-hull/tree/master This version runs in 2-2.5s. About exactly an order of magnitude slower than Java. Amazingly, I did discover afterwards that there is a Clojure version that is _exactly_ the same speed as the Java version: . . . (.test (new TimeJarvisMarch))

Re: How to have a fast access to a java array of non-primitives?

2009-08-15 Thread David Nolen
You need to specify the array type. For example the following produces a primitive array of n javax.vecmath.Vector2d elements. (defn #^"[Ljavax.vecmath.Vector2d;" point-array [n] (make-array javax.vecmath.Vector2d n)) It works. If you want to see it in action take a look at: http://github.com/

Re: Pure-functional N-body benchmark implementation

2009-08-17 Thread David Nolen
On Mon, Aug 17, 2009 at 4:32 AM, Nicolas Oury wrote: > > I was referring to the rules of the benchmark game. When you benchmark > language, using another language is not fair. > > If you were to do your own program, of course you could use Java. > However, in the particular circumstance, it is a b

Re: Uncle Bob looking for clojure help!

2009-08-17 Thread David Nolen
Here are the major points: The algorithm requires that for about 400,000 points there will be ~8,000,000 iterations. This is a very tight loop. You cannot create anything in this loop, not even a regular Object, much less a temporary Clojure vector for doing vector math. The Java version avoids th

Re: Pure-functional N-body benchmark implementation

2009-08-17 Thread David Nolen
On Sun, Aug 16, 2009 at 6:50 AM, Nicolas Oury wrote: > > Dear all, > > > The good news: I have a version of the N-body benchmark that goes "as > fast as java". > > The bad news: I am cheating a little bit... You're only cheating if you care about the fantasy world that is microbenchmarks. I thin

Re: Clojure for game programming?

2009-08-30 Thread David Nolen
On Sun, Aug 30, 2009 at 6:01 AM, Elliott Slaughter < elliottslaugh...@gmail.com> wrote: > > All game simulation models I've seen used graphs of mutable objects; > I'm not entirely sure how to move to a more functional model. One the > one hand, reallocating the game world on every frame seems exce

Re: seeking examples/tutorials on clojure/lisp-y design (vs Java/Ruby)

2009-09-11 Thread David Nolen
Rich Hickey's reading list is comprehensive (daunting even ;) http://www.amazon.com/Clojure-Bookshelf/lm/R3LG3ZBZS4GCTH/ref=cm_lm_byauthor_title_full Some people suggest going through Project Euler. Stuart Halloway's Programming Clojure emphasizes the functional perspective. Another good approac

Re: Modeling question multimethods or methodmaps?

2009-09-17 Thread David Nolen
I believe maps containing functions are generally looked down upon. Multimethods are probably the way to go. Can't you tag your request map with a type? On Thu, Sep 17, 2009 at 7:50 AM, Philipp Meier wrote: > > Hi, > > I'm building a REST server library on top of compojure loosely modeled > after

Re: java/scala oneliner

2009-09-17 Thread David Nolen
Your basic approach seems sound: (map #(str "Happy Birthday " %) (assoc (vec (replicate 4 "To You")) 2 "Dear XXX") -> 81 chars including white space for(int i=0;i<4;i++){System.out.println("Happy Birthday "+(i==2?"Dear XXX":"To You"));}) -> 88 chars (1 to 4).map{i=>"Happy Birthday %s".format(if(i

Re: java/scala oneliner

2009-09-17 Thread David Nolen
Actually to be fair, here's a Clojure version that uses as little whitespace as the Scala and Java ones do. (map #(str"Happy Birthday "%)(assoc (vec (replicate 4"To You"))2"Dear XXX")) ; -> 76 chars On Fri, Sep 18, 2009 at 12:14 AM, David Nolen wrote: >

Re: java/scala oneliner

2009-09-17 Thread David Nolen
Spoke too soon: (map #(str"Happy Birthday "%)(assoc(vec(replicate 4"To You"))2"Dear XXX")) -> 74 On Fri, Sep 18, 2009 at 12:17 AM, David Nolen wrote: > Actually to be fair, here's a Clojure version that uses as little > whitespace as the Scala and

Re: java/scala oneliner

2009-09-17 Thread David Nolen
(dorun(map #(println"Happy Birthday %s"(if(= 2 %)"Dear XXX""To You"))(range 4))) ; -> 80 chars should produce the correct output at the repl. This is probably the most correct one. can we get shorter? :) On Fri, Sep 18, 2009 at 12:24 AM, Wilson MacGyver wrote: > > Hmmm, your solution produces ni

Re: java/scala oneliner

2009-09-17 Thread David Nolen
(dotimes[x 4](println"Happy Birthday"(if(= x 2)"Dear XXX""To You"))) -> 68 chars! Sorry I'm getting carried away now :) On Fri, Sep 18, 2009 at 12:26 AM, David Nolen wrote: > (dorun(map #(println"Happy Birthday %s"(if(= 2 %)"Dear XXX&qu

Re: java/scala oneliner

2009-09-17 Thread David Nolen
Happy Birthday" ({2 "Dear XXX"} i "To You"))) > > On Thu, Sep 17, 2009 at 9:17 PM, David Nolen > wrote: > > Actually to be fair, here's a Clojure version that uses as little > whitespace > > as the Scala and Java ones do. > > (map #(str&qu

Re: java/scala oneliner

2009-09-17 Thread David Nolen
On Fri, Sep 18, 2009 at 2:41 AM, Wilson MacGyver wrote: > > Clojure REPL will display nil for anything that causes side-effect? > I had no idea! > No. The return value of println _is_ nil. map takes a collection of values and returns a new collection of values by applying the supplied fn on each

Re: How can a clojure script recognise it is running as a script?

2009-09-18 Thread David Nolen
The source itself cannot know the way a Python knows. However you can understand how to achieve pretty much the same effect with the following: http://clojure.org/compilation On Fri, Sep 18, 2009 at 6:46 AM, Kelvin Ward wrote: > > java -cp clojure.jar clojure.main foo.clj > > I'm wondering if the

Re: Anyone care to defend/comment some points in this presentation

2009-09-18 Thread David Nolen
Click answers that himself: Clojure usage failure. The particular scenario he is demonstrating is known and has been brought up before. Also it's probably only reproduceable when you have a truly large number of cores (like a 600 way Azul box). In anycase Rich Hickey does not advise against locks w

Re: frameworks

2009-09-18 Thread David Nolen
What do you mean by development frameworks? IDE support? On Fri, Sep 18, 2009 at 8:08 AM, demet8 wrote: > > Im new to Clojure. Are there any development frameworks for clojure > worth noting yet? > > > > --~--~-~--~~~---~--~~ You received this message because you

Re: Silly Convention Question

2009-09-18 Thread David Nolen
On Fri, Sep 18, 2009 at 6:37 PM, CuppoJava wrote: > > John illustrates a common scenario in Clojure. Clojure's built-in > functions are tersely and sensibly named. The problem is that there is > indeed a finite number of terse and sensible names... which bites you > when you need some of those nam

Re: How can a clojure script recognise it is running as a script?

2009-09-18 Thread David Nolen
So that you can write python code that can function both as a shell script and as a library transparently. On Fri, Sep 18, 2009 at 7:42 PM, ataggart wrote: > > Just for my own edification (not being versed in python), what's the > point of knowing that? > > > On Sep 18, 3:46 am, Kelvin Ward wro

Re: Metadata: something funny

2009-09-20 Thread David Nolen
Hmm, I also note that: (def b #^{:b 2} (quote (1 2 3))) ; ^b -> {:line 1} (def b #^{:b 2} (list 1 2 3)) ; ^b -> nil On Sun, Sep 20, 2009 at 12:20 PM, samppi wrote: > > I was messing with the REPL when I found this happens: > > Clojure 1.0.0- > user=> (def a #^{:a 5} [1 2 3]) > #'user/a > user=>

Streaming Data?

2009-09-22 Thread David Nolen
Dear Clojurians, Are lazy-seqs good for streaming data that arrives at indeterminate intervals? if not any pointers about which approach to take? I'm working on a simple serial port library for Clojure and I'm trying to understand how to best model a solution. Basically serial events will happe

Re: Streaming Data?

2009-09-24 Thread David Nolen
ogspot.com/2009/08/simple-webhooks-with-clojure-and-ring.html > http://richhickey.github.com/clojure-contrib/seq-utils-api.html#fill-queue > > > On Sep 23, 4:17 pm, David Nolen wrote: > > Dear Clojurians, > > > > Are lazy-seqs good for streaming data that arrives at indete

Re: Adding Classpaths On The Fly

2009-09-25 Thread David Nolen
On Fri, Sep 25, 2009 at 3:02 AM, Volkan YAZICI wrote: > > Hi, > > I'm trying to add a classpath to the current Clojure REPL session on the > fly. (Particularly, I extracted shcloj-code.tgz of Programming Clojure > to /tmp/code directory, and trying to load /tmp/code/examples/snake.clj > file.) For

Re: idiom questions

2009-10-30 Thread David Nolen
On Fri, Oct 30, 2009 at 4:42 PM, Chick Corea wrote: > > Is everything in Clojure immutable? For example, w/ this code-snippet > > (let [x nil] > ;; do something and modify 'x' > ) > > how does one modify the value of 'x' ? > >(let [x nil] (def x true)) > >

Re: can I make this faster (and leaner) ?

2009-10-30 Thread David Nolen
The better question to ask is this real code you intend on using? Are you really going to generate 100,000 random keys of 1024 chars each all at once in a real running program? (def *valid-chars* [\a \b \c \d \e \f \g \h \i \j \k \l \m \n \o \p \q \r \s \t \u \v \w \x \u \z \0 \1 \2 \3 \4

Re: Vector manipulation problem, possible function for a solution.

2009-11-09 Thread David Nolen
(use 'clojure.contrib.seq-utils) (flatten [ [2 3] [4 5] [6 7] ]) On Mon, Nov 9, 2009 at 8:19 PM, Don wrote: > > I am having a problem with vectors. It seems there should be a > function for this however I am not sure. > > I have a vector a [ [2 3] [4 5] [6 7] ] > > And I want to be able to get

Re: Datatypes and Protocols - early experience program

2009-11-13 Thread David Nolen
I place my vote for no data hiding. On Fri, Nov 13, 2009 at 10:48 AM, Stuart Halloway wrote: > >> But do > >> people feel that some degree of data hiding is worthwhile? > > > > I don't. > > > Hooray for benevolent dictators! > > -- > You received this message because you are subscribed to the G

Re: Datatypes and Protocols - early experience program

2009-11-13 Thread David Nolen
Is there an argument for putting it after the argument list? :) On Fri, Nov 13, 2009 at 11:11 AM, Rich Hickey wrote: > > > On Nov 13, 10:42 am, Sean Devlin wrote: > > Rich, > > I was wondering something about defprotocol. > > > > Here's your example: > > > > (defprotocol AProtocol :on AnInterfa

Re: SLIME REPL broken

2009-11-17 Thread David Nolen
Stefan, Thanks for pursuing this so adamantly :) For a long time (more than a year) it was possible to use SLIME tip. It would be great for that to continue. David On Tue, Nov 17, 2009 at 2:44 PM, Stefan Kamphausen wrote: > Hi, > > On Nov 17, 1:47 pm, Stefan Kamphausen wrote: > > [...] > > use

Re: [ANN] leiningen - a Clojure build tool

2009-11-17 Thread David Nolen
Awesomeness. On Wed, Nov 18, 2009 at 2: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. > > Building Clojure projects with tools designed for Java can be an > exercise in

Re: performance issues with multi-dimensional array

2009-11-25 Thread David Nolen
Read Christophe's post about multi-dim arrays. Reflection is getting in the way here. On Wed, Nov 25, 2009 at 2:55 AM, Amnon wrote: > Hi Konrad, > In the original post, I put in the code, it was removed by the post > editor. > The way I wanted it implement, I have the main in java (gui and > stu

Re: performance issues with multi-dimensional array

2009-11-26 Thread David Nolen
of the old #^objects? > I still get it to work in 300 ms (which is not great but something I > can live with). > Thanks for the replies, > > On Nov 25, 8:01 pm, David Nolen wrote: > > Read Christophe's post about multi-dim arrays. Reflection is getting in > the > > way h

Lein adding repos

2009-11-27 Thread David Nolen
Is there currently a simple way to add new maven2 repos to download from? David -- 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 p

Re: Lein adding repos

2009-11-27 Thread David Nolen
ov 27, 12:40 pm, David Nolen wrote: > > > > > Is there currently a simple way to add new maven2 repos to download > from? > > > > I haven't done it, but looking at the code you just add :repositories > > [[id url]] to your project.clj. > > That'

Leiningen Run ?

2009-11-30 Thread David Nolen
So my Java ignorance once again rears it's ugly head. It turns out that JNI dynamic libs can't really be part of a .jar. Say for example that you want to build a JOGL Clojure project. Then your project file looks something like this: (defproject gears "0.1.0" :description "OpenGL Gears" :repos

Re: Leiningen Run ?

2009-12-01 Thread David Nolen
On Tue, Dec 1, 2009 at 12:16 AM, Alex Osborne wrote: > Hi David, > > David Nolen wrote: > > So my Java ignorance once again rears it's ugly head. It turns out > > that JNI dynamic libs can't really be part of a .jar. > > I can't say I know much a

Re: Leiningen Run ?

2009-12-01 Thread David Nolen
On Tue, Dec 1, 2009 at 1:10 AM, Phil Hagelberg wrote: > David Nolen writes: > > > The problem is that JOGL needs JNIs and JNIs need to be on > > java.library.path or java.ext.dirs, not the classpath. In order to > > make life easier for people learning about clojure as w

Re: Getting Started in Mac OS X Snow Leopard

2009-12-01 Thread David Nolen
On Tue, Dec 1, 2009 at 3:59 PM, Charras wrote: > Steve, I already try to follow does instructions. I copied the text > into the *scratch* buffer, and did control j (C-j), but nothing > happen, it just move the cursos to the next line. Do you know how can > I make Aquamacs eval the *scratch* buffe

Re: Leiningen Run ?

2009-12-01 Thread David Nolen
So just to keep the conversation going: http://download.java.net/maven/2/net/java/dev/gluegen/ http://download.java.net/maven/2/net/java/dev/jogl/ I note that these two maven repos specify the platform with the following: lib-{platform}-{arch} where platform is: macosx linux windows arch is: u

Re: Getting Started in Mac OS X Snow Leopard

2009-12-01 Thread David Nolen
A, but that means that I > need to install ELPA as well, and this make things even worse, now I > have two things that I can't install. > > Do you have a different way to do this? If so, please send a dummies > type instruction list. > > Guido > > On Dec 1, 4:03 pm, Da

Re: Leiningen Run ?

2009-12-02 Thread David Nolen
Yeah it sounds like you'll need to package up JOGL 2 and push it to Clojars right? On Wed, Dec 2, 2009 at 3:20 PM, Zach Tellman wrote: > On Dec 1, 3:31 pm, David Nolen wrote: > > So just to keep the conversation going: > > > > > http://download.java.net/mave

Re: Possible BUG: NPE

2009-12-07 Thread David Nolen
I was getting this as well, but this was before the last 3 commits to new. Did you wipe your old jars and class files and start afresh? David On Mon, Dec 7, 2009 at 8:31 PM, Feng wrote: > Hi, > > After git pull on new branch > > commit 1da63ad10d2531264e86eb705a10b3cebc9b1067 > Author: Rich Hic

Re: Possible BUG: NPE

2009-12-07 Thread David Nolen
Looking at the stacktrace it looks like this is because of swank_fuzzy.clj. I can start up the SLIME Repl no problem, I see your exact same stack trace only if I try to trigger fuzzy completion via C-c TAB. David On Mon, Dec 7, 2009 at 9:24 PM, Feng wrote: > > > On Dec 7, 8:57 pm, Da

Re: Possible BUG: NPE

2009-12-07 Thread David Nolen
http://github.com/jochu/swank-clojure/blob/master/src/main/clojure/swank/commands/contrib/swank_fuzzy.clj#L256 Is the offending line. On Mon, Dec 7, 2009 at 9:34 PM, David Nolen wrote: > Looking at the stacktrace it looks like this is because of swank_fuzzy.clj. > I can start up the SLIM

Help recreating OS X Leiningen 1.0 +Swank bug

2009-12-08 Thread David Nolen
Just want to make sure other people are seeing this on OS X. When starting up "lein swank" from the project directory and attempting to connect from Emacs with slime-connect with this simple clojure project http://github.com/swannodette/lein-macosx-bug (just creates a JPanel and draws a small line)

Re: Help recreating OS X Leiningen 1.0 +Swank bug

2009-12-09 Thread David Nolen
r lib folder in your leiningen checkout. David On Tue, Dec 8, 2009 at 11:35 AM, David Nolen wrote: > Just want to make sure other people are seeing this on OS X. When starting > up "lein swank" from the project directory and attempting to connect from > Emacs with slime-connect

Re: Image scaling libraries. Request for recommendations

2009-12-09 Thread David Nolen
Java Advanced Imaging is one possibility: libs for each platform here: https://jai.dev.java.net/binary-builds.html Mac OS X ships with it's own version. On Wed, Dec 9, 2009 at 5:11 PM, Joost wrote: > Hi there. > > I'm working on a project using compojure and I will need some way of > processin

Re: Possible BUG: NPE

2009-12-09 Thread David Nolen
You don't have the locals clearing changes Richard. Rich Hickey, I confirm that this also causes an NPE on my setup. Clojure new branch 6d40a76e8a012909f2d2a594ce66a78318889799 OS X 10.6 JDK 1.6 64bit David On Wed, Dec 9, 2009 at 10:46 PM, Richard Newman wrote: > Does not happen for me throug

Re: Mapping OOPS concepts to Clojure? Doable or Wrong thinking?

2009-12-12 Thread David Nolen
On Sat, Dec 12, 2009 at 11:03 AM, Sean Devlin wrote: > Ummm some of these thing DON'T map to Clojure. > > I'd suggest you check out Rich's videos here: > > http://blip.tv/file/982823 > > Anyway, as to how you would solve some of these problems in Clojure... > > Static methods you get for free,

Re: OnLisp: Porting Chapter 19 to Clojure

2009-12-13 Thread David Nolen
Worked out very quickly but it's headed in the direction you want: (defmacro dynlet [bvec body] `(let ~(if (vector? bvec) bvec (var-get (resolve bvec))) ~body)) (def bds '[a 42]) (dynlet bds (prn a)) (dynlet [a 42] (prn a)) On Sun, Dec 13, 2009 at 5:43 AM, mk wrot

Re: Help! My slime-fu is broken!

2009-12-14 Thread David Nolen
While I personally use Emacs+SLIME to do Clojure hacking this is generally a poor introduction to Clojure for newbies. Clojure is new enough territory without having to fight with your text editor and the idiosyncracies of SLIME (SLIME hasn't even been compatible with swank-clojure since late Octob

Re: Help! My slime-fu is broken!

2009-12-15 Thread David Nolen
On Tue, Dec 15, 2009 at 2:08 AM, Mike K wrote: > I hadn't considered another IDE. Clojure is my first real exposure to > the JVM, so I'm not familiar with Java IDEs. OTOH, Emacs has been my > editor of choice for over two decades (yikes!) so it's definitely home > turf for me. Besides, I'm alr

Re: Roadmap for 2010

2009-12-16 Thread David Nolen
Well 1.1 is just around the corner. And 1.2 will probably bring all the deftype/defprotocol goodness. I imagine that Clojure-in-Clojure will be one of the big projects for 2010. You should check out http://www.assembla.com/spaces/clojure/ for more info. David On Tue, Dec 15, 2009 at 11:32 PM, as

Re: Transient Bug

2009-12-19 Thread David Nolen
IIRC, you can use transient only with maps and vectors. David On Sat, Dec 19, 2009 at 8:46 AM, Sean Devlin wrote: > Hey, > I was experimenting with transients, and they don't seem to work for > sorted collections: > > user=> (transient (sorted-map 1 2 3 4)) > java.lang.ClassCastException: clojur

Re: Parenthesis Inference

2009-12-19 Thread David Nolen
On Sat, Dec 19, 2009 at 8:25 AM, Martin Coxall wrote: > > > > I guess it's mostly a matter of judging a language by its long-term > > merits instead of initial appearance -- just like with so many other > > things in life. > > > > That - right there - is a tacit admission that the Clojure communi

Re: Parenthesis Inference

2009-12-20 Thread David Nolen
On Sun, Dec 20, 2009 at 5:48 PM, Luc Préfontaine < lprefonta...@softaddicts.ca> wrote: > :)) > The Lisp Beard? > > Luc > > > On Sun, 2009-12-20 at 15:00 -0800, David Brown wrote: > > On Sun, Dec 20, 2009 at 02:30:58PM -0500, Luc Préfontaine wrote: > > >People bought HP calculat

Re: Fixing Lisp

2009-12-24 Thread David Nolen
On Thu, Dec 24, 2009 at 12:58 PM, kaveh_shahbazian < kaveh.shahbaz...@gmail.com> wrote: > This has been done in Clojure to some extend for Vectors and Sets. > What if we could choose a custom separator in out macros? For example > `begin and `end? This way one can write code in more common flavors

<    1   2   3   4   5   6   7   8   9   10   >