Hi,
Maybe I'm missing something but doesn't + fit the bill (or any
symmetric function)?
(== (reduce + 3 [1 2 3]) (reduce + 3 [3 2 1])) ;; => true
In this case f = g = + and a0 = b0 for any choice of a0 and v.
Regards,
Mark.
On Jun 4, 3:23 pm, CuppoJava wrote:
> Hey guys,
> I'm really stuck
I've always considered the core part of the language to be the portion
that cannot be written in the language itself.
I don't think you can write an Clojure if form in Clojure.
When we talk about implementing Clojure entirely in Clojure, we don't
actually mean implementing the language in itself
Hey guys,
I'm really stuck on this math question, and I'm wondering if you guys
know of any links that may help me.
Given: f(x,y), a0, a list of numbers v.
Find: g(x,y) and b0 such that:
(reduce f a0 v) = (reduce g b0 (reverse v))
Thanks for your help
-Patrick
--~--~-~--~~-
Tonight Rich made a comment (related to distributed computing) about
not wanting to include things in the language that should belong in
libraries.
This led me to wonder (only after leaving the meeting), where does
that boundary live? Is clojure.core "language" or "library"? Is it
the java impl
We did the reverse (using Spring directly from Clojure) without any
difficulty.
Never thought about creating Clojure beans however.
We had already some code to bootstrap Spring from Java.
Just called it from Clojure.
We wanted to drop Java as much as possible but did not want to loose
some of the
Thank you for such a detail email on the algorithm. I'll certainly keep
that in mind.
This is so far been the most impressive thing I've found about clojure.
the community is very friendly and helpful. You've made a newbie
feel much more comfortable.
On Wed, Jun 3, 2009 at 12:33 PM, Daniel Lyons
On Jun 2, 2009, at 9:38 AM, Meikel Brandmeyer wrote:
Did you further think about your previous suggestion
to provide the functionality of "calling" a qualified
function from the command line of clojure.main?
I'd like to see a (:main...) clause supported by ns to name the "main"
entry point
This link might help. Came across this weblog titled "Practical
Clojure with SWT, JUnit and Spring":
http://berlinbrowndev.blogspot.com/2009/04/practical-clojure-with-swt-junit-and.html
-Al
On Wed, Jun 3, 2009 at 6:02 PM, Dmitriy Kopylenko
wrote:
>
> Hello.
>
> I'm just wondering is there a wa
Thanks Laurent. So it is indeed possible. I need to dive into Clojure
to understand it better (I only started looking into Clojure few days
ago). Are there any Maven plugins or Ant tasks for doing AOT
compilation?
Perhaps a small example of this set up (with Spring bean) would be
terrific
>> 2) put the unit tests in a separate file, in the same namespace
This works for me, but since it won't work with the normal use/require
idiom, I would like to see a standard convention evolve to make it
easy to read other people's code.
Stu
--~--~-~--~~~---~--~
Thanks Steve.
That's very useful for me.
Personally I'm not too bothered by the clojure.lang.Seqable confusion.
I've never had to deal directly with the Java interfaces for Clojure,
and this is probably true for a lot of other users as well.
The only use-case where I can see users being confused
Hi,
Provided that the beans you would like to see implemented via clojure
must conform to a preexisting interface, I guess there would be no
need at all to leverage to dynamic-language part of spring.
Here is a recipe (out of my head, not tested) for how this would work:
1. identify the interf
On Jun 3, 2009, at 12:53 PM, CuppoJava wrote:
Is there a function that will return true iff calling seq on it's
argument will not throw an error? I thought it was seq?, but (seq? [1
2 3]) returns false.
Such a function might be called "seqable?". As far as I know it
doesn't exist currently.
BDFL says:
http://groups.google.com/group/clojure/browse_frm/thread/3826ba3a52ec8cf7/ea899cfd965744a8?lnk=gst&q=hickey+seqable#ea899cfd965744a8
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post
Hi,
Am 03.06.2009 um 18:53 schrieb CuppoJava:
Is there a function that will return true iff calling seq on it's
argument will not throw an error? I thought it was seq?, but (seq? [1
2 3]) returns false.
(or (coll? x) (seq? x)) should give a reasonable approximation.
Sincerely
Meikel
smime
It seems the consensus is that this function doesn't yet exist.
I'll use the instance? Seqable workaround for now.
Thanks for the help guys.
-Patrick
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
T
Hello.
I'm just wondering is there a way to create Clojure beans and inject
them into other Spring beans (given that Clojure code implements Java
interface) inside Spring ApplicationContext, similar to other dynamic
langs support:
http://static.springframework.org/spring/docs/2.5.x/reference/dyn
oops, sorry, that's not what u meant
On 3 Jun 2009, at 17:56, craig mcmillan wrote:
> user=> (seq? (seq [1]))
> true
>
> On 3 Jun 2009, at 17:53, CuppoJava wrote:
>
>>
>> Hi,
>> Is there a function that will return true iff calling seq on it's
>> argument will not throw an error? I thought it wa
user=> (seq? (seq [1]))
true
On 3 Jun 2009, at 17:53, CuppoJava wrote:
>
> Hi,
> Is there a function that will return true iff calling seq on it's
> argument will not throw an error? I thought it was seq?, but (seq? [1
> 2 3]) returns false.
>
> -Patrick
> >
--~--~-~--~~--
Hello Clojure gang.
I am just wondering is there a way to 'magically' create Spring bean
(eligible for injection) from Clojure scripts source, provided that
Clojure code implements the existing Java interface? The approach
similar to Spring dynamic language support:
http://static.springframework.
Sure. Here's two plausible examples. I apologize for not providing any
unit tests. I'm not quite sure what they are. I've never written one
before.
;---EXAMPLE 1-
(defblockfn surround_with_text [text block]
(println text)
(block)
(println text))
(surround_with_text "surroun
Could you throw together some live examples and unit tests?
On Jun 3, 1:10 pm, CuppoJava wrote:
> In case anybody else found defblockfn useful, here's the final
> version. The original didn't work when you used destructuring in the
> argument list of the function.
>
> (defn remove_destructuring
In case anybody else found defblockfn useful, here's the final
version. The original didn't work when you used destructuring in the
argument list of the function.
(defn remove_destructuring [params]
(map (fn [arg]
(if (or (vector? arg) (map? arg))
(gensym)
arg))
I don't know either, but you can use the following work around
(defn my-seq[object]
(instance? clojure.lang.Seqable object))
(my-seq []) =>true
(my-seq {}) =>true
(my-seq #{}) =>true
(my-seq '()) =>true
(my-seq :a) => false
(my-seq 'a-symbol) => false
Still, it would be nice to know the righ
On Wed, Jun 3, 2009 at 12:53 PM, CuppoJava wrote:
>
> Is there a function that will return true iff calling seq on it's
> argument will not throw an error? I thought it was seq?, but (seq? [1
> 2 3]) returns false.
I was looking for this the other day as well and didn't see it. However,
this mig
Hi,
Is there a function that will return true iff calling seq on it's
argument will not throw an error? I thought it was seq?, but (seq? [1
2 3]) returns false.
-Patrick
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Grou
On Jun 2, 2009, at 11:22 PM, Wilson MacGyver wrote:
>
> More newbie questions. :)
>
> If I have two sequences as follow:
>
> (2 3 4 5 6 7 8 9 10)
> (4 6 8 10)
>
> what's the best way to subtract the 2nd sequence from the first one?
>
> The best I can come up with was to do (first) on 2nd sequenc
2009/6/3 Adrian Cuthbertson :
>
>> ... You know you've been writing too much Clojure when...
>
> You see a cartoon swearword @^#!>! and you think it's clojure meta-data!
LOL ! :-)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Go
I attached a better patch: no eval and a more standard "inline".
Christophe Grand a écrit :
> I'm sure there's something wrong with my patch (the "eval" smell) and
> the fact that I'm assoc-ing a closure in the metadat map.
> I'll rework it if you agree with the idea of this patch
>
> Christophe
Having fun watching scoopler these days, and seeing people twitter and
whatnot about clojure at javaone.
http://www.scoopler.com/search/#clojure
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post
> ... You know you've been writing too much Clojure when...
You see a cartoon swearword @^#!>! and you think it's clojure meta-data!
-Adrian.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post
I realize this is late notice (didn't think of it till now), there is
a Clojure talk tonight at the Philadelphia Java Users Group - to
attend you'll need to RSVP (see: http://phillyjug.jsync.com/ to sign
up).
The announcement is below.
Regards,
Kyle
Agenda:
6:30 – 7:00 Grab a good seat, some
Stuart Sierra a écrit :
> Stu's suggestion of with-ns would also work. But you don't even need
> with-ns. You can refer a private function into the local namespace
> like this:
>
> (def private-function (ns-resolve 'other-namespace 'private-function))
>
And don't forget the good old @#'other
This is the talk that was supposed to happen on May 12. And we're
going to shoot video -- email me if you can volunteer to bring a
camera.
-Stuart
-- Forwarded message --
Join us Tuesday, may 12th from 7:00-9:00 for Stuart Sierra's presentation:
Implementing AltLaw.org in Cl
Hi Allen, Stu,
I guess my first inclination would be one of:
> 1) put the unit tests in the same file
using the with-test macro, or
> 2) put the unit tests in a separate file, in the same namespace
Stu's suggestion of with-ns would also work. But you don't even need
with-ns. You can refer a pr
Well, of course this is a classic situation in OO, if you think about it.
Googling around may shed some interesting light on the subject. Essentially,
the question is: are you sure that's what you want to do? Why not
concentrate your unit tests on the public interface in such a way that the
private
Hi everyone,
I agree with Stuart, this would be very helpfull.
Thank you,
Stephan
On Jun 3, 12:36 am, Stuart Halloway wrote:
> Hi Allen,
>
> You could write a function that uses the clojure.contrib.with-ns/with-
> ns macro to dip into the namespace being tested and return the private
> func
Question: You know you've been writing too much Clojure when...
(dorun Question)
-m
--~--~-~--~~~---~--~~
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
Not
I'm sure there's something wrong with my patch (the "eval" smell) and
the fact that I'm assoc-ing a closure in the metadat map.
I'll rework it if you agree with the idea of this patch
Christophe Grand a écrit :
> Rich Hickey a écrit :
>
>> On May 13, 9:57 am, Christophe Grand wrote:
>>
>>
Rich Hickey a écrit :
>
> On May 13, 9:57 am, Christophe Grand wrote:
>
>> Mark Reid a écrit :
>>
>>
>>> In particular, it seems converting `(+ 1 2 3)` to `(+ 1 (+
>>> 2 3))` can speed things up.
>>>
>> Rich, would you accept a patch to make all arities inlinable for basic
>> math o
ah, that works too! thanks!
On Wed, Jun 3, 2009 at 3:48 AM, Laurent PETIT wrote:
>
> If what you really want to do is treat those sequences as sets, then
> you can use clojure.seq/difference:
>
> 1:1 user=> (def seq1 (list 2 3 4 5 6 7 8 9 10))
> #'user/seq1
> 1:2 user=> (def seq2 (list 4 6 8 10)
If what you really want to do is treat those sequences as sets, then
you can use clojure.seq/difference:
1:1 user=> (def seq1 (list 2 3 4 5 6 7 8 9 10))
#'user/seq1
1:2 user=> (def seq2 (list 4 6 8 10))
#'user/seq2
1:3 user=> (require 'clojure.set)
nil
1:4 user=> (clojure.set/difference (set seq1
Christophe's solution seems to work.
basically I just wanted to remove
(4 6 8 10) from
(2 3 4 5 6 7 8 9 10)
so I end up with
(2 3 5 7 9)
On Wed, Jun 3, 2009 at 3:27 AM, kyle smith wrote:
>
> How about (map - seq1 seq2) ?
>
> An example or two of the desired output would be helpful.
> >
>
-
How about (map - seq1 seq2) ?
An example or two of the desired output would be helpful.
--~--~-~--~~~---~--~~
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
No
44 matches
Mail list logo