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

Re: mixins/multiple inheritance

2012-02-06 Thread Razvan Rotaru
Thanks, This works, but there's a problem: the labeledtextfield is not a textfield anymore, it's a label. Therefore it does not behave like a textfield (which implements other protocols as well). I need multiple inheritance, in one way or another. I've been trying to find a way to implement with

mixins/multiple inheritance

2012-02-05 Thread Razvan Rotaru
Hi, I found some posts about this topic, but they did not clarify things in my head well enough, so I have to start my own... :) I'm basically craving for multiple inheritance or mixins, at least with my current way of thinking. I haven't really gone deep enough with multimethods or protocols,

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 post to this group,

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

weird quote/unquote usage

2011-12-25 Thread Razvan Rotaru
Hi, Consider following code: (defprotocol WithOptions (getOptions [this] All options) (getOption [this option] One option)) (defn- gen-proxy [klass opts] `(proxy [~klass WithOptions] [] (getOptions [~'_] ~opts) (getOption [~'this

Re: proxy with dynamic

2011-12-25 Thread Razvan Rotaru
On Dec 25, 12:01 pm, Alan Malloy a...@malloys.org wrote: Presumably you just tried it and found it doesn't work, so I'm not sure what more you're looking for here. How would you even fill in the body of the proxy? I don't know what class this is, but I know exactly what methods I need to

Re: proxy with dynamic

2011-12-25 Thread Razvan Rotaru
On Dec 25, 1:17 pm, Meikel Brandmeyer m...@kotka.de wrote: Hi, Wiring to classes happens in the bytecode and hence have to be known at compile time. You either have to use eval or refrain from doing things at runtime. Is the class transferred into your program at runtime without knowing

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 this group, send

Re: multiple return values

2011-12-24 Thread Razvan Rotaru
On Dec 23, 5:08 am, Alan Malloy a...@malloys.org 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

Re: multiple return values

2011-12-22 Thread Razvan Rotaru
On Dec 14, 5:33 pm, Tom Faulhaber tomfaulha...@gmail.com 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? Assuming I'm right,,

unquote-splicing when calling macro

2011-12-17 Thread Razvan Rotaru
Hi, 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/javascript ...}]]) (html [:head (get-header) ...] [:body ...]) The result of get-header

Re: unquote-splicing when calling macro

2011-12-17 Thread Razvan Rotaru
Great. Thanks. On Dec 17, 6:08 pm, Baishampayan Ghose b.gh...@gmail.com 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

Re: unquote-splicing when calling macro

2011-12-17 Thread Razvan Rotaru
, it does the splicing that I want. Razvan On Dec 17, 6:32 pm, Razvan Rotaru razvan.rot...@gmail.com wrote: Great. Thanks. On Dec 17, 6:08 pm, Baishampayan Ghose b.gh...@gmail.com wrote: This may sound a bit weird, but can I unquote-splice something when calling a macro. Here's an attempt

Re: multiple return values

2011-12-15 Thread Razvan Rotaru
can't completely swear to this. Anyone with more detailed knowledge than I have want to comment? Assuming I'm right,, you should be fine to have lots of instances. HTH, Tom On Dec 13, 10:47 am, Razvan Rotaru razvan.rot...@gmail.com wrote: Thanks Tom. Using proxy like this could work

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 -- You received this

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 redc...@gmail.com wrote: lazy-seq and letfn should cover anything you would need letrec for On Wed, Dec 14, 2011 at 11:09 AM, Razvan Rotaru razvan.rot...@gmail.com

Re: letrec

2011-12-14 Thread Razvan Rotaru
14, 2011 at 2:53 PM, Razvan Rotaru razvan.rot...@gmail.comwrote: I don't quite understand why people are saying this. Anyway, It's not enough for me. What can't you solve your problem with what was suggested? David -- You received this message because you are subscribed to the Google

Re: letrec

2011-12-14 Thread Razvan Rotaru
14, 11:09 pm, David Nolen dnolen.li...@gmail.com wrote: Do you have a minimal example of what you are trying to do? On Wed, Dec 14, 2011 at 3:53 PM, Razvan Rotaru razvan.rot...@gmail.comwrote: letfn defines functions. I'm just defining some values. The values contain anonymous

Re: multiple return values

2011-12-13 Thread Razvan Rotaru
is an abomination that was written when I was still under the influence of CLOS O-O. Hope that helps, Tom On Dec 12, 5:10 pm, Stephen Compall stephen.comp...@gmail.com wrote: On Mon, 2011-12-12 at 10:54 -0800, Razvan Rotaru wrote: - function returns a value which is a java instance

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 jree...@weavejester.com wrote: On 12 December 2011 18:54, Razvan Rotaru razvan.rot

Re: multiple return values

2011-12-13 Thread Razvan Rotaru
, Razvan Rotaru wrote: - function returns a value which is a java instance (not possible to change here, or at least not from what I see - it needs to be a java instance) - i need to be able to call some function which gets some values that are not part of the java class You should

multiple return values

2011-12-12 Thread Razvan Rotaru
Hi, I read that there's no such thing as lisp-like multiple values return in clojure. We can use vectors, and the destructuring feature helps also. However, for what I'm trying to do I need to emulate somehow the following behavior: - function returns a value which is a java instance (not

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 the.stuart.sie...@gmail.com wrote: Not sure if it helps, but here's my example of using reflection in a macro:

java reflection during macro

2011-12-08 Thread Razvan Rotaru
Hi, I'm trying to write some macros for java object instanciation. Here's the code: (defn- gen-object-method [my-class id option value] (let [method (some (java-methods option) (map #(.getName %) (.getMethods my-class)))] (when (not method) (throw (new

on lisp and scheme macros

2011-12-03 Thread Razvan Rotaru
Hi everyone, I was searching the web these days trying to find out more about these two macro systems and understand their differences, and why one is preferable over the other (or not). I'd like to share with you some ideas, and hopefully get some opinions back as well. Coming from the lisp

Re: on lisp and scheme macros

2011-12-03 Thread Razvan Rotaru
: Scheme style macros in Clojure:https://github.com/qbg/syntax-rules Scott On Sat, Dec 3, 2011 at 1:20 PM, Razvan Rotaru razvan.rot...@gmail.comwrote: Hi everyone, I was searching the web these days trying to find out more about these two macro systems and understand their differences

keyword arguments

2011-11-27 Thread Razvan Rotaru
Hi, This may be a question without hope, but I'm thinking that asking never hurts. So here goes: The closest thing to keyword arguments that I have found is destructuring with a map: (defn myfun [ {:keys [arg1 arg2 arg3] :or {arg1 default-value} :as args}] ...) When I

Re: appengine-magic + servlets

2011-11-07 Thread Razvan Rotaru
Yes, I tried that but did not work. appengine-magic/serve expects an appengine-application, which is a map that among others contains the ring handler. The serve function turns this handler into a servlet and maps it to the root path / (or /*, I haven't figured that out yet). Whatever i write in

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, Razvan --

Re: problems of a newbie

2011-11-06 Thread Razvan Rotaru
I remember having the same frustrations some time ago. Not that they are gone now. :) It obviously depends on the tool, and these code analysis you describe you get only in IDEs. I don't know what tool you are using now, but you have them all described in the Getting Started page (http://

Re: appengine-magic + servlets

2011-11-06 Thread Razvan Rotaru
that you want to handle some url pattern, and you want to integrate that into your appengine-magic app? On Sun, Nov 6, 2011 at 5:08 AM, Razvan Rotaru razvan.rot...@gmail.com wrote: Hi, appengine-magic (https://github.com/gcv/appengine-magic) uses ring- handlers to turn into servlets

Re: appengine-magic + servlets

2011-11-06 Thread Razvan Rotaru
integrated it with appengine-magic?  - Mark On Sun, Nov 6, 2011 at 11:41 AM, Razvan Rotaru razvan.rot...@gmail.com wrote: I want integration of servlet in appengine-magic. Documentation describes that you use a ring handler to call def- appengine-app: (appengine-magic.core/def

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 a...@malloys.org 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)

Re: Can't eval locals problem

2011-10-19 Thread Razvan Rotaru
Thanks for your suggestion. I finally decided to find a way around the problem. :) This is cutting too deep for me to handle with my current clojure knowledge. I also talked to Constantine Vetoshev (the author of appengine-magic) and he anknowledged it as an issue which could have a solution by

shortcut for anonymous function literal and syntax quote

2011-10-19 Thread Razvan Rotaru
Hi, I'm just wondering is there a nicer way to write this: (defmacro my-macro [ body] (map (fn[x] `(my-fun ~x)) body)) I'd like to use the anonymous function literall #(), but this won't work: (defmacro my-macro [ body] (map #(`(my-fun ~%)) body)) So if you have some suggestion, I'd

how to use record as a value

2011-10-06 Thread Razvan Rotaru
Hi, I want to instantiate a record, but having the record type as value at runtime. Example: (defrecord car [year manufacturere]) (defrecord bike [year manufacturere]) (defrecord boat [year manufacturer]) I want to do (new stuff 1982 Mercedes), but having the record type kept in the variable

Re: how to use record as a value

2011-10-06 Thread Razvan Rotaru
-- Clojure/corehttp://clojure.com On 10/06/2011 01:27 PM, Razvan Rotaru wrote: Hi, I want to instantiate a record, but having the record type as value at runtime. Example: (defrecord car [year manufacturere]) (defrecord bike [year manufacturere]) (defrecord boat [year

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) (stuff

Can't eval locals problem

2011-10-03 Thread Razvan Rotaru
Ok, so I'm stuck. If any of you more seasoned clojurians have a hint that could get me out, I will be forever gratefull to him/her: I'm trying execute a query against google app engine datastore, using appengine-magic, with the filter dynamically generated from a map. Here's the closest code I

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 with your

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@googlegroups.com

Cyclic load dependency

2011-07-16 Thread Razvan Rotaru
Hi, I'm trying to use r0man / appengine-clj, and when :use-ing the datastore namespace I get a cyclic load dependency. Doesn't clojure allow such cyclic references? (use 'appengine.datastore) Cyclic load dependency: [ /appengine/datastore/entities ]-/appengine/ datastore/query-[

Re: bug in partition?

2011-06-14 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@googlegroups.com Note that posts

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 Clojure group.

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, send email to

bug in partition?

2011-06-13 Thread Razvan Rotaru
Hi, Not sure if this is a novice thing or a real bug. Here's what I encountered: I'm calling a Java method which returns a String[], which I then pass to partition to get a list of lists (I know, sequence, but list is a shorter word). What happens then, is I loop over my list of lists with (loop