Re: Proxying in clojure

2008-12-26 Thread Emeka
Chooser, Please send me yours then. Emeka --~--~-~--~~~---~--~~ 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 from this group, send email to

Re: Help with Slime

2008-12-26 Thread Emeka
> > Kogu > > Below is the relevant part of my init.el. Which file is init.el? Where can I find it? I use windows vista. Emeka --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, s

Re: Proxying in clojure

2008-12-26 Thread Chouser
On Fri, Dec 26, 2008 at 4:40 AM, Emeka wrote: > Chooser, "Chouser" > Please send me yours then. Already did: http://groups.google.com/group/clojure/msg/4f00d2a3b5da8444 And Mr. Gilardi improved on it here: http://groups.google.com/group/clojure/msg/90316675320091cf --Chouser --~--~-~

How To Make Code More Functional?

2008-12-26 Thread aria42
Hi all, I'm just getting started with clojure from a functional background, and while I like playing with clojure and accomplishing script like tasks, I have no experience with anything larger than about 20 lines. I wanted to try to take something with "alot of state" and put it into clojure. I

Re: How To Make Code More Functional?

2008-12-26 Thread aria42
Clojure for Tajan's Algorithm uploaded here http://clojure.googlegroups.com/web/tarjan.clj?gsc=yOHJ-CEAAAB3Fq8nFW3O6gqQkWXH_xrOYRvSPFZyhAT412614U6EGkzfKN-m9S9niuHrq-IEXAE - aria On Dec 26, 6:30 am, aria42 wrote: > Hi all, >   I'm just getting started with clojure from a functional background, >

Re: Exercise: words frequency ranking

2008-12-26 Thread lpetit
Instead of #(- (val %)), one could also use the compose function : (comp - val) My 0,02 EURO, -- Laurent On Dec 25, 4:58 pm, Mibu wrote: > My version: > > (defn top-words [input-filename result-filename] > (spit result-filename > (apply str >(map #(format "%s : %d\n"

Re: Exercise: words frequency ranking

2008-12-26 Thread lpetit
What would you think of this form of coding ? - The rationale is to separate functions that deal with system "boundaries" from "core algorithmic functions". So you should at least have two functions : one that does not deal with input/output formats : will only deal with clojure/java constructs. -

Re: Exercise: words frequency ranking

2008-12-26 Thread Piotr 'Qertoip' Włodarek
On Dec 25, 4:58 pm, Mibu wrote: > My version: > > (defn top-words [input-filename result-filename] >   (spit result-filename >         (apply str >                (map #(format "%s : %d\n" (first %) (second %)) >                     (sort-by #(-(val %)) >                              (reduce #(co

Re: Proxying in clojure

2008-12-26 Thread MattyDub
This might be off-topic, but when I launched "snake" from SLIME (via load-file and then "run-snake"), the app didn't receive any UI Events. I thought at first it might be because the snake Frame didn't have focus, but even when I gave it focus, it still didn't receive any Events. When I ran it f

sync vs. dosync

2008-12-26 Thread Mark Volkmann
What is the difference between the sync and dosync functions? Their documentation strings are identical. -- R. Mark Volkmann Object Computing, Inc. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. T

println output

2008-12-26 Thread Mark Volkmann
Why does (for [x (range 3)] (println x)) output (0 nil 1 nil 2 nil) when run in the REPL instead of 0 1 2 and nothing at all when run from a script? -- R. Mark Volkmann Object Computing, Inc. --~--~-~--~~~---~--~~ You received this message because you are s

Re: sync vs. dosync

2008-12-26 Thread Michael Wood
On Fri, Dec 26, 2008 at 9:44 PM, Mark Volkmann wrote: > > What is the difference between the sync and dosync functions? Their > documentation strings are identical. sync has an extra flags argument. At the moment they are the same, but presumably sync will do different things depending on the f

Re: println output

2008-12-26 Thread mehrheit
On Fri, 26 Dec 2008 14:43:23 -0600 "Mark Volkmann" wrote: > >Why does > >(for [x (range 3)] (println x)) > >output > >(0 >nil 1 >nil 2 >nil) > >when run in the REPL instead of > >0 >1 >2 > >and nothing at all when run from a script? > The seq of nils is the return value of `(for ...)'. It is pr

Re: println output

2008-12-26 Thread Michael Wood
On Fri, Dec 26, 2008 at 10:43 PM, Mark Volkmann wrote: > > Why does > > (for [x (range 3)] (println x)) > > output > > (0 > nil 1 > nil 2 > nil) > > when run in the REPL instead of > > 0 > 1 > 2 This is because println returns nil every time it's run. user=> (println "test") test nil user=> Al

Accessing "this" in gen-class constructor

2008-12-26 Thread CuppoJava
Hi, I've hit a stumbling block using Clojure's gen-class facility for constructors. Is there anyway to access "this" inside Clojure's constructor/init function? ie. The following type of code is quite common in Java. How would you do the same in Clojure? public class MyDerivedClass extends Super

Re: Proxying in clojure

2008-12-26 Thread Abhishek Reddy
Works for me from SLIME. Check your *inferior-lisp* buffer for exceptions. On 12/27/08, MattyDub wrote: > > This might be off-topic, but when I launched "snake" from SLIME (via > load-file and then "run-snake"), the app didn't receive any UI > Events. I thought at first it might be because the

Re: How To Make Code More Functional?

2008-12-26 Thread CuppoJava
I'm just getting started myself, and I found Stuart Halloway's blog of great use. Perhaps it'll be of some help to you also. -Patrick --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this

distinct broken?

2008-12-26 Thread tristan
Hi All, I've been trying to learn clojure lately by solving the project euler problems with it, and I think the distinct function is broken (or it doesn't quite work as I assume it would). here is the code i'm running (defn pow [nbr pwr] (if (< pwr 2) nbr (* nbr (pow nbr (dec pwr

macro help

2008-12-26 Thread what-a-guy
I'm attempting what should be a simple transformation using a macro called dlg in the following code: (defn fld [parent lay id text field] '...) ;; dlg macro. For this input: ;; ;; (dlg "test" ;; (field fld-1 "Field number one" (JTextField.)) ;; (field fld-2 "Field number two" (JTextField.))

macro help

2008-12-26 Thread what-a-guy
I'm attempting what should be a simple macro transformation (dlg below): (defn fld [parent lay id text field] '...) ;; dlg macro. For this input: ;; ;; (dlg "test" ;; (field fld-1 "Field number one" (JTextField.)) ;; (field fld-2 "Field number two" (JTextField.))) ;; ;; we want this output:

IntelliJ Plugin

2008-12-26 Thread Justin Johnson
Hi, Is this the appropriate mailing list to talk about the Clojure IntelliJ plugin? The Google Code site didn't list any other mailing list. http://code.google.com/p/clojure-intellij-plugin/ I went through the process of building and installing the plugin on Windows XP with IntelliJ IDEA 8.0.1

macro help

2008-12-26 Thread what-a-guy
I'm getting stuck on what should be a simple macro (dlg below). It produces 2 different symbols (for 'parent#) when I was expecting both to refer to the same symbol. Here's the code: (defn fld [parent lay id text field] '...) ;; dlg macro. For this input: ;; ;; (dlg "test" ;; (field fld-1

macro help

2008-12-26 Thread what-a-guy
I'm attempting what should be a simple transformation using a macro called dlg in the following code: (defn fld [parent lay id text field] '...) ;; dlg macro. For this input: ;; ;; (dlg "test" ;; (field fld-1 "Field number one" (JTextField.)) ;; (field fld-2 "Field number two" (JTextField.))

Re: Random Number Generation Issues

2008-12-26 Thread Mark H.
On Dec 23, 3:10 pm, Jason wrote: > For the time-being, you could try something like: > > user> (def *random* (java.util.Random.)) > #'user/*random* > > user> (defn my-rand-int [max-val] >         (let [bit-length (.bitLength (BigInteger. (str max-val)))] >           (loop [] >             (let [x

Re: How to encapsulate local state in closures

2008-12-26 Thread Adrian Cuthbertson
On Dec 22, 2:34 pm, "Mark Engelberg" wrote: > On Mon, Dec 22, 2008 at 4:23 AM, Parth Malwankar > > wrote: > > If I get it right, atoms are quite useful to maintain state > > in the context of a single thread with memoization and > > counter (within a thread) being two examples. > > No, RH said

Re: How to encapsulate local state in closures

2008-12-26 Thread Mark Engelberg
On Fri, Dec 26, 2008 at 8:35 PM, Adrian Cuthbertson wrote: > It's important to distinguish between updating atoms within > transactions and outside transactions. In the former case, one has to > ensure the update function can be retried without ill-effects. > However, outside a transaction, atoms

Re: Exercise: words frequency ranking

2008-12-26 Thread Mibu
I wrote what I think is the idiomatic version. Idiomatically, you delay execution of functions over lazy sequences, so if you get a sequence of a million words and you only take the first 100, you don't lowercase (or whatever else) the entire sequence. Also a smart compiler on a multi-core machine

Re: Accessing "this" in gen-class constructor

2008-12-26 Thread CuppoJava
I found that I can use another factory method to workaround this limitation. I can first instantialize the object to get a reference, and then initialize all it's settings. This works only if I don't expect this class to be derived from. Any subclass would expect the class to be fully initialized

sorted-map-by value

2008-12-26 Thread Mibu
Is there a way to sort a sorted-map-by by value without a letrec? --~--~-~--~~~---~--~~ 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 from thi