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", :
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 "(sord-b
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? Ha
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
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 pr
>> 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 agre
On Tue, 26 Apr 2011 07:27:52 -0400, Meikel Brandmeyer 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 of keywords to
On Tue, Apr 26, 2011 at 8:26 PM, Hugo Duncan 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]
> [kw2 descrip
>
>
> 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'
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 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 it to clojure.cont
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)
Excep
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 wrote:
> You are using macroexpand wrong. Don't eval a
> I don't want to make a breaking change to the existing API, but in a world
> there there is an actively-maintained clojure.java.jdbc I don't think a
> resultset function in core makes a lot of sense anyway.
>
> How about we mark core's resultset-seq as deprecated, with a link to the new
> pro
On 26 April 2011 13:27, Meikel Brandmeyer 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 :or
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 wrote:
> Hi,
>
> you can construct the output sequence from your input sequences.
>
> (defn merge-data
> [data-orig data-overri
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 wrote:
> Hey
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 wrote:
> Hi Phil,
>
> On 26 Apr 2011, at 06:22, Phil Hagelberg wrote:
>
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 becau
On Apr 26, 6:25 am, gaz jones 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 it is something obvio
On Apr 25, 11:51 pm, Sam Aaron 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 :dev-dependencies, and
(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 PM,
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
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
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 anymo
On 26 Apr 2011, at 17:15, Phil Hagelberg wrote:
> On Apr 25, 11:51 pm, Sam Aaron 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
On Tue, Apr 26, 2011 at 6:19 AM, David Powell 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 me more is the lack
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,
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
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
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 wrote:
> 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 Windo
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 i
On Tue, Apr 26, 2011 at 1:06 PM, Steve Miner 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 assoc
> (etc.) with
On Apr 26, 6:25 am, gaz jones 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 it is something obvio
On Tue, Apr 26, 2011 at 2:26 PM, Dave Ray 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 name cannot exc
On Tue, Apr 26, 2011 at 2:36 PM, Ken Wesson wrote:
> On Tue, Apr 26, 2011 at 2:26 PM, Dave Ray 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 itse
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 t
On Tue, Apr 26, 2011 at 2:36 PM, Ken Wesson wrote:
> On Tue, Apr 26, 2011 at 2:26 PM, Dave Ray 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 itse
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 rece
On Tue, Apr 26, 2011 at 3:19 PM, justinhj 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 it works with
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)
all-of
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 wrote:
> Hi,
>
> I use cond in dosync but it doesn't work. Here is
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
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 <
ody
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 i
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
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 wrote:
> I have given
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. Is
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 th
On Apr 26, 12:58 pm, James Reeves 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 design; it on
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 wrote:
>
> So,
>
> Just a quick update.
>
> I gave the client-side ClassLoader encapsulation idea some more
> thought and rejeted it
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 v
On Apr 26, 10:52 pm, Jonathan Fischer Friberg
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 #'and expression is the
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
> wrote:
> > No, that isn't possible.http://clojure
On 26 April 2011 22:16, Phil Hagelberg wrote:
>
> On Apr 26, 12:58 pm, James Reeves 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.Exceptio
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)
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 merge-data2
On Apr 26, 2:56 pm, James Reeves wrote:
> On 26 April 2011 22:16, Phil Hagelberg 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 error:
Right; this should be fixed
Timothy Washington 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 the Google
Groups
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))
>
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 clojure@g
On 27 April 2011 00:05, clj123123 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 f
- James
Thank you James, this worked for me.
On Apr 26, 4:11 pm, James Reeves wrote:
> On 27 April 2011 00:05, clj123123 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
You where right. return of logger/log was nil.
Thank you very much.
On Wed, Apr 27, 2011 at 1:04 AM, Meikel Brandmeyer wrote:
> 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)?
> >
> >
> > (def
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..?
On 26 April 2011 23:49, Phil Hagelberg wrote:
> On Apr 26, 2:56 pm, James Reeves wrote:
>> On 26 April 2011 22:16, Phil Hagelberg wrote:
>> > However, there was an unrelated bug causing issues when uncompilable
>> > namespaces were on the classpath. I'll have a 1.1.1 fix pushed in a
>> > few min
On Tue, Apr 26, 2011 at 7:18 PM, clj123123 wrote:
> Thank you James, this worked for me.
>
> On Apr 26, 4:11 pm, James Reeves wrote:
>> On 27 April 2011 00:05, clj123123 wrote:
>>
>> > I have a function:
>>
>> > (defn abc [] (println "blah"))
>>
>> > (defn blah2 [f] (println f))
>>
>> > (blah2 a
On 27 April 2011 01:09, Ken Wesson 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 clj123123 wants to us
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:
(swank.core.cdt-utils/init-em
68 matches
Mail list logo