sorted-set-by drops elements

2010-04-16 Thread Razvan
Hi, Is this the intended behavior? (sorted-set-by (constantly 0) 1 2 3 4) returns #{1}. I would expect the set to contain all the elements, and the comparator to only affect sort order. Razvan -- You received this message because you are subscribed to the Google Groups "Clojure"

Re: sorted-set-by drops elements

2010-04-16 Thread Razvan
Why should sorting be related to the primary key? You should be able to sort on any attribute. If you wanted to sort a set of people by age would it make sense to only retain one person of each age? Sort order and identity should be orthogonal. Besides, if you need a collection based on primary key

Re: Examples of Clojure in production?

2010-04-19 Thread Razvan
FlightCaster were just mentioned in a recent thread. They use Incanter in production: http://measuringmeasures.com/ Razvan -- 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

Re: History Question

2010-05-07 Thread Razvan
I think it returns :a rather than just a so that you can print stuff, then read it back in and it would be the same. You can use it to dump configuration data to a file for example then load it later easily. Razvan On Thu, May 6, 2010 at 10:21 PM, Meikel Brandmeyer wrote: > Hi, > >

Re: Extending Clojure's STM with external transactions

2008-12-04 Thread Razvan Ludvig
ot;heuristic commit", when all resources confirmed the "prepare" stage, but not the final "commit". This situation does not exist with pure STM, so one would have to be aware of the risk and settle for less guarantees when using "composite" transactions. Razvan.

Re: Extending Clojure's STM with external transactions

2008-12-09 Thread Razvan Ludvig
Cool stuff, Dave. I'm interested to see/test it, could you post it as an attachment to this group or commit it to contrib ? Cheers, Razvan. On Dec 8, 9:08 pm, Dave Griffith <[EMAIL PROTECTED]> wrote: > Okay, hacking complete.  I've got a patch that extends the Clojure ST

question about clojure.lang.LazySeq.toString()

2013-03-21 Thread Razvan Rotaru
Hi, I'm curious, why doesn't toString of clojure.lang.LazySeq return the entire sequence as a String, and returns the Java pointer instead? I find it annoying when I do this: user> (str (map + [1 2 3])) "clojure.lang.LazySeq@7861" What's the reason behind this decision? Shouldn't toString tr

bug in partition?

2011-06-13 Thread Razvan Rotaru
(recur (rest user-pass))) false) )) Calling this function throws a NullPointerException. Any hint is greatly appreciated. Thanks, Razvan -- You received this message because you are subscribed to the Google Groups "Clojure&q

Re: bug in partition?

2011-06-13 Thread Razvan Rotaru
Thanks. But still I don't get something. Shouldn't partition return a sequence? Shouldn't every sequence end with nil? Razvan -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@g

Re: Vim Nailgun setup - access to REPL from outside Vim

2011-06-14 Thread Razvan Rotaru
You may also want to have a look at slimv. http://www.vim.org/scripts/script.php?script_id=2531 It performs quite nice (can't compare it with vimclojure though, 'cause I don't know vimclojure). Razvan -- You received this message because you are subscribed to the Google Groups

Re: bug in partition?

2011-06-14 Thread Razvan Rotaru
Thanks for the hint. And don't worry about the meaning of this function. :) Name parameter has no use. And the regex stuff's for the url. Razvan -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, s

Cyclic load dependency

2011-07-16 Thread Razvan Rotaru
ang.RestFn.applyTo(RestFn.java:137) 9: clojure.core$apply.invoke(core.clj:544) Cheers, Razvan -- 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

get keys from defrecord

2011-08-29 Thread Razvan Rotaru
Hi, Assuming I have: (defrecord myrecord [:a :b :c]) is there a way to get the list of keys from the record definition? Thanks, Razvan -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@google

metadata for records

2011-10-01 Thread Razvan Rotaru
Hi, Is there a way to attach metadata to defrecord ? Razvan -- 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

"Can't eval locals problem"

2011-10-03 Thread Razvan Rotaru
f something at macro expansion time. Apparently clojure does not (fully) support this, so I'm looking then for alternatives. Cheers, Razvan -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@goo

how to use record as a value

2011-10-06 Thread Razvan Rotaru
e variable "stuff". Something like: (let [stuff car] (new stuff 1982 "Mercedes")) (let [stuff bike] (new stuff 1990 "Harley Davidson")) Obviously new does not work. I'm gratefull for suggestions of how to do it best. Thanks, Razvan -- You received this mes

Re: how to use record as a value

2011-10-06 Thread Razvan Rotaru
... (assoc stuff :year 2001 :manufacturer "Seat")) But this will work only if all my types have the same parameters. If bike would be: (defrecord bike [manufacturer year type]) then i'm stuck again. Razvan On Oct 6, 8:32 pm, Aaron Bedra wrote: > Assuming you want to do things wi

Re: how to use record as a value

2011-10-06 Thread Razvan Rotaru
This is what I'm looking for. Thanks. I have not seen this kind of expression before: ->foo. Is is created by defrecord or is it implemented at reader level? I realize now that I can also keep a generating function in the variable stuff: (let [stuff #(car. %1 %2)] (stuff 1982 "Mercedes") (stu

Re: "Can't eval locals problem"

2011-10-19 Thread Razvan Rotaru
changing the query macro. So, for the moment I'm waiting for a new version. Thanks anyway. I really appreciate the activity on this group. Razvan On Oct 3, 11:49 pm, Michał Marczyk wrote: > Ok, so I mailed off the above discussion without including any > suggestions for alternative

shortcut for anonymous function literal and syntax quote

2011-10-19 Thread Razvan Rotaru
ve some suggestion, I'd be glad to hear it. Thanks, Razvan -- 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

Re: shortcut for anonymous function literal and syntax quote

2011-11-01 Thread Razvan Rotaru
Yeah, you are probably right. But I figured asking never hurts... Thanks for the reply. Razvan On Oct 19, 10:50 pm, Alan Malloy wrote: > Not really. In _Let Over Lambda_'s section on reader macros, he > creates a reader macro #`(foo bar a1 a2) that expands to (lambda (a1 > a2) `(f

appengine-magic + servlets

2011-11-06 Thread Razvan Rotaru
Hi, appengine-magic (https://github.com/gcv/appengine-magic) uses ring- handlers to turn into servlets that are accepted by GAE. Does anybody know how to use servlets directly with appengine-magic? I'm not using ring, I have a servlet which I need to feed to appengine-magic. Thanks, R

Re: problems of a newbie

2011-11-06 Thread Razvan Rotaru
hat in the lisp world, code analysis tools are that wanted. We have Common Lisp for quite some time now, and people seem quite happy with slime. Razvan On Nov 5, 2:16 pm, Dennis Haupt wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > hi, > > i'm half done with my

Re: appengine-magic + servlets

2011-11-06 Thread Razvan Rotaru
e/def-appengine-servlet-app my-app #'my-servlet) Razvan On Nov 6, 4:32 pm, Mark Rathwell wrote: > > I'm not using > > ring, I have a servlet which I need to feed to appengine-magic. > > Not sure what you mean by this, could you expand on it a little more? > You have an ex

Re: appengine-magic + servlets

2011-11-06 Thread Razvan Rotaru
The servlet is coming from an external jar, which is written in Java. I need appengine-magic for the other services, like datastore. Razvan On Nov 6, 7:45 pm, Mark Rathwell wrote: > I'm still not quite following.  What appengine-magic does is provides > Clojure wrappers for many

Re: appengine-magic + servlets

2011-11-07 Thread Razvan Rotaru
let. I just want to feed this servlet to appengine-magic. Thanks, Razvan On Nov 6, 10:43 pm, Mark Rathwell wrote: > I'm still having trouble figuring out what it is you are wanting to > do, but if you have an existing Java servlet that will handle some url > pattern, and you want to write

keyword arguments

2011-11-27 Thread Razvan Rotaru
check args in the code (i.e. checking should be done when evaluating/creating the function, and not when executing). Thanks, Razvan -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.co

on lisp and scheme macros

2011-12-03 Thread Razvan Rotaru
ff, but then again I don't know of another language that borrows these kind of macros. Does anybody know? And lastly, a question to Rich Hickey, should he read this post: what is the reasoning behind the choice of lisp macros over scheme's? Cheers, Razvan -- You received this message becaus

Re: on lisp and scheme macros

2011-12-03 Thread Razvan Rotaru
gt; Scheme style macros in Clojure:https://github.com/qbg/syntax-rules > > Scott > > On Sat, Dec 3, 2011 at 1:20 PM, Razvan Rotaru wrote: > > > > > > > > > Hi everyone, > > > I was searching the web these days trying to find out more about these

java reflection during macro

2011-12-08 Thread Razvan Rotaru
an I check in a macro that a particular java method exists for a class or not? Thanks, Razvan -- 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 m

Re: java reflection during macro

2011-12-09 Thread Razvan Rotaru
Thanks. I was missing the call to resolve. (let [klass (resolve c)] ) With it it works. Razvan On Dec 8, 11:39 pm, Stuart Sierra wrote: > Not sure if it helps, but here's my example of using reflection in a macro: > > http://stuartsierra.com/2010/12/16/single-abstract-metho

multiple return values

2011-12-12 Thread Razvan Rotaru
I know but I need some way to get around this. Any idea would be greatly appreciated. (What I need is basically a workaround for the lisp-style multiple values: in the default context, my value is evaluated to the java instance, and with some special context I can get the values of other fields as w

Re: multiple return values

2011-12-13 Thread Razvan Rotaru
Thanks Tom. Using proxy like this could work. But i'm worried about one thing.What happens if I have many instances? With proxy there's a new class with each instance. Could I run out of permgen space? On Dec 13, 9:38 am, Tom Faulhaber wrote: > Razvan, > > I think that you

Re: multiple return values

2011-12-13 Thread Razvan Rotaru
I don't want to change the interface i'm exposing to the outer world. May be that I'm thinking too javaish, but what I miss here is a possibility to extend the base class. :) On Dec 12, 9:31 pm, James Reeves wrote: > On 12 December 2011 18:54, Razvan Rotaru wrote: > >

Re: multiple return values

2011-12-13 Thread Razvan Rotaru
Thanks. I don't know how this hashmap works, but at the first glance there seems to be one problem: the two values don't get garbage collected at the same time. I'll look more into it, thanks. On Dec 13, 3:10 am, Stephen Compall wrote: > On Mon, 2011-12-12 at 10:54 -0800, R

letrec

2011-12-14 Thread Razvan Rotaru
Hi, Is there a reliable implementation of letrec in clojure? Anybody using it? I have found a post from 2008, with an implementation which I don't understand (and it's said to be slow), and which I don't know whether to trust.(It's also supposed to be slow). Thanks, Razvan -

Re: letrec

2011-12-14 Thread Razvan Rotaru
I don't quite understand why people are saying this. Anyway, It's not enough for me. On Dec 14, 9:13 pm, Kevin Downey wrote: > lazy-seq and letfn should cover anything you would need letrec for > > > > > > > > > > On Wed, Dec 14, 2011 at 11:09 AM, Razv

Re: letrec

2011-12-14 Thread Razvan Rotaru
letfn defines functions. I'm just defining some values. The values contain anonymous functions which need to refer to other values.I know there are workarounds for this, but this means I must change the interface. Razvan On Dec 14, 9:56 pm, David Nolen wrote: > On Wed, Dec 14, 2011 at

Re: letrec

2011-12-14 Thread Razvan Rotaru
Yes. Assuming I have following macros: (button :id b1 :listener #(...)) => (let [b1 (new JButton)] ...) (panel [:id p1] (button :id b1 ...) (button :id b2 ...)) => (let [p1 (new JPanel) b1 (button :id b1 ...) b2 (button :id b2 ...)] ...) How to make the listener in b1 refer to b2? Razv

Re: multiple return values

2011-12-15 Thread Razvan Rotaru
Thanks. On Dec 14, 8:30 pm, Alan Malloy wrote: > Correct, just like closures and reifies. > > On Dec 14, 7:33 am, Tom Faulhaber wrote: > > > > > > > > > Razvan, > > > I believe that proxy actually only creates a new class per call site, > > not

unquote-splicing when calling macro

2011-12-17 Thread Razvan Rotaru
.] [:body ...]) The result of get-header needs to "spliced" into the rest of the structure for the html macro to work. Thanks, Razvan -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojur

Re: unquote-splicing when calling macro

2011-12-17 Thread Razvan Rotaru
Great. Thanks. On Dec 17, 6:08 pm, Baishampayan Ghose wrote: > > This may sound a bit weird, but can I "unquote-splice" something when > > calling a macro. Here's an attempt to do this with hiccup: > > > (defn get-header > >   [[:link {:type "text/css" ...}] > >    [:script {:type "text/javascrip

Re: unquote-splicing when calling macro

2011-12-17 Thread Razvan Rotaru
kind of sequence, it does the splicing that I want. Razvan On Dec 17, 6:32 pm, Razvan Rotaru wrote: > Great. Thanks. > > On Dec 17, 6:08 pm, Baishampayan Ghose wrote: > > > > > > > > > > This may sound a bit weird, but can I "unquote-splice" so

Re: multiple return values

2011-12-22 Thread Razvan Rotaru
On Dec 14, 5:33 pm, Tom Faulhaber wrote: > Razvan, > > I believe that proxy actually only creates a new class per call site, > not per instance. However, I can't completely swear to this. > > Anyone with more detailed knowledge than I have want to comment? > > Assum

Re: multiple return values

2011-12-24 Thread Razvan Rotaru
On Dec 23, 5:08 am, Alan Malloy wrote: > > It turns out even this is not true, becauseproxyuses some kind of > deep JVM magic called (appropriately)ProxyClasses. So every time you > write (proxy[Object] (...anything at all...)), you get an instance of > the same class, initialized with a differe

proxy with dynamic

2011-12-25 Thread Razvan Rotaru
Hi, Is it possible to give the class as value at runtime to proxy? (defn create-proxy [clazz] (proxy [clazz] )) I know this can be done with a macro, but my question is whether it can be done as function. Thanks, Razvan -- You received this message because you are subscribed to the

weird quote/unquote usage

2011-12-25 Thread Razvan Rotaru
has something to do with macros qualifying symbols with the current namespace. I am yet to fully understand the mechanism here, but my question for the moment is whether this kind of construct is idiomatic in clojure. Or is there another way to introduce symbols in macros? Thanks, Razvan -- You r

Re: proxy with dynamic

2011-12-25 Thread Razvan Rotaru
s value as a function parameter. >From design point of view, my proxy contruct tries to add an interface to a class. (Like a mixin). The interface is always the same (and therefore the methods), but the class can be anything, and i'd like to have it as a parameter to the function. Macros

Re: proxy with dynamic

2011-12-25 Thread Razvan Rotaru
ically (e.g. deftype), so why not create a proxy dynamically? Razvan -- 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 pat

Re: weird quote/unquote usage

2011-12-25 Thread Razvan Rotaru
Thanks. Razvan -- 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. To unsubscribe from

Re: proxy with dynamic

2012-01-28 Thread Razvan Rotaru
Yes, it's more clear now. Thanks. -- 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. To unsubscribe fr

filter out null values

2012-02-02 Thread Razvan Rotaru
Hi, What's the clojure way to filter out null values from a sequence? I have following code: (filter identity (map myfun myseq)) Is there a better/faster way? Thanks, Razvan -- You received this message because you are subscribed to the Google Groups "Clojure" group. To pos

mixins/multiple inheritance

2012-02-05 Thread Razvan Rotaru
tored in the actual widget, even if it's not mixed with Label. I still want to point this out in case there are other ways of achieving this. How can I achieve 1? Are there alternatives for 2? Thanks for reading, Razvan -- You received this message because you are subscribed to the

Re: mixins/multiple inheritance

2012-02-06 Thread Razvan Rotaru
) ;=> Name: [Foo] Oh, and I'd like to stay away from macros, if possible. :) Razvan On Feb 6, 12:20 pm, Matthias Diehn Ingesman wrote: > It sounds a little like the decorator pattern would do the trick for > you in this case - am I missing something? In case I am not, I have

Re: Distributed concurrent applications in Clojure?

2008-11-28 Thread Razvan Ludvig
@dokondr: the blackboard mechanism you mention is just a distributed associative memory, and there is already a Java specification for such a system (search for Jini and Javaspaces), with several open source and commercial implementations available. Unfortunately, anyone who has ever worked with s