If coll has O(n) access and we impose the restriction that indices is
increasing (or sort it up front), we can do better than this by only
doing one pass through coll.
On Aug 18, 10:46 am, CuppoJava wrote:
> The most straight-forward answer I would have given is also:
> (defn slice [indices col
On Jan 23, 1:53 pm, Tom Emerson wrote:
> Hi all,
>
> I updated my entire Clojure environment today to the latest in source
> control: slime, swank-clojure, clojure, clojure-contrib, clojure-mode.
> Now SLIME is unhappy. It appears that the swank-clojure code has been
> patched appropriately.
I
Here: http://clojure.org/contributing
On Jan 5, 3:39 pm, Andrew Baine wrote:
> Where do I find the Clojure Contributor Agreement so I can submit a
> patch with my issue?
>
> Andrew
--~--~-~--~~~---~--~~
You received this message because you are subsc
Where do I find the Clojure Contributor Agreement so I can submit a
patch with my issue?
Andrew
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to clojure@googlegrou
On Sat, Jan 3, 2009 at 1:30 PM, Jason wrote:
> Thanks for your posts. I think I understand what happens now, but I
> still maintain that it's a bug. In particular, the Java API says: "If
> two objects are equal according to the equals(Object) method, then
> calling the hashCode method on each o
On Fri, Jan 2, 2009 at 8:09 AM, Perry Trolard wrote:
>
> I did something similar using (iterate rest coll), which I called iter-
> rest:
>
> (defn iter-rest
> "Takes the first (count coll) items from call to (iterate rest
> coll).
> If passed function as first argument, calls it on each invoc
I want to get a seq of successive rests of the given seq:
user> (defn f [seq]
(if (empty? seq)
nil
(lazy-cons seq (f (rest seq)
#'user/f
user> (f '(1 2 3 4))
((1 2 3 4) (2 3 4) (3 4) (4))
user> (take 10 (map #(take 5 %) (f (iterate inc 1
((1 2 3 4 5) (2 3 4 5 6) (3 4 5 6 7) (4 5 6 7 8)
I also uploaded the patch to this group's files:
http://groups.google.com/group/clojure/web/containsAll.patch
On Dec 24, 7:05 pm, Andrew Baine wrote:
> Index: src/jvm/clojure/lang/PersistentQueue.java
> ===
> --- s
Index: src/jvm/clojure/lang/PersistentQueue.java
===
--- src/jvm/clojure/lang/PersistentQueue.java (revision 1185)
+++ src/jvm/clojure/lang/PersistentQueue.java (working copy)
@@ -181,10 +181,10 @@
public boolean containsAll(Coll
Okay, thanks Stuart.
--~--~-~--~~~---~--~~
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 to
clojure+unsubscr...@g
Any help is much appreciated:
user> (require :verbose 'clojure.contrib.enum)
(clojure.core/load "/clojure/contrib/enum")
; Evaluation aborted.
java.lang.Exception: Unable to resolve symbol: gen-and-load-class in
this context (enum.clj:42)
[Thrown class clojure.lang.Compiler$CompilerException]
I should note that this also works because of sets being seq-able.
Since they're callable, we can use b as the predicate in every?; since
they're seq-able we can use a as the coll in every?. Very cool!
On Dec 19, 1:46 pm, Andrew Baine wrote:
> Since sets are callable like func
Since sets are callable like functions, subset? can be written pretty
concisely:
user> (defn subset? [a b] (every? b a))
It handles the empty set cases correctly and everything. Is this
already in clojure-contrib? Want it and its brethren superset? proper-
subset? proper-superset? in there?
Check out http://blip.tv/file/812787/ which is a video presentation by
Rich Hickey on clojure concurrency; it ends with an description of an
ant simulation that uses refs and agents -- it really helped my own
intuitive feel of when to use those two constructs.
Best,
Andrew
--~--~-~--~
14 matches
Mail list logo