Slime, debug-repl clojure debugging toolkit

2010-07-21 Thread Krukow
I am interested in getting the combination of Emacs+slime+swank- clojure, alex-and-georges.debug-repl and clojure debugging toolkit to work together. I'm almost there but I am missing support for debug-repl when using using Emacs M-x slime-connect with a lein swank server. The debug-repl doen't

Re: Slime, debug-repl clojure debugging toolkit

2010-07-21 Thread Ramakrishnan Muthukrishnan
On Wed, Jul 21, 2010 at 11:52 AM, Krukow karl.kru...@gmail.com wrote: I am interested in getting the combination of Emacs+slime+swank- clojure, alex-and-georges.debug-repl and clojure debugging toolkit to work together. debug-repl is kind of integrated already into swank by Hugo Duncan.

Re: Literate Clojure - a good lead ...

2010-07-21 Thread Tassilo Horn
On Wednesday 21 July 2010 06:32:02 Mark Engelberg wrote: Hi Mark, I would definitely welcome a literate Clojure tool. You might want to have a look at Emacs' org-mode [1]. It has a facility called Babel [2] that allows for literate programming in all the languages listed at [3], Clojure being

Re: Congomongo question - how to update all records?

2010-07-21 Thread Mark Engelberg
So does no one here use congomongo? On Sat, Jul 10, 2010 at 1:17 PM, Mark Engelberg mark.engelb...@gmail.com wrote: Let's say I have a table called :table, and a column called :col, and I want to go through all the records in the table and set the :col value to 0.  I had been doing it like

Re: Congomongo question - how to update all records?

2010-07-21 Thread Meikel Brandmeyer
Hi, So, is there some sort of recipe for updating all records without first loading them all into memory? Maybe you can first do your doall but only retrieve the ids. Then later on you can retrieve the entry by id and update it. Something like this: (defn update-db! [] (doseq [id (doall

Re: terracotta?

2010-07-21 Thread Paul Stadig
There are agents, atoms, vars, seqs, and lisp macros all of which may make Clojure a more appealing alternative to Java for use with Terracotta. My goal was to get Clojure working with Terracotta, period. Most of the work I did was actually focused on vars so that you could define a function and

Re: Memoizing tree recursive calls

2010-07-21 Thread Mike Meyer
On Tue, 20 Jul 2010 13:11:12 -0700 (PDT) Aravindh Johendran ajohend...@gmail.com wrote: If we have tree recursive procedure such as the follows, how can we use memoize it so that it automatically caches the values it has already computed . [example elided] Maybe memoize should go the

Re: IDE agnostic question on user assistance (emacs/vimClojure users help appreciated too !)

2010-07-21 Thread Jeff Rose
On Jul 19, 8:19 pm, Meikel Brandmeyer m...@kotka.de wrote: Starting the server is up to the user. Rule 1: Vim is not an IDE. There is a plethora of tools for handling classpaths questions. I personally use gradle; before that I used simple shell scripts with project relative CLASSPATH and

Re: Leiningen 1.2.0 released!

2010-07-21 Thread Daniel Gagnon
On Tue, Jul 20, 2010 at 9:51 AM, Phil Hagelberg p...@hagelb.org wrote: On Mon, Jul 19, 2010 at 3:00 PM, Daniel Gagnon redalas...@gmail.com wrote: By the way, what's left to do for the Windows support to stop being experimental? Mostly we need volunteers to port the changes from the bash

Re: Complex type in clojure

2010-07-21 Thread Travis Hoffman
I'm still working on it. I've been waiting for the 1.2 release to branch, and also for the other work on the basic types to settle down. Also, I need a little free time. I'll try to get back to it this week. -Travis On Jul 20, 11:09 am, Mike Benfield mike.benfi...@gmail.com wrote: The lack of

Re: Aleph and Conjure

2010-07-21 Thread Victor S
Thank you all for the input, it has made me understand some new things. I find node.js push for NIO as the de-facto mode of existence for web apps interesting, and I was trying to have my cake and eat it too. JS programming just doesn't look all that appealing. - V On Jul 20, 1:46 pm, Peter

Re: Complex type in clojure

2010-07-21 Thread Travis Hoffman
I'm still working on it. I was waiting for 1.2 to branch, and to for some other changes to the basic types to happen. Really, I just need a little free time and a kick-in-the-pants! I'll try to get it done this week. -Travis On Jul 20, 11:09 am, Mike Benfield mike.benfi...@gmail.com wrote: The

Clojure Map function possible bug.

2010-07-21 Thread Ruben
Hi all, when I execute the following code: (def users (ref [])) ;works (defn print-users [] (with-query-results res [select id,username,password from users ] (dorun (dosync (ref-set users res ) ) ) ) ) and then execute (map #(println %) @users) i get

Re: Slime, debug-repl clojure debugging toolkit

2010-07-21 Thread Krukow
On Jul 21, 8:47 am, Ramakrishnan Muthukrishnan vu3...@gmail.com wrote: On Wed, Jul 21, 2010 at 11:52 AM, Krukow karl.kru...@gmail.com wrote: I am interested in getting the combination of Emacs+slime+swank- clojure, alex-and-georges.debug-repl and clojure debugging toolkit to work together.

Re: Clojure Map function possible bug.

2010-07-21 Thread Laurent PETIT
2010/7/21 Ruben ruben.pier...@gmail.com Hi all, when I execute the following code: (def users (ref [])) ;works (defn print-users [] (with-query-results res [select id,username,password from users ] (dorun (dosync (ref-set users res ) ) ) ) ) and

Re: Literate Clojure - a good lead ...

2010-07-21 Thread Tim Daly
The PLT Scheme mechanism mentioned above is a good idea but it has a niche quality to it. Latex is an industry standard publication language. Many books and technical papers, especially in mathematics, use it. Some conferences require it. All publishers support it and it is widely used.

Re: Aleph and Conjure

2010-07-21 Thread David Nolen
On Tue, Jul 20, 2010 at 10:38 PM, Victor S victor.s...@gmail.com wrote: Thank you all for the input, it has made me understand some new things. I find node.js push for NIO as the de-facto mode of existence for web apps interesting, and I was trying to have my cake and eat it too. JS

Re: clojure-contrib replace-first-str

2010-07-21 Thread Stuart Halloway
Hi Jan, These functions in contrib are deprecated (and will be marked so as soon as we have time to make a pass through contrib). Please use the functions in clojure.string. Stuart Halloway Clojure/core http://clojure.com Hi, I'm using replace-str and replace-first-str (from

Re: Clojure Map function possible bug.

2010-07-21 Thread Stuart Halloway
Hi Ruben, What you are missing is that map is the wrong function to use here. Map is lazy, and combining map with something side-effecty like println will lead to confusion. doseq will give you what you want. Stu Stuart Halloway Clojure/core http://clojure.com Hi all, when I execute the

Re: IDE agnostic question on user assistance (emacs/vimClojure users help appreciated too !)

2010-07-21 Thread Meikel Brandmeyer
Hi, On Jul 21, 1:35 pm, Jeff Rose ros...@gmail.com wrote: Really, there isn't a way to start processes from VIM?  How about just opening a temporary buffer for the output of the nailgun server, and then start it with a bang!? I was a but unclear on what I mean with background: I can start

Re: Literate Clojure - a good lead ...

2010-07-21 Thread Antony Blakey
On 21/07/2010, at 10:29 PM, Tim Daly wrote: The PLT Scheme mechanism mentioned above is a good idea but it has a niche quality to it. Latex is an industry standard publication language. Many books and technical papers, especially in mathematics, use it. Some conferences require it. All

Re: alter atom while iterating

2010-07-21 Thread ka
@Meikal, Hi, I get what you mean. Consider the following func - (defn r [n lazy?] (.println System/out (str Called (r n ))) (let [r-lazy-seq (fn r-lazy-seq [i n] (lazy-seq (when ( i n) (.println System/out (str Realizing

Re: Slime, debug-repl clojure debugging toolkit

2010-07-21 Thread Ramakrishnan Muthukrishnan
On Wed, Jul 21, 2010 at 6:04 PM, Krukow karl.kru...@gmail.com wrote:  0: com.trifork.intrafoo.clj.extract_contacts $extract_all.invoke(NO_SOURCE_FILE:1)      Locals:        pref = /Users/krukow/workspaces/trifork/intrafoo_clj/ contactdata/        cli =

Re: Aleph and Conjure

2010-07-21 Thread Marko Kocić
Clojure, because of the JVM, doesn't tie your hands this way. If you want to do everything evented go ahead. Do everything with threads? Go ahead. Want to mix the two designs together like Aleph? Sure. All while not losing the elegant brevity of a Node.js app. Something like

Re: alter atom while iterating

2010-07-21 Thread Meikel Brandmeyer
Hi, On Jul 21, 4:00 pm, ka sancha...@gmail.com wrote: 1:13 user= (def k (for [a (r 2 true)] a) ) Called (r 2) #'user/k Why do you think for doesn't have 'lazy-for' semantics already? Because then the above would look like: user= (def l (hypothetical-lazy-for [a (r 2 true)] a)) #'user/l

Re: Aleph and Conjure

2010-07-21 Thread gary b
On Jul 21, 7:11 am, Marko Kocić marko.ko...@gmail.com wrote: Something like ring-aleph-adapter, however trivial it might be to implement, will help in seamlessly switching existing applications to aleph/netty. There is a Ring adapter for Netty: http://github.com/datskos/ring-netty-adapter. --

Re: alter atom while iterating

2010-07-21 Thread Meikel Brandmeyer
Hi, user= (let [rs2 (r 2 true)              rs3 (r 3 true)]          (for [r2 rs2                r3 rs3]            [r2 r3])) Note: this of course holds the head of the sequences. If this is not desired, you will have to bite the bullet and pay the cost of multiple calls to the seq

Re: Aleph and Conjure

2010-07-21 Thread Janico Greifenberg
On Wed, Jul 21, 2010 at 4:11 PM, Marko Kocić marko.ko...@gmail.com wrote: Something like ring-aleph-adapter, however trivial it might be to implement, will help in seamlessly switching existing applications to aleph/netty. But why would that be useful? Maybe I'm missing something here, but I

Re: Slime, debug-repl clojure debugging toolkit

2010-07-21 Thread George Jahad
Karl, I use the debug-repl all the time and don't see errors like this. You can use the standard debug-repl from with slime's *inferior-lisp* buffer. Try it from there and see what you get. If that fails, try it from outside of emacs entirely in a regular command line repl and see if it behaves

Re: Installing emacs using leiningen on Windows Vista

2010-07-21 Thread leonelag
. And cygwin uses ':' as a CLASSPATH separator, so correct these too at the bottom of the script. Hm, Classpath is tricky to set up correctly in cygwin. The JVM executable in Windows expects your classpath to be separated with a semicolon, so even if you're on cygwin, you should use that. On

Re: Aleph and Conjure

2010-07-21 Thread Marko Kocić
On Jul 21, 4:38 pm, Janico Greifenberg j...@acm.org wrote: On Wed, Jul 21, 2010 at 4:11 PM, Marko Kocić marko.ko...@gmail.com wrote: Something like ring-aleph-adapter, however trivial it might be to implement, will help in seamlessly switching existing applications to aleph/netty. But

randomizing a vector

2010-07-21 Thread Ryan Waters
http://gist.github.com/484747 - - - My sad little program has a number of issues and I would welcome suggestions on any aspect of it. I come from an imperative programming background and clojure is my first experience with a functional or lisp language. I'd like to take a list of things

Re: Literate Clojure - a good lead ...

2010-07-21 Thread Tim Daly
Antony Blakey wrote: On 21/07/2010, at 10:29 PM, Tim Daly wrote: The PLT Scheme mechanism mentioned above is a good idea but it has a niche quality to it. Latex is an industry standard publication language. Many books and technical papers, especially in mathematics, use it. Some

Re: Aleph and Conjure

2010-07-21 Thread Zach Tellman
I don't really understand what's being debated here. Aleph is fully Ring-compliant in every way but its threading model. I don't think anything in the Ring utilities are thread-aware, so they're all okay to use. I'm not very familiar with Compojure, but as long as you're willing to make an

Re: randomizing a vector

2010-07-21 Thread Michał Marczyk
The biggest problem with the code is that it reconstructs the entire `ordered-ips` vector minus the last entry picked at each iteration. It would be simpler and *much* more performant to do (shuffle ordered-ips) Also note that Clojure 1.2 provides an `rand-nth` function for doing (let [i (count

Re: randomizing a vector

2010-07-21 Thread Michael Gardner
On Jul 21, 2010, at 12:44 PM, Michał Marczyk wrote: The biggest problem with the code is that it reconstructs the entire `ordered-ips` vector minus the last entry picked at each iteration. It would be simpler and *much* more performant to do (shuffle ordered-ips) Also note that Clojure

Re: randomizing a vector

2010-07-21 Thread Randy Hudson
Clojure 1.2 has a shuffle function. If you're using 1.1, you can just cop the 1.2 implementation. On Jul 21, 1:18 pm, Ryan Waters ryan.or...@gmail.com wrote: http://gist.github.com/484747 - - - My sad little program has a number of issues and I would welcome suggestions on any aspect of it.

Re: Literate Clojure - a good lead ...

2010-07-21 Thread Mark Engelberg
I'd be perfectly happy with a LaTeX-based solution, although I understand the appeal of something more within Clojure. As a first approximation, literate programming needs to make it easy to enter English text with code snippets that run. Haskell does this by assuming that in a file ending in

Re: Leiningen 1.2.0 released!

2010-07-21 Thread Phil Hagelberg
On Tue, Jul 20, 2010 at 2:43 PM, Daniel Gagnon redalas...@gmail.com wrote: Mostly we need volunteers to port the changes from the bash script to the batch file and test the changes. Also I don't think the self-install feature will ever work with lein.bat due to the lack of a way to download

Re: Aleph and Conjure

2010-07-21 Thread Zach Tellman
Also, I've just created a mailing list for Aleph at http://groups.google.com/group/aleph-lib, since it seems like that might reduce the clutter here. On Jul 21, 10:40 am, Zach Tellman ztell...@gmail.com wrote: I don't really understand what's being debated here.  Aleph is fully Ring-compliant

Re: Aleph and Conjure

2010-07-21 Thread gary b
On Jul 21, 10:40 am, Zach Tellman ztell...@gmail.com wrote:  I don't think anything in the Ring utilities are thread-aware, so they're all okay to use.   The flash and session middleware in Ring core are two examples where Ring assumes the thread per request model.

Re: Implementing a protocol with using a base implementation?

2010-07-21 Thread Toni Batchelli
Hi Meikel, This is awesome! You just did a big chunk of what I was about to try to do :). Sorry for the late response, I've been off the grid for a few days... With your second proposed solution, the defrecord-with-defaults macro, one can achieve very good performance while keeping some of the

Re: Why does using a dynamic binding make a function impure?

2010-07-21 Thread Daniel Werner
On 20 July 2010 11:50, Paul Richards paul.richa...@gmail.com wrote: So back to my example: (def forty-two 42) (defn func [] (* forty-two forty-two)) (defn other-func [] (binding [forty-two 6] (func))) func is impure, and other-func is pure.  It's really nothing to do with whether the

Re: Aleph and Conjure

2010-07-21 Thread Zach Tellman
Both of those seem to be about persisting data across requests. I apologize if I'm being dense, but how does the threading model affect how they work? On Jul 21, 11:28 am, gary b gary.b...@gmail.com wrote: On Jul 21, 10:40 am, Zach Tellman ztell...@gmail.com wrote:  I don't think anything in

Re: Aleph and Conjure

2010-07-21 Thread David Nolen
On Wed, Jul 21, 2010 at 2:42 PM, Zach Tellman ztell...@gmail.com wrote: Both of those seem to be about persisting data across requests. I apologize if I'm being dense, but how does the threading model affect how they work? They wrap the handler, that is they expect to see the request and

Re: Aleph and Conjure

2010-07-21 Thread gary b
On Jul 21, 11:42 am, Zach Tellman ztell...@gmail.com wrote: Both of those seem to be about persisting data across requests.  I apologize if I'm being dense, but how does the threading model affect how they work? The flash and session middleware functions update the response returned from the

Re: Aleph and Conjure

2010-07-21 Thread Zach Tellman
On Jul 21, 11:51 am, David Nolen dnolen.li...@gmail.com wrote: On Wed, Jul 21, 2010 at 2:42 PM, Zach Tellman ztell...@gmail.com wrote: Both of those seem to be about persisting data across requests.  I apologize if I'm being dense, but how does the threading model affect how they work?

Re: Aleph and Conjure

2010-07-21 Thread Zach Tellman
To clarify, I didn't mean gary's last snippet. I meant this could work with the linked Ring middleware: (defn aleph-to-ring-handler [req] (respond! req (ring-handler req))) as would the variation David's been using for his hello world benchmarks: (defn aleph-to-ring-handler [req] (future

Re: randomizing a vector

2010-07-21 Thread Ryan Waters
I'm currently using clojure 1.1 and wasn't aware of shuffle in the contrib libraries. It felt like a wheel reinvention ... I should have looked harder! Thank you. On Wed, Jul 21, 2010 at 12:51 PM, Randy Hudson randy_hud...@mac.com wrote: Clojure 1.2 has a shuffle function. If you're using

Re: Clojure Map function possible bug.

2010-07-21 Thread Ruben
Thanks for your response guys. Ruben On Jul 21, 9:30 am, Stuart Halloway stuart.hallo...@gmail.com wrote: Hi Ruben, What you are missing is thatmapis the wrong function to use here.Mapis lazy, and combiningmapwith something side-effecty like println will lead to confusion. doseq will

Two convenience methods

2010-07-21 Thread Travis Hoffman
I've found two convenience methods to be of use to me in my project, and I'm not certain where I ought to share them. So, I thought I'd share them here, for your consideration. Sorry, I'm a bit of a n00b to Clojure. :-) The first I would suggest for inclusion in core.clj; it is very similar in

Re: clojure-contrib replace-first-str

2010-07-21 Thread jandot
Thanks Stuart. Got it working now. jan. On Jul 21, 2:28 pm, Stuart Halloway stuart.hallo...@gmail.com wrote: Hi Jan, These functions in contrib are deprecated (and will be marked so as soon as we have time to make a pass through contrib). Please use the functions in clojure.string.

Re: Literate Clojure - a good lead ...

2010-07-21 Thread Mark Fredrickson
I'd be perfectly happy with a LaTeX-based solution, although I understand the appeal of something more within Clojure. I've been playing with a Clojure solution: http://github.com/markmfredrickson/changeling I just pushed a version to clojars as well. As a first approximation, literate

Re: Literate Clojure - a good lead ...

2010-07-21 Thread Mark Engelberg
On Wed, Jul 21, 2010 at 3:10 PM, Mark Fredrickson mark.m.fredrick...@gmail.com wrote: I've been playing around with a Emacs mode (more properly looking at existing multi-major-mode work). I'm open to ideas on how to make it play better with a REPL. As always, any form can be sent via C-C C-C.

Re: Literate Clojure - a good lead ...

2010-07-21 Thread Antony Blakey
On 22/07/2010, at 3:08 AM, Tim Daly wrote: Language integration is a false goal. It is technically possible to call functions in any language from latex but unnecessary in general. It is technically possible to generate latex from any language. Have you read the paper? Being able to

Re: bug: clojure.walk removes all the metadata

2010-07-21 Thread Pedro Teixeira
On Jun 22, 6:23 pm, Krešimir Šojat kso...@gmail.com wrote: While traversing the data structure both prewalk and postwalk remove all the metadata: user= (require '[clojure.walk :as w]) nil user= (def data {:a ^{:a :this-is-a} [1 2 3]}) #'user/data user= (meta (:a data)) {:a :this-is-a}

Re: Two convenience methods

2010-07-21 Thread Frederick Polgardy
http://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/some -- Science answers questions; philosophy questions answers. On Jul 21, 2010, at 4:45 PM, Travis Hoffman wrote: (defn any? Returns true if (pred x) is logically true for one x in coll, else false. {:added 1.3 :tag

BUG: Clojure hierarchies (affects 1.2-beta1)

2010-07-21 Thread David Nolen
(derive ::bar ::foo) (underive ::bar ::foo) (derive ::bar ::foo) results in a NullPointerException. Also any further attempts to use derive, say: (derive ::b ::a) also results in a NullPointerException. -- You received this message because you are subscribed to the Google Groups Clojure

Re: bug: clojure.walk removes all the metadata

2010-07-21 Thread Pedro Teixeira
On Jul 21, 9:59 pm, Pedro Teixeira pedr...@gmail.com wrote: On Jun 22, 6:23 pm, Krešimir Šojat kso...@gmail.com wrote: While traversing the data structure both prewalk and postwalk remove all the metadata: user= (require '[clojure.walk :as w]) nil user= (def data {:a ^{:a :this-is-a}

Re: Two convenience methods

2010-07-21 Thread Frederick Polgardy
Or [using clojure.set] (empty? (intersection s1 s2)). -- Science answers questions; philosophy questions answers. On Jul 21, 2010, at 4:45 PM, Travis Hoffman wrote: The second function is suggested as an addition to clojure.set. The disjoint? function decides if two sets have no elements in

Re: Two convenience methods

2010-07-21 Thread Frederick Polgardy
Ok you said this too. :) But the non-booleanness of (some ...) isn't that important. The result of (some ...) is truthy, and can be used in any boolean context. -Fred -- Science answers questions; philosophy questions answers. On Jul 21, 2010, at 8:07 PM, Frederick Polgardy wrote:

Re: BUG: Clojure hierarchies (affects 1.2-beta1)

2010-07-21 Thread Michał Marczyk
Made a ticket for this here (including the simple diagnosis): https://www.assembla.com/spaces/clojure/support/tickets/406-typo-in-underive-causes-breaking-in-the-resulting-hierarchy No patch, since my CA wasn't ack'd yet... Sincerely, Michał -- You received this message because you are

Re: Literate Clojure - a good lead ...

2010-07-21 Thread martin_clausen
A good example of this for a non-trivial app is here: http://genprog.adaptive.cs.unm.edu/asm/instructions.html /mac On Jul 21, 8:54 am, Tassilo Horn tass...@member.fsf.org wrote: On Wednesday 21 July 2010 06:32:02 Mark Engelberg wrote: Hi Mark, I would definitely welcome a literate

gobble up a collection 2 at a time

2010-07-21 Thread Glen Rubin
Hi! I want to process a collection 2 elements at a time using map. My function accepts 2 parameters (a,b) and returns a result (c): (myfcn [a b]) = c so I want to iterate myfcn over a collection and create a new sequence for example let's say myfcn sums a and b, then i would like to do

Re: gobble up a collection 2 at a time

2010-07-21 Thread jim
Use partition: (map (apply myfcn) (partition 2 [1 2 3 4 5 6 7 8])) Or something like that. Not at a REPL so that's from memory. Experiment with partition at the repl and it'll become clear. Jim On Jul 21, 9:20 pm, Glen Rubin rubing...@gmail.com wrote: Hi!  I want to process a collection 2

Re: gobble up a collection 2 at a time

2010-07-21 Thread Wilson MacGyver
you have to partition it first. user= (partition 2 [1 2 3 4 5 6 7 8]) ((1 2) (3 4) (5 6) (7 8)) let's say we want to add the numbers. user= (map #(apply + %) (partition 2 [1 2 3 4 5 6 7 8])) (3 7 11 15) On Wed, Jul 21, 2010 at 10:20 PM, Glen Rubin rubing...@gmail.com wrote: Hi!  I want to

Re: Literate Clojure - a good lead ...

2010-07-21 Thread Tim Daly
Antony Blakey wrote: On 22/07/2010, at 3:08 AM, Tim Daly wrote: Language integration is a false goal. It is technically possible to call functions in any language from latex but unnecessary in general. It is technically possible to generate latex from any language. Have you read

Re: gobble up a collection 2 at a time

2010-07-21 Thread David Cabana
Here's my take: (defn mmap [f coll] (- coll (partition 2) (map (fn [[x y]] (f x y) For instance: user (mmap + (range 8)) (1 5 9 13) user (mmap * (range 8)) (0 6 20 42) You probably want to think about whether you'll see input sequences with an odd number of terms, and how

Re: Two convenience methods

2010-07-21 Thread B Smith-Mannschott
On Wed, Jul 21, 2010 at 23:45, Travis Hoffman travis.a.hoff...@gmail.com wrote: ... The second function is suggested as an addition to clojure.set. The disjoint? function decides if two sets have no elements in common. This can easily be done using:  (not (nil? (intersection s1 s2))) but