Hi Nathan,
There is actually a simple answer to your question. map can take a
fuction of multiple parameters along with multiple collections. i.e.
(defn f [x y] (+ x y))
(map f [1 2] [3 4])
=> (4 6)
(Warning I did this computation in the Clojure instance in my head, so
some details may be sligh
I would certainly be interested. Lau are you out there ?
/mac
On Mar 30, 9:35 pm, Krukow wrote:
> On Mar 30, 3:40 pm, Christian Vest Hansen
> wrote:
>
> > Great. Now we are at least 3 danes who know Clojure - I have a feeling
> > that there is at least one other guy out there :)
>
> We have to
First of all, I would like to thank Rich and this community for
producing such a pleasurable language, and for putting up with with
all the unpleasant nit-picking of new users. That being said...
I am curious as to why the function parameter is specified before the
collection parameter in map/red
If I remember correctly (I wasn't able to find the thread where this same
subject was explained), one must make a difference between functions
intended to work on data structures, and functions intended to work on
sequences.
Data structures are not volatile as sequences are, and those functions th
Hi Nathan,
On 31 Mrz., 09:40, Nathan Sorenson wrote:
> First of all, I would like to thank Rich and this community for
> producing such a pleasurable language, and for putting up with with
> all the unpleasant nit-picking of new users. That being said...
>
> I am curious as to why the function p
> Would this not allow mixing map into a threaded expression:
You might also be interested in this thread:
http://groups.google.com/group/clojure/browse_thread/thread/66ff0b89229be894
Where various people created a let-> (or pipe) macro for such a
purpose.
--~--~-~--~~~
Hi all!
Here's a set of macros I have found useful for creating simulated
thread-local bindings for specific agents:
(defmacro bind-agent
"Adds bindings to an agent's metadata"
[#^clojure.lang.Agent a bindings]
(list 'let (vector 'ba# a)
(list 'do (list 'alter-meta!
On Mar 29, 8:08 am, Meikel Brandmeyer wrote:
> Hi,
>
> Am 27.03.2009 um 09:25 schrieb Mark Engelberg:
>
>
>
> > I may come along and want to extend test-prefer to a type ::d which
> > derives from ::c and ::e, where ::e provides an alternative
> > implementation.
>
> > ab
For those interested, I managed to improve the performance of my
original program from 2 minutes 40 seconds to decode 1000+ files down
to 2 minutes. I'm still far from my goal, but it's an improvement,
especially since the code is shorter and (IMO) cleaner. You can see
it here:
http://bitbucket
On Mar 31, 1:00 pm, martin_clausen wrote:
> I would certainly be interested. Lau are you out there ?
So far one user in Cph, one in Aarhus. Where are you from? And how
about Lau?
If you are able to attend the JAOO 2009 conference in Aarhus, I'll
arrange a dcug meeting. I believe that Rich is
Did you try using aset-int instead of aset?
On Tue, Mar 31, 2009 at 8:25 AM, Vincent Foley wrote:
>
> For those interested, I managed to improve the performance of my
> original program from 2 minutes 40 seconds to decode 1000+ files down
> to 2 minutes. I'm still far from my goal, but it's an
No, but in my defense I did not know such a function existed :) I'll
give it a whirl and report back!
On Mar 31, 9:57 am, David Nolen wrote:
> Did you try using aset-int instead of aset?
>
> On Tue, Mar 31, 2009 at 8:25 AM, Vincent Foley wrote:
>
> > For those interested, I managed to improve
On Mar 30, 12:10 pm, Santanu wrote:
> Could you please suggest any Java book (and the relevant chapters)
> that will teach me _just_enough_ Java so that I can understand how to use
> the Java library documentation effectively.
I always recommend the Sun Java Tutorials:
http://java.sun.com/docs/b
Here are some problems/limitations of existing OO/GF systems that I
don't intend to repeat:
A) They provide only a single declaration point for all superclasses
of a class
B) They consider the local declaration order of superclasses to be
significant
C) They conflate hierarchies and graphs contai
Did you try to coerce the result of (~mask-fn ...) with int?
(or use aset-int as suggested by David)
On Tue, Mar 31, 2009 at 4:17 PM, Vincent Foley wrote:
>
> No, but in my defense I did not know such a function existed :) I'll
> give it a whirl and report back!
>
> On Mar 31, 9:57 am, David N
On Mar 31, 9:32 am, Rich Hickey wrote:
> Can we please move forward in trying to implement something better
> than CLOS GFs?
Maybe. Let me know when you think of something better, and I'll do the
same. When we agree, I'll toss my GF implementation out the door. In
the meantime, it's made my
We shipped production software built in Scala last year, but likely
will never do so again given clojure. Our primary motivating factor
is the degree of complexity in the Scala, but since you're looking for
"auxiliary" factors:
- clojure has a far richer "ecosystem" -- there's a metric ton
gen-class does not yet support parameterized types. Rich is aware of
the issue, though, and I suspect he'll wend his way around to it
sooner rather than later. Depending on timing, I might try my hand at
a patch that implements this.
- Chas
On Mar 30, 2009, at 2:27 PM, Greg Harman wrote:
I tried using aset-int and I tried using int to coerce the result of
mask-fn, the input argument to mask-fn and few other things, but none
of that seems to make a difference so far. Mind you, this is an
aspect of Clojure that I find a little confusing, so I'm just putting
int calls here and there
On Tue, Mar 31, 2009 at 5:20 PM, Chas Emerick wrote:
>
> We shipped production software built in Scala last year, but likely
> will never do so again given clojure. Our primary motivating factor
> is the degree of complexity in the Scala, but since you're looking for
> "auxiliary" factors:
>
> -
Hi,
2009/3/31 Rich Hickey
> Here's how I think about it:
>
> - Hierarchies have nothing to do with multimethods/GFs per se.
True,
So, along the lines of my previous post, could it be made possible to let
the user provide its own multimethods "candidate dispatch-values filtering"
and "candidat
Many thanks for the long and reasoned reply (and to mikel as well for adding
his thoughts). I apologize for my slowness in understanding the nature of
multimethods- it's tricky converting my existing knowledge ;)
On Tue, Mar 31, 2009 at 10:32 AM, Rich Hickey wrote:
>
>
> Here are the areas I'm lo
+1 to Stuart's answer.
Clojure is very tightly integrated with Java. And knowing Java well
helps a great deal.
Personally I like learning from a more formal, comprehensive, book
rather than from spread-out individual tutorials. It gives you the
advantage of learning the workflow, and approaches i
On Mar 31, 2009, at 16:32, Rich Hickey wrote:
> Here are some problems/limitations of existing OO/GF systems that I
> don't intend to repeat:
...
I agree that these are not desirable features. I have had to work
around some of them many times in the past. Traditional OO combines
aspects that
On Tue, Mar 31, 2009 at 9:45 AM, Konrad Hinsen
wrote:
> I think this should be sufficient to cover all cases you mentioned,
> but of course it needs to be tried in practice.
I think your idea of specifying a sequence of items to try in the
dispatching function, at the point of definition for the
I am in Copenhagen. JAOO is definitely a possibility.
/mac
On Mar 31, 2:26 pm, Krukow wrote:
> On Mar 31, 1:00 pm, martin_clausen wrote:
>
> > I would certainly be interested. Lau are you out there ?
>
> So far one user in Cph, one in Aarhus. Where are you from? And how
> about Lau?
>
> If you
Hi Andrew,
Am 31.03.2009 um 04:53 schrieb Andrew Stein:
Here's a set of macros I have found useful for creating simulated
thread-local bindings for specific agents:
Please allow me to give you some feedback concerning the style
of your macros.
- (list 'let ), (vector 'ba# a),
This
Hi again,
Am 31.03.2009 um 19:04 schrieb Meikel Brandmeyer:
(Disclaimer: Henceforth everything is untested.)
I knew, why I put that there
Here some hopefully more functional version:
(defmacro bind-agent
[a bindings]
(let [bindings (mapcat (fn [[the-var the-val]]
I'm sorry if I missed you mentioning it, but have you tried running
your code with (set! *warn-on-reflection* true) in effect?
-- Aaron
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to thi
On Tue, Mar 31, 2009 at 1:24 PM, Aaron Cohen wrote:
> I'm sorry if I missed you mentioning it, but have you tried running
> your code with (set! *warn-on-reflection* true) in effect?
>
Ugh, I should have looked at your code before I sent that. There it
is on line 1. ;)
-- Aaron
--~--~
Hi the third try...
(defmacro bind-agent
[a bindings]
(let [bindings (mapcat (fn [[the-var the-val]]
[`(var ~the-var) the-val])
(partition 2 bindings))]
`(let [bound-agent# ~a]
(alter-meta! bound-agent# assoc
:
As an interim solution, you could write a wrapper class in Java that
extends the parameterized class, then extend that class in Clojure.
-Stuart
On Mar 31, 11:23 am, Chas Emerick wrote:
> gen-class does not yet support parameterized types. Rich is aware of
> the issue, though, and I suspect h
On Mar 31, 11:45 am, Konrad Hinsen wrote:
> On Mar 31, 2009, at 16:32, Rich Hickey wrote:
>
> > Here are some problems/limitations of existing OO/GF systems that I
> > don't intend to repeat:
>
> ...
>
> I agree that these are not desirable features. I have had to work
> around some of them man
I think clojure is a little torn between functional thinking and oo
thinking - java vs haskell (i must admit that I am not originally a
lisper, more of a java and functional guy)
Functional / haskell style is what you see in map. that collection is
at the end. The preceding arguments are like pa
On Mar 31, 2:18 pm, mikel wrote:
> On Mar 31, 11:45 am, Konrad Hinsen wrote:
>
>
>
> > On Mar 31, 2009, at 16:32, Rich Hickey wrote:
>
> > > Here are some problems/limitations of existing OO/GF systems that I
> > > don't intend to repeat:
>
> > ...
>
> > I agree that these are not desirable fe
On 31.03.2009, at 18:50, Mark Engelberg wrote:
> On Tue, Mar 31, 2009 at 9:45 AM, Konrad Hinsen
> wrote:
>> I think this should be sufficient to cover all cases you mentioned,
>> but of course it needs to be tried in practice.
>
> I think your idea of specifying a sequence of items to try in the
The let-> macro looks very useful. Thank-you!
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email t
I was searching for a Java alternative for our medical bus product and
looked at Scala during summer 2008.
I found it was too tied to an object model. The lack of a complete macro
system was in my view also a short coming.
I concluded that it was not a significant departure from Java. I really
wan
On Mar 31, 4:52 pm, Luc Prefontaine
wrote:
> I was searching for a Java alternative for our medical bus product and
> looked at Scala during summer 2008.
> I found it was too tied to an object model. The lack of a complete macro
> system was in my view also a short coming.
>
> I concluded that
Glad to hear it is a usable tutorial!
It seems like lots of people coming to Clojure not coming from Java
are having difficulties with GUI coding. I think a big list of GUI
examples in Clojure would be the perfect remedy.
@Krešimir - I think blogger was down for a bit that day, the link
should b
Hey, here is another clojure user from Copenhagen. I'm a Hungarian but
living here so please count me in!
Cheers:
Attila
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send e
On 28/03/2009, at 5:21 PM, Rayne wrote:
> I'd say Enclojure is close to
> production-ready.
From my playing with it, plus the list of things not yet done, I
don't think this is true. The IntelliJ clojure support seems more
advanced right now, and I'm starting to use that in production. IMO
On Mar 31, 7:28 am, Laurent PETIT wrote:
> If I remember correctly (I wasn't able to find the thread where this same
> subject was explained), one must make a difference between functions
> intended to work on data structures, and functions intended to work on
> sequences.
>
Here's the thread:
Hi Sean,
On Mar 30, 11:59 pm, Sean wrote:
> As an OSX nerd, my main problem is getting an editor up and running. Maybe
> you could add
> a section on setting up an editor?
That's a good point. I use TextMate with the Clojure bundle. I'll add
a section with the appropriate links.
Regards,
but the InteliJ IDE isn't free, is it?
On Tue, Mar 31, 2009 at 6:45 PM, Antony Blakey wrote:
>
>
> On 28/03/2009, at 5:21 PM, Rayne wrote:
>
> > I'd say Enclojure is close to
> > production-ready.
>
> From my playing with it, plus the list of things not yet done, I
> don't think this is true. Th
i may be in the minority in thinking that eventually (not as a priority, I
understand) more and more of the useful stuff from Java should be wrapped
... even if it masks the documentation. File IO was the last example that I
suggested putting in the core. This GUI question comes up so often, too,
the port of user code, that is ... much harder for the port of clojure.
On Tue, Mar 31, 2009 at 7:36 PM, e wrote:
> i may be in the minority in thinking that eventually (not as a priority, I
> understand) more and more of the useful stuff from Java should be wrapped
> ... even if it masks the do
Yeah,
if there existed some set of functions/macros that could be used to
specified user interface stuff at a "high level", while still allowing
controlled way of adding GUI specifics at some points, the dream could
become true.
I'd love to work on that, if time permitted.
But maybe such thing al
(i know this note of mine probably really doesn't help, but)
> But maybe such thing already exist in the Scheme/CommonLisp world, and could
> be used or be a source of inspiration ?
i'm not totally sure what you have in mind, but the subject of "new
researchy approach to doing GUIs that is suppo
Yes, you're certainly right, but I'm only 35 old, and I don't want to yet
let my dreams behind me, given that I will certainly (I hope so!) play at
least 35 more years in this industry :-)
I was thinking about an approach that would leverage the kind of separation
one can find in the industry such
> Yes, you're certainly right, but I'm only 35 old, and I don't want to yet
> let my dreams behind me, given that I will certainly (I hope so!) play at
> least 35 more years in this industry :-)
i'd say both:
a) that is good to hear, and i support such attitude! please go forth
and invent, becau
On 01/04/2009, at 10:47 AM, Laurent PETIT wrote:
> Something that can be thought of as "workable specs" for the GUI,
> where one does not have to switch language from one abstraction
> level to the other.
You should have a look at the Scala wrapping of SWT.
Antony Blakey
-
CTO,
On 01/04/2009, at 10:01 AM, e wrote:
> but the InteliJ IDE isn't free, is it?
So what? I'm a professional developer. I make money using these tools.
The money people pay for IntelliJ is one reason that the Scala support
in IntelliJ is more ambitious and why the IntelliJ Clojure plugin is
Thanks to cl-format:
(fn
[buf__2572__auto__ len__2573__auto__]
(if (= len__2573__auto__ 1)
(mask8 (. buf__2572__auto__ (get)))
(let [arr__2574__auto__ (int-array len__2573__auto__)]
(dotimes
[i__2575__auto__ len__2573__auto__]
(aset-int
arr__2574__auto__
I tried surrounding the call to the (. buf# (get)) method and putting
the coercion directly inside the mask8 and mask16 functions. Neither
worked. I want to mention at this point that I have *warn-on-
reflection* set to true for the little script that uses the library
and it doesn't report any c
Did you try
(int (mask8 (. buf__2572__auto__ (get
?
Your macro should like this:
(defmacro make-reader
[get-fn mask-fn]
`(fn [#^ByteBuffer buf# len#]
(if (= len# 1)
(~mask-fn (. buf# (~get-fn)))
(let [#^"[I" arr# (int-array len#)]
(dotimes [i# len#]
On Mar 31, 2:25 pm, Rich Hickey wrote:
> On Mar 31, 2:18 pm, mikel wrote:
> What about predicate, or rule based dispatch - why hardwire the notion
> of types, traversal or matching?
Those are different names for the same pieces.
> This is simply an exhausting amount of talk - how about a p
I tried it just now; it made no difference. Nevertheless, thank you
for you help and time!
On Mar 31, 9:38 pm, David Nolen wrote:
> Did you try
> (int (mask8 (. buf__2572__auto__ (get
>
> ?
>
> Your macro should like this:
>
> (defmacro make-reader
> [get-fn mask-fn]
> `(fn [#^ByteBuffe
just wanted to know because it didn't sound like it from the comparison
being made.
On Tue, Mar 31, 2009 at 8:34 PM, Antony Blakey wrote:
>
>
> On 01/04/2009, at 10:01 AM, e wrote:
>
> > but the InteliJ IDE isn't free, is it?
>
> So what? I'm a professional developer. I make money using these too
Unless they slowed down, the pace in which Enclojure was improving
would put me dead on. I personally use IntelliJ IDEA. But who says I
paid for it?
On Mar 31, 5:45 pm, Antony Blakey wrote:
> On 28/03/2009, at 5:21 PM, Rayne wrote:
>
> > I'd say Enclojure is close to
> > production-ready.
>
> F
15.1% 0 + 1711java.lang.reflect.Array.setInt
Is definitely pointing at the aset-int as being the time gobbler, I think
the expression in the macro should be this
(aset-int (ints arr#) i# (int (~mask-fn (. buf# (~get-fn)
to be extra safe.
On Tue, Mar 31, 2009 at 10:00 PM, Vincent F
On 01/04/2009, at 1:26 PM, Rayne wrote:
>
> Unless they slowed down, the pace in which Enclojure was improving
> would put me dead on.
Neither the site nor the mailing list shows a lot of activity - it's
not dead, but it is taking a long time compared to the IntelliJ
support, which was my p
As as a side note, putting type hints into the body of the macro expansion
doesn't do anything. These will be discarded. You will need to coerce types
via other methods, investigating how ints is implemented in core.clj is a
good place to start.
On Tue, Mar 31, 2009 at 11:04 PM, David Nolen wrote:
That's exactly what I did; no issues. Thanks!
On Mar 31, 1:47 pm, Stuart Sierra wrote:
> As an interim solution, you could write a wrapper class in Java that
> extends the parameterized class, then extend that class in Clojure.
> -Stuart
--~--~-~--~~~---~--~~
You
Hi folks,
I have some code where I wanted to:
- take a list of stuff (which includes another list inside)
- use 'seq-utils/flatten' to flatten the list
- use 'interpose' to add comma-delimiting strings between the elements
- print out the results, thereby creating comma-delimited output
Hi - I'm struggling with what is probably a very basic STM problem... so
forgive me if I've missed something obvious.
I have a world that is a list of structures
The world itself will change occasionally - i.e. I'll add or remove
structures from the overall list, and I'll regularly be reading the
comp creates a new function that you can store.
-> threads a value through a series of expressions.
On Wed, Apr 1, 2009 at 12:52 AM, kkw wrote:
>
> Hi folks,
>
>I have some code where I wanted to:
> - take a list of stuff (which includes another list inside)
> - use 'seq-utils/flatten' to fl
Thanks for all your replies.
Using google for a solution on an as-when-needed basis does
not really work well for me unless I have some conceptual
understanding of the subject.
Hence, for the time being, I have decided to settle for Core Java Vol.
1.
>From your replies, I think this should be a
68 matches
Mail list logo