Works fine for me, with your code pasted exactly as written. You'll
probably get better help if you give a real stack trace, though.
Also, you might take a look at clojure.string/join: it does just what
your strcat function does, as well as most of what reverseWords does.
On Feb 3, 9:00 pm, Rober
(defrecord Person [name])
(defmulti read-tag (fn [name & args] (keyword "myns" name)))
(defmethod read-tag :myns/person
[tag name]
(Person. name))
(read-tag "person" "david")
=> #:myns.Person{:name "david"}
But I agree with everyone else, there's no need to use records unless
you're addicted
I was recently using gen-class and ran into this problem:
(def strcat (partial apply str))
(defn rev-reverse [s] (strcat (reverse s)))
(defn rev-reverseWords [s]
(strcat (interpose " " (reverse (.split s " ")
(defn rev-isWordPalindrome [s]
(if (nil? s) true
(= s (rev-reverseWords
It would be better if your macro would accept maps and vectors,
because those can be prepared somewhere else and passed around as
parameters. Your current macro allows only hardcoding.
On Feb 3, 4:23 pm, Alexander Yakushev wrote:
> >(deflayout frame
> >{:west gamepanel
> >:east (deflayout side
On Thu, Feb 3, 2011 at 10:11 PM, Aaron Cohen wrote:
> On Thu, Feb 3, 2011 at 10:04 PM, Quzanti wrote:
>>
>>
>>> I see no reason for the ctor to be defined as a string as you've done with
>>> "Person.".
>>
>> The reason is that I am reading in XML and mapping a tag name to the
>> record class.
>
>
On Thu, Feb 3, 2011 at 10:04 PM, Quzanti wrote:
>
>
>> I see no reason for the ctor to be defined as a string as you've done with
>> "Person.".
>
> The reason is that I am reading in XML and mapping a tag name to the
> record class.
It's possible to do this using reflection, but I don't recommend
On Feb 4, 3:04 am, Kevin Downey wrote:
> then define a factory function when you define the record, and use
> that, you can easily apply a function to arbitrary arguments without
> using eval
>
Thanks. There may be something in that. Would there be an easy way of
dynamically determining which f
then define a factory function when you define the record, and use
that, you can easily apply a function to arbitrary arguments without
using eval
On Thu, Feb 3, 2011 at 7:00 PM, Quzanti wrote:
>
>
> On Feb 4, 2:55 am, Kevin Downey wrote:
>> I strongly recommend against writing or designing anyt
> I see no reason for the ctor to be defined as a string as you've done with
> "Person.".
The reason is that I am reading in XML and mapping a tag name to the
record class.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send
On Feb 4, 2:55 am, Kevin Downey wrote:
> I strongly recommend against writing or designing anything that
> requires dynamically generating defrecords. if you want to dynamically
> generate classes I suggest getting familiar with the asm library and
> reading up on classloaders.
>
Its just the i
I strongly recommend against writing or designing anything that
requires dynamically generating defrecords. if you want to dynamically
generate classes I suggest getting familiar with the asm library and
reading up on classloaders.
On Thu, Feb 3, 2011 at 6:49 PM, Quzanti wrote:
> Thanks - that mi
On Feb 4, 2:47 am, Kevin Downey wrote:
> if you really want to keep things simple you should just say
> '(Person. "..." 18)
> without all the concat noise the solution becomes obvious. you have a
> form (new Person X Y), you want to execute the code with different
> values bound to X and Y at ru
Thanks - that might well be part of the solution
Person. is dynamically determined (i.e the result of a fn too)
So I guess I am asking is there a way to dynamically resolve a
classname?
I found this
http://dev.clojure.org/jira/browse/CLJ-370?page=com.atlassian.jira.plugin.system.issuetabpanels%
if you really want to keep things simple you should just say
'(Person. "..." 18)
without all the concat noise the solution becomes obvious. you have a
form (new Person X Y), you want to execute the code with different
values bound to X and Y at runtime, sounds like a function to me.
On Thu, Feb 3,
On Feb 4, 2:23 am, Kevin Downey wrote:
> whole crazy concat thing
> which has nothing to do with anything
I probably should have clarified that the reason I need concat is that
various functions are returning subsets of the arguments as vectors,
but as stated to keep things sim
On Thu, Feb 3, 2011 at 9:36 PM, Quzanti wrote:
> I probably should have clarified that the reason I need concat is that
> various functions are returning subsets of the arguments as vectors,
> but as stated to keep things simple in the example I just used values
I still recommend using maps. Bu
On Thu, Feb 3, 2011 at 9:36 PM, Quzanti wrote:
>
>
> On Feb 4, 2:23 am, Kevin Downey wrote:
>
>> whole crazy concat thing
>> which has nothing to do with anything
>
> I probably should have clarified that the reason I need concat is that
> various functions are returning subsets o
On Thu, Feb 3, 2011 at 8:53 PM, Quzanti wrote:
> Hello. I need to dynamically define records
>
For dynamic code like this it I would recommend using plain old maps.
David
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send
18:16 hiredman
http://groups.google.com/group/clojure/browse_thread/thread/83ad2eed5a68f108?hl=en
18:17 hiredman it amazes me how convoluted people can make things
18:17 brehaut hiredman: at least he recognises it
18:17 dnolen mattmitchell: word of advice, just do the simplest
thing. OO brainwa
Hello. I need to dynamically define records
Suppose I have a record
(defrecord Person [name age])
Then to dynamically construct an instance I do a much more complex
version of
(concat [(symbol "Person.")] ["Peter"] [18])
Where things like Peter and the class of the record are actually the
resu
On 3 February 2011 23:52, Stuart Sierra wrote:
> The new Amazon Elastic Beanstalk hosts web apps packaged as WAR files. I
> haven't heard of anyone using it with Clojure, but I know Clojure works in
> WAR containers, so it shouldn't be a problem.
> http://aws.amazon.com/elasticbeanstalk/
I've bee
On Thu, Feb 3, 2011 at 7:03 PM, Stuart Sierra
wrote:
> Each Clojure function becomes a Java class with the same name. Closures are
> named something like `enclosing_function$fn_1234`. You must be hitting some
> operating system limit on file name length.
> The only work around I can think of is
On Thu, Feb 3, 2011 at 7:14 PM, Base wrote:
>
> Thank you Laurent and Ken. Both great responses.
>
> What I was forgetting was that vector is a function of the index.
>
> This now makes total sense and I feel like a dummy for not getting
> it. Thanks for your responses.
You're welcome.
--
Yo
Of course I meant "why it would NOT work in any..." :)
Luc P.
On Thu, 3 Feb 2011 19:23:58 -0500
Luc Prefontaine wrote:
> We deployed a Compojure app on the hospital intranet as a war file
> in Geronimo a couple of months ago.
> We ditched Glassfish for a number of reasons but
> I don't see why
We deployed a Compojure app on the hospital intranet as a war file
in Geronimo a couple of months ago.
We ditched Glassfish for a number of reasons but
I don't see why it would work in any application server
that support War files.
Just make sure your war file is properly packaged. Initially
we tr
>(deflayout frame
>{:west gamepanel
>:east (deflayout sidepanel
>[nextpanel (JButton. "Exit")] :flow :trailing))
Actually I thought about something like that, but then I decided to come
up with something at least a bit uniform.
--
You received this message because you are subscribed to the Goo
Thank you Laurent and Ken. Both great responses.
What I was forgetting was that vector is a function of the index.
This now makes total sense and I feel like a dummy for not getting
it. Thanks for your responses.
On Feb 3, 3:44 pm, Laurent PETIT wrote:
> 2011/2/3 Base :
>
>
>
>
>
> > Thats t
That's a good one, on par with the one line low-pass filter:
;; filter noise
;;(http://clojure-log.n01se.net/date/2009-10-13.html by ambient
;;this is such a cool transform!!!
(defn lo-pass
[d coll]
(reductions #(+ (* %2 d) (* %1 (- 1.0 d))) coll))
sincerely,
--Robert McIntyre
On Thu, Feb
First and foremost, hosted repls are a pain in the ass given that you
have to sandbox them. I like your idea though. I think it is something
that would make a very nice addition to tryclojure itself (specialized
repls and a real text editors). If you give it more thought, shoot me
an email or somet
Each Clojure function becomes a Java class with the same name. Closures are
named something like `enclosing_function$fn_1234`. You must be hitting some
operating system limit on file name length.
The only work around I can think of is to replace some of your closures with
top-level defn's. O
I don't know what "select * from StockTick(symbol=..." is doing, but it
looks like the error is coming from the library handling that query, not
Clojure.
-Stuart Sierra
clojure.com
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this gro
The new Amazon Elastic Beanstalk hosts web apps packaged as WAR files. I
haven't heard of anyone using it with Clojure, but I know Clojure works in
WAR containers, so it shouldn't be a problem.
http://aws.amazon.com/elasticbeanstalk/
Chas Emerick's nREPL (network REPL) library may be useful.
htt
On Thu, Feb 3, 2011 at 5:22 PM, Alan wrote:
> You don't need an extra element in the vector to distinguish between
> empty and full. You can store (start, size) instead of (start, end).
I considered that, but it made the arithmetic much messier in various
places. Count gets simpler, obviously, bu
You don't need an extra element in the vector to distinguish between
empty and full. You can store (start, size) instead of (start, end).
On Feb 3, 12:57 pm, Ken Wesson wrote:
> On Thu, Feb 3, 2011 at 2:03 PM, Alan wrote:
> > Or use a fixed-size vector as a ring, with start and end "pointers",
>
Hey everyone. WabbitMQ is a simple Clojure wrapper for RabbitMQ's Java
client v2.2.0. This is my first release and as such I'm sure there are
plenty of mistakes and/or non-clojure-isms. Feedback welcome! :)
https://github.com/mefesto/wabbitmq
Allen
--
You received this message because you are s
On Thu, Feb 3, 2011 at 4:33 PM, Base wrote:
> Thats the one!
>
> Now I just have to understand it...
>
> The first apply is throwing me a little.
Start with
(map foo [1 2 3] [4 5 6] [7 8 9])
That calls foo with the first elements of the collections (so, 1 4 7),
then again with the second (2 5 8
2011/2/3 Base :
> Thats the one!
>
> Now I just have to understand it...
>
> The first apply is throwing me a little.
>
>
> On Feb 3, 3:29 pm, Laurent PETIT wrote:
>> Hello,
>>
>> 2011/2/3 Base :
>>
>> > Hi All -
>>
>> > I recall seeing a beautiful method for doing the following on this
>> > site,
Thats the one!
Now I just have to understand it...
The first apply is throwing me a little.
On Feb 3, 3:29 pm, Laurent PETIT wrote:
> Hello,
>
> 2011/2/3 Base :
>
> > Hi All -
>
> > I recall seeing a beautiful method for doing the following on this
> > site, but cannot seem to find it
> >
Hello,
2011/2/3 Base :
> Hi All -
>
> I recall seeing a beautiful method for doing the following on this
> site, but cannot seem to find it
> I would like to transform
>
> (def a [[1 2 3]
> [4 5 6]
> [7 8 9]])
>
> to
>
> [[1 4 7]
> [2 5 8]
> [3 6 9]]
user=> (vec (apply map vecto
Hello,
I am working on a DSL for a non-technical crowd hosted in Clojure. The
first major hurdle for my users to tackle would be installing Clojure,
a text-editor, and learning the workflow. I'd like to make this as
easy as possible, so I'm considering a web app solution instead of a
desktop app.
Hi All -
I recall seeing a beautiful method for doing the following on this
site, but cannot seem to find it
I would like to transform
(def a [[1 2 3]
[4 5 6]
[7 8 9]])
to
[[1 4 7]
[2 5 8]
[3 6 9]]
Thanks
--
You received this message because you are subscribed to the Goog
On Thu, Feb 3, 2011 at 2:03 PM, Alan wrote:
> Or use a fixed-size vector as a ring, with start and end "pointers",
> and a couple functions to abstract over the handling thereof. But
> unless you really really care about performance, this is likely to be
> overkill, and Ken's suggestion to just us
Thanks for the tip on how to express a java bean -- that appears to
only be part of the problem; I still have the error I posted above.
But I'm going to keep flailing at it.
On Feb 2, 10:11 am, Ken Wesson wrote:
> On Wed, Feb 2, 2011 at 11:15 AM, clwham...@gmail.com
>
> wrote:
> > I am doing som
Or use a fixed-size vector as a ring, with start and end "pointers",
and a couple functions to abstract over the handling thereof. But
unless you really really care about performance, this is likely to be
overkill, and Ken's suggestion to just use a vector or a seq and
accept the O(n) behavior.
On
On Thu, Feb 3, 2011 at 3:11 AM, Petr Gladkikh wrote:
> On Thu, Feb 3, 2011 at 1:31 PM, Meikel Brandmeyer wrote:
>> Hi,
>>
>> On 3 Feb., 08:04, Petr Gladkikh wrote:
>>
>>> Should not it be empty colection instead?
>>> It seems odd to me since it is inconsistent and forces to consider one
>>> more
If you only intend to support border and flow layouts, you could
reduce the verbosity by maps implying border layout and vectors
implying flow layouts. That approach would limit you to simpler
layouts, but your example would become something like this:
(deflayout frame
{:west gamepanel
:east
On Feb 3, 12:07 am, dmiller wrote:
> Completely arbitrarily, ClojureCLR names the AOT-compilation generated
> files whatever.clj.dll. The .clj. is superfluous, but does serve as
> a visual indication of the assembly's origin. Question: Useful, or
> just annoying?
The extra .clj in the .dll f
Hi,
On 3 Feb., 14:10, faenvie wrote:
> i would love to see the knowledge that
> karsten lentzsch put intohttp://www.jgoodies.com/
> transmitted to or adapted for the clojure-cosmos.
I started something in this direction a while ago.
http://bitbucket.org/kotarak/jazz
However, it's a bit outdate
i would love to see the knowledge that
karsten lentzsch put into http://www.jgoodies.com/
transmitted to or adapted for the clojure-cosmos.
--
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
N
Thanks for getting back to me on this one guys - now I know that this
change is intentional I will make the necessary future-looking code
changes to my project.
much obliged,
Jules
On Feb 2, 4:13 am, Chas Emerick wrote:
> The numeric coercion functions only impact interop starting in 1.3.0. I
On Feb 3, 1:04 am, Petr Gladkikh wrote:
>
> And another question. I have written this function
> (defn index-by
> "Make map (f x) -> x"
> [f coll]
> (reduce #(assoc %1 (f %2) %2) {} coll))
>
> I wonder, is there already such function somewhere in Clojure libraries?
Somewhat shorter:
(defn
Hi,
On 3 Feb., 09:11, Petr Gladkikh wrote:
> I have a vector that holds some history. I conj new items to it and to
> save space I'd like to retain not more than n last items.
> To do that I used (take-last n history). So: [] -> (take-last n []) ->
> nil -> (conj nil newItem) -> '(newItem)
>
> B
On Thu, Feb 3, 2011 at 1:31 PM, Meikel Brandmeyer wrote:
> Hi,
>
> On 3 Feb., 08:04, Petr Gladkikh wrote:
>
>> Should not it be empty colection instead?
>> It seems odd to me since it is inconsistent and forces to consider one
>> more case (nil or collection).
>
> It is consistent. There is a dif
53 matches
Mail list logo