Re: swank-cdt: Using Slime with the Clojure Debugging Toolkit

2011-04-26 Thread Sam Aaron
Hi Phil, On 26 Apr 2011, at 06:22, Phil Hagelberg wrote: On Apr 25, 12:12 pm, Sam Aaron samaa...@gmail.com wrote: I'm curious, what are your requirements for native dependencies? I have never needed them, so I've relied on contributors and external plugins because I don't know what's

Re: Error with eval syntax-quote PersistentArrayMap

2011-04-26 Thread Alan
You are using macroexpand wrong. Don't eval anything when you are macroexpanding - the point is to see what code will be executed. The issue Kevin is bringing to your attention is evident in the first code snippet you gave: ... :content ({:tag :profileDetail, :name first.name, :value stub,

Aw: Merging two maps based on ids

2011-04-26 Thread Meikel Brandmeyer
Hi, you can construct the output sequence from your input sequences. (defn merge-data [data-orig data-override] (let [override-ids (set (map :id data-override))] (concat data-override (remove (comp override-ids :id) data-orig If you need your output sorted you can also add a

defnk pre- and post-conditions

2011-04-26 Thread David Jagoe
G'day folks, I've recently started using defnk more widely, and just run into the fact that pre and post conditions won't work. I understand that this is because they are a clojure special form and therefore cannot be supported by the macro - is that right? Is there any way to work around that?

Aw: defnk pre- and post-conditions

2011-04-26 Thread Meikel Brandmeyer
Hi, clojure supports keyword arguments for a quote some time now. (defn foo [positional1 ... positionalN {:keys [kw1 ... kwn]}] ...) The syntax is the usual destructuring syntax for maps. So you can specify defaults via :or etc. And even have none keyword keys. Sincerely Meikel -- You

Re: Understanding the Clojure source-code and functionality

2011-04-26 Thread Terje Dahl
This looks conceptually very interesting. This is the first time I have ever heard of literate programming. However, the project is far from complete. And while I could even consider contributing to it later, for now, it doesn't give me much. And also, while converting clojure to a literate

Re: clojure.contrib.sql = clojure.java.jdbc - looking for feedback!

2011-04-26 Thread Stuart Halloway
Also see related problems reported by others: http://osdir.com/ml/clojure/2010-10/msg00290.html (sorry, can't find it on the group.) Yes, resultset-seq does lowercase the column names and it doesn't translate between - / _ either. But that's not part of c.j.j so, whilst I may agree with

Re: Aw: defnk pre- and post-conditions

2011-04-26 Thread Hugo Duncan
On Tue, 26 Apr 2011 07:27:52 -0400, Meikel Brandmeyer m...@kotka.de wrote: clojure supports keyword arguments for a quote some time now. (defn foo [positional1 ... positionalN {:keys [kw1 ... kwn]}] ...) This is used extensively in Pallet but has a couple of drawbacks. - Repetition

Re: Aw: defnk pre- and post-conditions

2011-04-26 Thread Ambrose Bonnaire-Sergeant
On Tue, Apr 26, 2011 at 8:26 PM, Hugo Duncan duncan.h...@gmail.com wrote: Inspired by a discussion [1] on supporting shFlags in stevedore, I drafted a defnkw [2] that allows for the following syntax: (defnkw foo My foo [positional1 … positionalN [[kw1 description1 default1]

Re: clojure.contrib.sql = clojure.java.jdbc - looking for feedback!

2011-04-26 Thread David Powell
Yes, resultset-seq does lowercase the column names and it doesn't translate between - / _ either. But that's not part of c.j.j so, whilst I may agree with the criticisms of it, I can't actually fix that :) There is justification for resultset-seq's current behaviour, even if it isn't to

Re: ANN: pallet.thread-expr, a macro lib for use with - argument threading

2011-04-26 Thread George Jahad
Agreed; these do look real interesting. I keep meaning to try them. I've just been a little busy lately;) On Apr 22, 1:47 pm, Nicolas Buduroi nbudu...@gmail.com wrote: This is a very interesting set of macros, I'll certainly use some of them. In fact I think this library should at least make

Re: ANN: Slamhound (for reconstructing ns forms)

2011-04-26 Thread gaz jones
this looks awesome, tried it out on a project i have but sadly got the exception below. i'll try and figure it out later when i have more time to see if its something specific to my project, but thought i would let you know in case it is something obvious (it failed from both slime and lein)

Re: Error with eval syntax-quote PersistentArrayMap

2011-04-26 Thread Timothy Washington
Ah, I see I see. Well it's all starting to click. I didn't realise eval tries to execute all the nested forms inside that map. I just turned those into vectors and I'm back on my way :) Thanks guys Tim On Tue, Apr 26, 2011 at 3:32 AM, Alan a...@malloys.org wrote: You are using macroexpand

Re: defnk pre- and post-conditions

2011-04-26 Thread David Jagoe
On 26 April 2011 13:27, Meikel Brandmeyer m...@kotka.de wrote: Hi, clojure supports keyword arguments for a quote some time now. (defn foo   [positional1 ... positionalN {:keys [kw1 ... kwn]}]   ...) The syntax is the usual destructuring syntax for maps. So you can specify defaults via

Re: Merging two maps based on ids

2011-04-26 Thread pepijn (aka fliebel)
Another option is using clojure.set, as is shown here: https://github.com/pepijndevos/Begame/blob/master/src/begame/util.clj#L99 On Apr 26, 10:10 am, Meikel Brandmeyer m...@kotka.de wrote: Hi, you can construct the output sequence from your input sequences. (defn merge-data   [data-orig

Re: rewriting seque

2011-04-26 Thread pepijn (aka fliebel)
Hah! Can anyone confirm I'm not daydreaming, and that this actually works? https://gist.github.com/934781 I ended up using an ad hoc, informally-specified, bug-ridden, slow implementation of half of BlockingQueue, but it seems to work /all the time!/ On Apr 22, 9:08 pm, Pepijn de Vos

Re: swank-cdt: Using Slime with the Clojure Debugging Toolkit

2011-04-26 Thread Sunil S Nandihalli
integration of cdt with swank is really nice. Thanks for the great work. I tried to set break points at multimethods. but I am unable to do so. Can some body help ? Thanks, Sunil. On Tue, Apr 26, 2011 at 12:21 PM, Sam Aaron samaa...@gmail.com wrote: Hi Phil, On 26 Apr 2011, at 06:22, Phil

setting break points at multimethods in cdt

2011-04-26 Thread Sunil S Nandihalli
Hello everybody, I am unable to set break points at multimethods using set-bp ..( I am able to set break points for other functions.. though) .. can somebody tell me how to do this? I am using swank-cdt integration. It works very nicely otherwise. Thanks, Sunil. -- You received this message

Re: ANN: Slamhound (for reconstructing ns forms)

2011-04-26 Thread Phil Hagelberg
On Apr 26, 6:25 am, gaz jones gareth.e.jo...@gmail.com wrote: this looks awesome, tried it out on a project i have but sadly got the exception below. i'll try and figure it out later when i have more time to see if its something specific to my project, but thought i would let you know in case

Re: swank-cdt: Using Slime with the Clojure Debugging Toolkit

2011-04-26 Thread Phil Hagelberg
On Apr 25, 11:51 pm, Sam Aaron samaa...@gmail.com wrote: I was originally using lein and the native-deps plugin for my projects, but it's much more cumbersome than cake's approach. On the periphery it doesn't seem too bad, in your project.clj you need to include native-deps in your

Re: Merging two maps based on ids

2011-04-26 Thread Jonathan Fischer Friberg
(defn merge-data [data1 data2] (map first (partition-by :id (sort-by :id (concat data1 data2) Since the sorting is stable (relative order is kept), we know that the first occurrence of each id is either the existing map from data1, or the new map from data2. On Tue, Apr 26, 2011 at 5:34

Re: Merging two maps based on ids

2011-04-26 Thread Jonathan Fischer Friberg
Correction: (concat data1 data2) should be (concat data2 data1) On Tue, Apr 26, 2011 at 6:37 PM, Jonathan Fischer Friberg odysso...@gmail.com wrote: (defn merge-data [data1 data2] (map first (partition-by :id (sort-by :id (concat data1 data2) Since the sorting is stable (relative

Re: ANN: Slamhound (for reconstructing ns forms)

2011-04-26 Thread Aaron Bedra
I love you Phil. On 04/25/2011 09:05 PM, Phil Hagelberg wrote: So I just threw together a little tool to help with ns forms. I find often they accumulate a bunch of cruft over time where you no longer need a given :use or :require form. And sometimes you don't feel like finding exactly where on

Re: closed maps / reducing runtime errors due to mistyped keywords

2011-04-26 Thread Steve Miner
Creating your own Closed Map type would be the object-oriented approach. One downside is that a closed-map feels like a normal map, but can't be safely substituted for most maps because of the booby-trap when using assoc (etc.) with a new key. It doesn't really fulfill the map contract

Re: swank-cdt: Using Slime with the Clojure Debugging Toolkit

2011-04-26 Thread Sam Aaron
On 26 Apr 2011, at 17:15, Phil Hagelberg wrote: On Apr 25, 11:51 pm, Sam Aaron samaa...@gmail.com wrote: I was originally using lein and the native-deps plugin for my projects, but it's much more cumbersome than cake's approach. On the periphery it doesn't seem too bad, in your

Re: clojure.contrib.sql = clojure.java.jdbc - looking for feedback!

2011-04-26 Thread Sean Corfield
On Tue, Apr 26, 2011 at 6:19 AM, David Powell djpow...@djpowell.net wrote: There is justification for resultset-seq's current behaviour, even if it isn't to everyone's preference. Agreed. And I would actually want the lowercasing behavior to remain the default, for my own use anyway. What irks

Re: setting break points at multimethods in cdt

2011-04-26 Thread George Jahad
so cdt supports two kinds of breakpoints, method breakpoints, (with the set-bp function) and line breakpoints, (with the ^c^x^b,) keystroke in emacs. You are corrrect that the set-bp function doesn't work properly with multi-methods, but line breakpoints should be working. Are they? On Apr 26,

Odd Java interop behavior

2011-04-26 Thread Ken Wesson
Anyone know what is going on here? I'm trying to use my Clojure REPL to rename a file that's gotten stuck on my Windows box (somehow, both Explorer and the command prompt claim the file isn't found if I try to move, delete, or rename it) but I get this: com.example.isii= (FileInputStream. (nth

Re: Understanding the Clojure source-code and functionality

2011-04-26 Thread Chas Emerick
FWIW, I'm hoping that Clojure Atlas[1] may be helpful to someone with your objectives. I've often found Chris Houser's class diagram[2] helpful, especially in my earlier days; hopefully the Atlas will make it even easier to see the correspondence between key concepts, abstractions, and functions

Re: Odd Java interop behavior

2011-04-26 Thread Jonathan Fischer Friberg
Since you are essentially using java, I think that a clojure bug can be ruled out. Have you checked the drive for errors? On Tue, Apr 26, 2011 at 8:12 PM, Ken Wesson kwess...@gmail.com wrote: Anyone know what is going on here? I'm trying to use my Clojure REPL to rename a file that's gotten

Re: Odd Java interop behavior

2011-04-26 Thread Dave Ray
If the blah blah blah... is meant to represent a very long file name or path, my guess would be that you've bumped up against the Windows path limit (260 chars) which can manifest itself in weird ways. See cause 4 here: http://support.microsoft.com/kb/320081 Since you're also having issues in

Re: closed maps / reducing runtime errors due to mistyped keywords

2011-04-26 Thread Ken Wesson
On Tue, Apr 26, 2011 at 1:06 PM, Steve Miner stevemi...@gmail.com wrote: Creating your own Closed Map type would be the object-oriented approach.   One downside is that a closed-map feels like a normal map, but can't be safely substituted for most maps because of the booby-trap when using

Re: ANN: Slamhound (for reconstructing ns forms)

2011-04-26 Thread Phil Hagelberg
On Apr 26, 6:25 am, gaz jones gareth.e.jo...@gmail.com wrote: this looks awesome, tried it out on a project i have but sadly got the exception below. i'll try and figure it out later when i have more time to see if its something specific to my project, but thought i would let you know in case

Re: Odd Java interop behavior

2011-04-26 Thread Ken Wesson
On Tue, Apr 26, 2011 at 2:26 PM, Dave Ray dave...@gmail.com wrote: If the blah blah blah... is meant to represent a very long file name or path, my guess would be that you've bumped up against the Windows path limit (260 chars) which can manifest itself in weird ways. I assume that the file

Re: Odd Java interop behavior

2011-04-26 Thread Aaron Cohen
On Tue, Apr 26, 2011 at 2:36 PM, Ken Wesson kwess...@gmail.com wrote: On Tue, Apr 26, 2011 at 2:26 PM, Dave Ray dave...@gmail.com wrote: If the blah blah blah... is meant to represent a very long file name or path, my guess would be that you've bumped up against the Windows path limit (260

Re: Odd Java interop behavior

2011-04-26 Thread Dave Ray
Ok. But whether it's reasonable or not, it can happen. For example, the project I work on can't be located in a Windows folder deeper than 37 chars long because Swig generates a particularly long Java file. It has no problems writing it, but further down the the build pipeline, javac dies when it

Re: Odd Java interop behavior

2011-04-26 Thread Ken Wesson
On Tue, Apr 26, 2011 at 2:36 PM, Ken Wesson kwess...@gmail.com wrote: On Tue, Apr 26, 2011 at 2:26 PM, Dave Ray dave...@gmail.com wrote: If the blah blah blah... is meant to represent a very long file name or path, my guess would be that you've bumped up against the Windows path limit (260

Re: Grabbing Rotten Tomatoes movie ratings in clojure

2011-04-26 Thread justinhj
An update on this little side project to grab movie ratings from popular a movie website: I've add it to github and included the project file and updated the README https://github.com/justinhj/movieratings Also fixed it so it works with a recent change their page format. Justin -- You

Re: Grabbing Rotten Tomatoes movie ratings in clojure

2011-04-26 Thread Aaron Cohen
On Tue, Apr 26, 2011 at 3:19 PM, justinhj justi...@gmail.com wrote: An update on this little side project to grab movie ratings from popular a movie website: I've add it to github and included the project file and updated the README https://github.com/justinhj/movieratings Also fixed it so

cond in dosync problem

2011-04-26 Thread Zlatko Josic
Hi, I use cond in dosync but it doesn't work. Here is a function code: (defn process-request [offer args] (logger/log process called) (let [offer-value (Double/parseDouble (:offer offer)) out-queue (:out-queue args) unique-offers (:unique-offers args)

Re: cond in dosync problem

2011-04-26 Thread Jonathan Fischer Friberg
I don't know. However, given the situation I think (cond (empty? @unique-offers) (dosync ... alter ...) :else (logger/log error)) is better, since the change is more isolated. On Tue, Apr 26, 2011 at 9:45 PM, Zlatko Josic zlatko.jo...@gmail.comwrote: Hi, I use cond in dosync but it

Re: ANN: Slamhound (for reconstructing ns forms)

2011-04-26 Thread James Reeves
1.1.0 seems to have regressed. I've added slamhound as a dependency: (defproject foobar 1.0.0-SNAPSHOT :description FIXME: write description :dependencies [[org.clojure/clojure 1.2.1]] :dev-dependencies [[slamhound 1.1.0]]) Then added a function to src/foobar/core.clj: (ns foobar.core)

Re: cond in dosync problem

2011-04-26 Thread Jonathan Fischer Friberg
On a closer look: ((logger/log map @unique-offers) (alter unique-offers assoc offer-value streams)) should probably be (do (logger/log map @unique-offers) (alter unique-offers assoc offer-value streams)) On Tue, Apr 26, 2011 at 9:55 PM, Jonathan Fischer Friberg

Re: cond in dosync problem

2011-04-26 Thread Zlatko Josic
I have given only part of function. I have condition like this : (cond (and (empty? @unique-offers) (empty? @all-offers)) I change in dosync both unique-offers and all-offers. If I use your suggestion (empty? @unique-offers) (dosync ... alter ...) Can I get in situation where unique-offers

Re: ANN: Slamhound (for reconstructing ns forms)

2011-04-26 Thread .Bill Smith
That's a great idea, Phil. Thanks for contributing! -- 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 patient with your first post.

Re: cond in dosync problem

2011-04-26 Thread Jonathan Fischer Friberg
The important part were that the dosync call is isolated. The condition doesn't really matter. By the way: wouldn't it be simpler to create a new map instead of altering unique-offers/all-offers? (this is also more idiomatic) On Tue, Apr 26, 2011 at 10:02 PM, Zlatko Josic

Re: cond in dosync problem

2011-04-26 Thread Zlatko Josic
Is this scenario posible : (def test-map (ref {})) (def test-map2 (ref {})) (defn process [map1 map2] (cond (and (empty? @map1) (empty? @map2)) (dosync ((alter map1 assoc key1 value1) (alter map2 assoc key2 value2) . Suppose the process method is called from many threads.

Re: cond in dosync problem

2011-04-26 Thread Jonathan Fischer Friberg
No, that isn't possible. http://clojure.org/refs Inside a transaction (a dosync call), values updated in another transaction wont be seen. This means that the first transaction wont see the change until it commits, at that moment it realizes that the ref that were altered was changed outside of

Re: ANN: Slamhound (for reconstructing ns forms)

2011-04-26 Thread Phil Hagelberg
On Apr 26, 12:58 pm, James Reeves jree...@weavejester.com wrote: When I start a REPL and try to slamhound it, it instead throws an exception: user= (require 'slam.hound) nil user= (slam.hound/reconstruct src/foobar/core.clj) java.lang.Exception: No such namespace: str (core.clj:2) That's by

Re: Serialising functions...

2011-04-26 Thread kovas boguta
Hi, This sounds very interesting and useful. Is the source code available somewhere? Or a more detailed description? Thanks On Fri, Mar 4, 2011 at 1:48 AM, Jules jules.gosn...@gmail.com wrote: So, Just a quick update. I gave the client-side ClassLoader encapsulation idea some more

Re: cond in dosync problem

2011-04-26 Thread Meikel Brandmeyer
Hi, Am 26.04.2011 um 22:33 schrieb Zlatko Josic: Is this scenario posible : (def test-map (ref {})) (def test-map2 (ref {})) (defn process [map1 map2] (cond (and (empty? @map1) (empty? @map2)) (dosync ((alter map1 assoc key1 value1) (alter map2 assoc key2 value2)

Re: cond in dosync problem

2011-04-26 Thread Daniel Werner
On Apr 26, 10:52 pm, Jonathan Fischer Friberg odysso...@gmail.com wrote: No, that isn't possible.http://clojure.org/refs I disagree: In the example given, dereferencing happens outside the dosync block, thus outside of any transaction, so a race where map1 and map2 change midway through the

Re: cond in dosync problem

2011-04-26 Thread Jonathan Fischer Friberg
Yes, you're right, I'm wrong. :) The derefs must be in the dosync block. (which I somehow assumed, oh well) On Tue, Apr 26, 2011 at 11:17 PM, Daniel Werner daniel.d.wer...@googlemail.com wrote: On Apr 26, 10:52 pm, Jonathan Fischer Friberg odysso...@gmail.com wrote: No, that isn't

Re: ANN: Slamhound (for reconstructing ns forms)

2011-04-26 Thread James Reeves
On 26 April 2011 22:16, Phil Hagelberg p...@hagelb.org wrote: On Apr 26, 12:58 pm, James Reeves jree...@weavejester.com wrote: When I start a REPL and try to slamhound it, it instead throws an exception: user= (require 'slam.hound) nil user= (slam.hound/reconstruct src/foobar/core.clj)

Re: cond in dosync problem

2011-04-26 Thread Zlatko Josic
Any idea why changes in the function below does'nt work (see first post on this topic)? (defn process-request [offer args] (logger/log process called) (let [offer-value (Double/parseDouble (:offer offer)) out-queue (:out-queue args) unique-offers (:unique-offers args)

RE: Merging two maps based on ids

2011-04-26 Thread Bhinderwala, Shoeb
Thanks Baishampayan, Meikel, pepijn, and Jonathan. The use of partition-by function does solve this very elegantly. Below is the list of solutions I have received: (defn merge-data [data1 data2] (map first (partition-by :id (sort-by :id (concat data2 data1) (defn

Re: ANN: Slamhound (for reconstructing ns forms)

2011-04-26 Thread Phil Hagelberg
On Apr 26, 2:56 pm, James Reeves jree...@weavejester.com wrote: On 26 April 2011 22:16, Phil Hagelberg p...@hagelb.org wrote: That's by design; it only works when the :as alias is the same as the last segment of the namespace name. Ah, well even if I use string/trim it throws the same

Re: Error with eval syntax-quote PersistentArrayMap

2011-04-26 Thread Ken Wesson
Timothy Washington twash...@gmail.com wrote: user= (eval `(commands/add ~processed ~@etal)) Is there a reason for using eval here, such as you're debugging a macro, or could you just use user= (apply commands/add processed etal) ? -- You received this message because you are subscribed to

Re: cond in dosync problem

2011-04-26 Thread Meikel Brandmeyer
Hi, Am 27.04.2011 um 00:33 schrieb Zlatko Josic: Any idea why changes in the function below does'nt work (see first post on this topic)? (defn process-request [offer args] (logger/log process called) (let [offer-value (Double/parseDouble (:offer offer)) out-queue

How to determine a function name at runtime

2011-04-26 Thread clj123123
I have a function: (defn abc [] (println blah)) (defn blah2 [f] (println f)) (blah2 abc) I need to print out the name of the function passed to blah2. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: How to determine a function name at runtime

2011-04-26 Thread James Reeves
On 27 April 2011 00:05, clj123123 ariela2...@gmail.com wrote: I have a function: (defn abc [] (println blah)) (defn blah2 [f] (println f)) (blah2 abc) I need to print out the name of the function passed to blah2. Then you want something like: (defn blah2 [f] (println (:name (meta

Re: How to determine a function name at runtime

2011-04-26 Thread clj123123
Thank you James, this worked for me. On Apr 26, 4:11 pm, James Reeves jree...@weavejester.com wrote: On 27 April 2011 00:05, clj123123 ariela2...@gmail.com wrote: I have a function: (defn abc [] (println blah)) (defn blah2 [f] (println f)) (blah2 abc) I need to print out the name

Re: setting break points at multimethods in cdt

2011-04-26 Thread Sunil S Nandihalli
thanks George for your reply. for some reason C-c C-x C-b key stroke does not seem to be bound .. however, I don't mind typing the command at the repl. But, I don't seem to get the path right? .. should the path be absolute or should it be relative to the directory where the project.clj resides..?

Re: ANN: Slamhound (for reconstructing ns forms)

2011-04-26 Thread James Reeves
On 26 April 2011 23:49, Phil Hagelberg p...@hagelb.org wrote: On Apr 26, 2:56 pm, James Reeves jree...@weavejester.com wrote: On 26 April 2011 22:16, Phil Hagelberg p...@hagelb.org wrote: However, there was an unrelated bug causing issues when uncompilable namespaces were on the classpath.

Re: How to determine a function name at runtime

2011-04-26 Thread Ken Wesson
On Tue, Apr 26, 2011 at 7:18 PM, clj123123 ariela2...@gmail.com wrote: Thank you James, this worked for me. On Apr 26, 4:11 pm, James Reeves jree...@weavejester.com wrote: On 27 April 2011 00:05, clj123123 ariela2...@gmail.com wrote: I have a function: (defn abc [] (println blah))

Re: How to determine a function name at runtime

2011-04-26 Thread James Reeves
On 27 April 2011 01:09, Ken Wesson kwess...@gmail.com wrote: It has some limitations, though. Specifically, it won't work with local functions, even named ones: Yes, good point! A more foolproof way might be to use a macro, but then macros have their own disadvantages. It depends on what

Re: setting break points at multimethods in cdt

2011-04-26 Thread George Jahad
see if the elisp exists, like so: M-x describe-function sldb-line-bp see if the keymap exists like so: M-x describe-value cdt-map if they do, go to a java file higher up in the stack trace, and see if ^c^x^b works there. if not, try running this from the slime-repl: