Hi Andy!
On Tue, Aug 18, 2009 at 8:43 PM, Andy Fingerhut <
andy_finger...@alum.wustl.edu> wrote:
>
> On Aug 17, 3:51 am, Christophe Grand wrote:
> > Why do you focus on these AtomicReferences? If you contrast pre-transient
> > vectors and actual vectors you'll see that the overhead due to instan
On Wed, Aug 19, 2009 at 2:33 AM, Sean Devlin wrote:
>
> The set is being passed in as a parameter, so that will be a problem.
> Still, I'll be able to re-write my routine with false. Thanks!
When the set is passed in as a parameter, one bulletproof[1] way to do that
is:
user=> (filter (partial
Is there a way to introspect a function to get its arity? I know some
functions have an arbitrary amount of arguments, but knowing the count
on finite argument lists and whether or not a function accepts an
infinite list would be very useful. Also, hints on what types a
functions arguments accept
(apply map + '((1 2) (2 3) (3 4)))
produces result: (6 9)
Could anyone explain a little more detail how the result being
produced?
Though I checked the source of 'apply' function but still not clear
how this piece of code eval.
Thank you in advance.
-Simon
--~--~-~--~~~
(apply map + '((1 2) (2 3) (3 4)))
is synonymous to:
(map + [1 2] [2 3] [3 4])
So you get
( (1+2+3) (2+3+4) ) = (6 9)
Hope that helps
-Patrick
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
T
Maybe you want this:
user=>(map (partial reduce +) '((1 2) (2 3) (3 4)))
(3 5 7)
Maybe not.
On Aug 19, 2:56 am, simon wrote:
> (apply map + '((1 2) (2 3) (3 4)))
>
> produces result: (6 9)
>
> Could anyone explain a little more detail how the result being
> produced?
> Though I checked the sou
Check the metadata arglist. For example,
(:arglists (meta #'map))
If you want to automate this, you'll need a macro.
On Aug 19, 4:24 am, lancecarlson wrote:
> Is there a way to introspect a function to get its arity? I know some
> functions have an arbitrary amount of arguments, but knowing th
Hi,
On Aug 19, 10:24 am, lancecarlson wrote:
> Is there a way to introspect a function to get its arity? I know some
> functions have an arbitrary amount of arguments, but knowing the count
> on finite argument lists and whether or not a function accepts an
> infinite list would be very useful.
Hi!
Am 19.08.2009 um 10:24 schrieb lancecarlson:
> Is there a way to introspect a function to get its arity? I know some
> functions have an arbitrary amount of arguments, but knowing the count
> on finite argument lists and whether or not a function accepts an
> infinite list would be very usef
On Fri, Aug 14, 2009 at 5:58 AM, Mike Hinchey wrote:
> The difference is MAX_VALUE is a primitive int, but 1 (any literal) is an
> Integer.
>
> user> Integer/MAX_VALUE
> 2147483647
> user> (inc 2147483647)
> 2147483648
>
> But, I agree there is inconsistency. They should all check, except for the
On Fri, Aug 14, 2009 at 6:28 AM, David Powell wrote:
>
>
>> user=> (.getClass (+ 1 Integer/MAX_VALUE))
>> java.lang.Long
>
> Also,
>
> user=> (def i (Integer/MAX_VALUE))
>
> user=> (class (+ 1 i))
> java.lang.Long
>
> user=> (class (inc i))
> java.math.BigInteger
>
> I'd expect inc to overflow to
If you use or desire support for Maven please help out on this.
Otherwise, the pom.xml is just an unsupported impediment, since
Clojure is officially built by Ant, and I have no maven-fu.
Thanks,
Rich
On Fri, Aug 14, 2009 at 9:58 AM, Thorsen Eric wrote:
> I posted the message below on the dev g
On Fri, Aug 14, 2009 at 8:53 PM, Mark Volkmann wrote:
>
> On Fri, Aug 14, 2009 at 4:17 PM, Mark Volkmann
> wrote:
>> On Thu, Aug 13, 2009 at 4:58 AM, Chas Emerick wrote:
>>>
I know that if you have a dosync call in some function executed by a
thread, and then that function calls other f
On Fri, Aug 14, 2009 at 3:10 PM, bradford
cross wrote:
> We have just released flightcaster.com which uses statistical inference and
> machine learning to predict flight delays in advance of airlines (initial
> results appear to do so with 85 - 90 % accuracy.)
>
> The webserver and webapp are all
On Wed, Aug 19, 2009 at 11:03 AM, Rich Hickey wrote:
>
> While I appreciate that you are trying to understand the
> implementation of the STM, understanding the semantics of the STM in
> terms of its implementation is wrong-way-around.
>
> The semantics are simpler, and the implementation is subje
I've finally had a chance (after about a month of travel and other
distractions) to get the Clojure and Clojure Contrib builds on
Tapestry360 (http://tapestry.formos.com/bamboo) working again.
There are now post-checkin builds for clojure and clojure-contrib.
There are nightly builds for both pr
Hey folks,
clojure.contrib.str-utils is one of the first libs I wrote, and it's
showing its age. I decided to try to start fresh, incorporating some
ideas discussed on the list. In general, I'm trying to provide an
efficient, functional API for string manipulation.
My new attempt is creatively
On Mon, Aug 17, 2009 at 4:16 PM, Mark Volkmann wrote:
>
> On Mon, Aug 17, 2009 at 2:47 PM, Michael Reid wrote:
>>
>> Hi,
>>
>> Ditto on the ordering example. Clojure can't infer which order your
>> code needs to run any more than it can figure out what your code is
>> supposed to do.
>
> Okay. I w
On Aug 19, 2009, at 12:43 PM, Howard Lewis Ship wrote:
> I've finally had a chance (after about a month of travel and other
> distractions) to get the Clojure and Clojure Contrib builds on
> Tapestry360 (http://tapestry.formos.com/bamboo) working again.
Heh, I'm actually setting up a new hudson
On Wed, Aug 19, 2009 at 12:18 PM, Rich Hickey wrote:
>
> On Mon, Aug 17, 2009 at 4:16 PM, Mark Volkmann
> wrote:
>>
>> On Mon, Aug 17, 2009 at 2:47 PM, Michael Reid wrote:
>>>
>>> Hi,
>>>
>>> Ditto on the ordering example. Clojure can't infer which order your
>>> code needs to run any more than i
I'm using str-utils2 for a couple of months now. Do not care about the
old library.
--~--~-~--~~~---~--~~
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 t
On Wed, Aug 19, 2009 at 1:59 PM, Vagif Verdi wrote:
>
> I'm using str-utils2 for a couple of months now. Do not care about the
> old library.
Me too. I think it would be helpful to have a recommended
namespace alias to help keep different people's code a bit
more uniform.
I use (require '[cloju
On Aug 19, 2009, at 2:22 PM, Chouser wrote:
> I use (require '[clojure.contrib.str-utils2 :as str2]) for
> now and would recommend just 'str' if the lib name changes.
Except, of course, since there is already a str function, 'str' would
be a bad alias.
'strutils' or 'str-utils' sound fine t
Have you considered splitting the str-utils2 into two namespaces, one
that can be imported, and another that needs to be required with a
namespace?
On Wed, Aug 19, 2009 at 11:22 AM, Chouser wrote:
>
> On Wed, Aug 19, 2009 at 1:59 PM, Vagif Verdi wrote:
>>
>> I'm using str-utils2 for a couple of m
On Wed, Aug 19, 2009 at 10:03 AM, Achim Passen wrote:
> Beware! This snippet relies on unexposed details of clojure's current
> implementation. It might stop working tomorrow, so it's definitely not
> intended for production use, but it might help with debbuging/exploring.
Meanwhile, for declare
On Aug 19, 2009, at 12:43 PM, Howard Lewis Ship wrote:
[java] java.lang.Exception: Name conflict, can't def assoc!
because namespace: clojure.contrib.repl-ln refers
to:#'clojure.core/assoc! (repl_ln.clj:71)
The current (HEAD) version of clojure.contrib/repl_ln.clj no longer
defines asso
(def *dosync-counts* (atom {})
(defn avg-in [map key val]
(let [[avg cnt] (get map key [0 0])]
(assoc map key [(/ (+ (* avg cnt) val) (inc cnt)) (inc cnt)])))
(defmacro logged-dosync [& body]
`(let [count# (atom 0)]
(dosync
(swap! count# inc)
~...@body)
(swap! *dosy
On Aug 19, 2:38 am, Christophe Grand wrote:
> Imagine a persistent data structure S1 with a root node A and two child
> nodes B and C.
> On this data structure you call transient, make some updates and call
> persistent! which yields an updated persistent data structure S2 with the
> root node
On Aug 19, 3:09 pm, Howard Lewis Ship wrote:
> Have you considered splitting the str-utils2 into two namespaces, one
> that can be imported, and another that needs to be required with a
> namespace?
Hi Howard,
Hadn't thought of that, actually. There are 9 conflicts, out of 32
definitions:
tak
During the Clojure for Lispers talk in Boston (see clojure.blip.tv if
you want to watch it), someone asked Rich about enforcing the no-side-
effect rule in transactions. Rich answered that he couldn't do that,
because "I'm a dynamic language." (audience got a chuckle out of that
way of putting i
Excellent - any chance:
http://github.com/talios/clojure-maven-plugin
could be added as well? I was about to go and see about getting it deployed
to oss.sonatype.org but I do like the idea of a 'central clojure
repository'.
However, currently I'm using the 'org.clojure' groupid which, giving
Why don't you do the group rename first.
Bamboo is easy enough to use, I can give you a hand if you need it.
It's open to register and you can clone the existing Clojure or
Clojure Contriub plans to form one for your plugin.
On Wed, Aug 19, 2009 at 3:24 PM, Mark Derricutt wrote:
> Excellent - an
On Aug 19, 5:16 pm, Sean Devlin wrote:
> I suspect I am in the minority with my next concern. The library
> takes the string as the first argument, so that it works well with the
> -> macro. When I originally wrote my string library, I favored this
> type of signature too.
>
> However, over tim
Looks like it may be failing for other reasons.
See the latest output log:
http://tapestry.formos.com/bamboo/browse/CLJC-TRUNK/latest
On Wed, Aug 19, 2009 at 1:53 PM, Stephen C. Gilardi wrote:
>
> On Aug 19, 2009, at 12:43 PM, Howard Lewis Ship wrote:
>
> [java] java.lang.Exception: Name c
On Aug 19, 5:16 pm, Sean Devlin wrote:
> However, over time I found this signature did not work well with my
> code. Often I would write something like this
>
> (map (comp (partial map (comp #(str2/drop % 2)
> #(str2/take % 5)))
> #(str2/split %
Hmmm... that's pretty clever. Well done.
Well, if we're gonna play golf :)
(def & comp)
(def p partial)
;;I like this because the amount of white spaces tells me something
;;Almost Pythonesque
(map (& (p map (& (p str2/drop 2)
(p str2/take 5)))
(p str2/split #"\t"))
I'm also looking for a satisfactory answer to this problem.
So far I'm slightly in favor of putting the "data" (ie. the sequence/
collection/object ...) first in the argument list and the "parameters"
following.
This is because there's so many core functions that take a function
and arguments an
Hi,
Two problems I'd like to ask about.. (using clojure 1.0)
(1) The following code seems to work correctly
( generates Hamming numbers -- see
http://en.wikipedia.org/wiki/Haskell_(programming_language)#More_complex_examples
)
but...
;--
On Aug 19, 9:56 pm, CuppoJava wrote:
> If I were to have my way, I would redefine all the clojure.core
> functions to assume the "data" is the last argument instead of the
> first. (this includes ->) This way they would play nice with both
> partial and ->.
That's a really interesting idea. Wha
+1
On Aug 19, 11:02 pm, Stuart Sierra
wrote:
> On Aug 19, 9:56 pm, CuppoJava wrote:
>
> > If I were to have my way, I would redefine all the clojure.core
> > functions to assume the "data" is the last argument instead of the
> > first. (this includes ->) This way they would play nice with both
For me, I'd like it if the core functions had the "data" as the first
argument, but have a special function—I can't come up with a better
name than "partial-2"—so that (partial-2 function opt1 opt2 opt3) is
equivalent to (fn [data] (function data opt1 opt2 opt3)). That way, I
could do things like
On Thu, Aug 20, 2009 at 12:45 AM, samppi wrote:
>
> For me, I'd like it if the core functions had the "data" as the first
> argument, but have a special function—I can't come up with a better
> name than "partial-2"—so that (partial-2 function opt1 opt2 opt3) is
> equivalent to (fn [data] (functi
Hi,
I'd like to add
3) Use `io!` in your side-effecting functions.
Since we should try to minimise side-effects to dedicated functions
and keep the rest of our program clean.
So in ClojureQL we have a `with-connection` macro, which expands to
something like (io! "Database interaction cannot ha
Hi,
Disclaimer: personal opinion following...
I'm sorry. I don't get the elegance of point-free style.
In mathematics f denotes the function, while f(x) denotes the value f
takes over x. This is actually a nice and easy to understand notation.
But why do I have to clutter my clojure code with `
44 matches
Mail list logo