On Fri, Feb 15, 2013 at 8:19 AM, Jules julesjac...@gmail.com wrote:
But now you still don't have leiningen, which is essential if you want to
do anything non toy. The installation page of CCW does describe how to
create a leiningen project, but doesn't say that you first have to manually
P.S. I've been very happy with the latest version of leiningen on Windows.
--
--
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 that posts from new members are moderated - please be
Another idea: try using arrays of longs, rather than ints, since that is
what Clojure prefers.
--
--
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 that posts from new members are
On Mon, Feb 18, 2013 at 1:41 PM, Tom Hall thattommyh...@gmail.com wrote:
I think it's a shame he wrote the article around Christmas and chose a
less well known problem, I have looked at several Clojure Barbershop
Problem solutions so have a better idea now what an idiomatic solution
to this
On Fri, Feb 22, 2013 at 7:47 PM, Korny Sietsma ko...@sietsma.com wrote:
Isn't that always the way, though? Build your program in a powerful,
expressive language, then profile it, find the critical parts, and optimise
them - where possible in the same language, and where that's too
On Sun, Feb 24, 2013 at 5:50 AM, bernardH
un.compte.pour.tes...@gmail.comwrote:
FWIW, I, for one, am really glad that Clojure allows us to select
precisely which nice tools we want (have to) throw away (persistent data
structures, dynamic typing, synchronized) when the need arises. Reminds me
On Sun, Mar 3, 2013 at 7:06 PM, Lee Spector lspec...@hampshire.edu wrote:
So now I'm just checking for () and handling it specially, and that works.
But still it doesn't seem right that (str ()) =
clojure.lang.PersistentList$EmptyList@1 and I wouldn't be surprised if
this tripped up others
On Sun, Mar 3, 2013 at 7:30 PM, Jack Moffitt j...@metajack.im wrote:
I think you're looking for pr-str. For example:
(pr-str (take 10 (iterate inc 0)))
;;= (0 1 2 3 4 5 6 7 8 9)
Thanks! But that makes me wonder:
Why doesn't printf use either pr-str or print-str to handle the %s format
In Clojure, there are a handful of global variables that you can set!, for
example
(set! *warn-on-reflection* true)
Is there any mechanism for providing a similar feature in a user library?
--
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post
that ideally, a language should make
available for users any features it uses in its own built-in libraries, so
I'm hoping there's a way to do it.
On Wed, Mar 13, 2013 at 12:06 PM, Michael Klishin
michael.s.klis...@gmail.com wrote:
2013/3/13 Mark Engelberg mark.engelb...@gmail.com
In Clojure
On Wed, Mar 13, 2013 at 2:09 PM, Cedric Greevey cgree...@gmail.com wrote:
To expand on what Marko said, the set!able Vars that come with Clojure
just have thread-local bindings created already in the REPL thread. They're
really only meant to aid developers working at the REPL, rather than to
On Wed, Mar 13, 2013 at 2:06 PM, Marko Topolnik marko.topol...@gmail.comwrote:
As far as I understand it, *set!* modifies the *thread-local* binding,
just like the *binding* macro, but doesn't delimit a definite scope of
validity for the binding. You can *set!* any dynamic var with the same
On Wed, Mar 13, 2013 at 2:36 PM, Michael Klishin
michael.s.klis...@gmail.com wrote:
alter-var-root works fine for that purpose, e.g.
https://github.com/michaelklishin/monger/blob/master/src/clojure/monger/core.clj#L168-171
Thanks. That's probably what I'll end up doing. Still, it would be
OK, that answers my question. Thanks for the insights everyone!
--
--
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 that posts from new members are moderated - please be patient with
On Sun, Mar 17, 2013 at 6:07 PM, vemv v...@vemv.net wrote:
Reading a raw string stored in a file is already trivial :)
I'm aware that one can store a raw string in a file. But in many
instances, this would be absurd. For the kind of rapid interactive
development we have in Clojure, we don't
On Sun, Mar 17, 2013 at 11:23 PM, Softaddicts
lprefonta...@softaddicts.cawrote:
I find raw string handling in XML simply ugly :)
Agreed.
Do you have a suggestion on how to represent raw strings ? Something
concrete
we could discuss about ?
In several languages, they use a sequence of
On Mon, Mar 18, 2013 at 12:38 PM, Marko Topolnik
marko.topol...@gmail.comwrote:
This is just about the same as
(def ^:const pi (compute-estimate-of-pi))
OK, just tried out ^:const in my code and it seems to strip off any meta
data associated with the object stored in the var. That ruins
On Mon, Mar 18, 2013 at 8:31 PM, Kemar ke.mar...@gmail.com wrote:
Explicitly derefing the var and calling meta on it works:
(meta @#'c) - {:amazing true}
No idea as to why though...
Quirky. I assume that explicitly derefing the var defeats the speed
benefits of ^:const, yes?
--
--
You
On Tue, Mar 19, 2013 at 12:57 AM, Bronsa brobro...@gmail.com wrote:
If I remember correctly, this is a bug due to the fact that constant empty
literals are handled in a special way from the compiler.
Interesting. I see you are correct that the problem only occurs on
metadata attached to an
On Thu, Mar 21, 2013 at 11:54 AM, Razvan Rotaru razvan.rot...@gmail.comwrote:
Is there an alternative to the code above (preferably simple and elegant),
which will return the etire sequence?
(pr-str (map + [1 2 3]))
or
(print-str (map + [1 2 3]))
There are subtle differences between pr-str
I've been impressed with the quality of the InfoQ videos. Most other tech
videos I see are unwatchable precisely because there isn't enough
resolution to see the content on the presenter's screen clearly. Having
the slides side-by-side makes an enormous difference. Waiting several
months for a
On Mon, Mar 25, 2013 at 12:13 PM, Cedric Greevey cgree...@gmail.com wrote:
In fact, your statement is wrong as to very basic economics. The value of
being there at the conference isn't alterable by something that hasn't, at
that point, even happened yet. A delayed release only takes value
According to the Java docs, Java strings support eight escape characters.
http://docs.oracle.com/javase/tutorial/java/data/characters.html
One of the valid escape characters is \'
Clojure strings are supposed to be the same as Java strings, but when I
type the following string into the Clojure
I'm in reader hell right now, trying to puzzle out how escape sequences and
printing work for strings and regular expressions.
I notice that:
(re-pattern a\nb)
(re-pattern a\\nb)
(re-pattern a\\\nb)
all produce semantically equivalent regular expressions that match a\nb
The middle one prints
On Thu, Mar 28, 2013 at 5:08 PM, Mark Engelberg mark.engelb...@gmail.comwrote:
However, the first and last example print as:
#a
b
Follow up question:
Is there any way to make (re-pattern a\nb) print as #a\nb?
I've tried pr, print-dup, and various combinations of printing the outputs
Engelberg
mark.engelb...@gmail.comwrote:
On Thu, Mar 28, 2013 at 5:08 PM, Mark Engelberg mark.engelb...@gmail.com
wrote:
However, the first and last example print as:
#a
b
Follow up question:
Is there any way to make (re-pattern a\nb) print as #a\nb?
I've tried pr, print-dup
On Thu, Mar 28, 2013 at 6:16 PM, Andy Fingerhut andy.finger...@gmail.comwrote:
When you say a sane, readable way, do you mean human-readable, or
readable via clojure.core/read or clojure.core/read-string?
I meant human readable
(defn print-regex-my-way [re]
(print #regex \ (str re) \))
On Thu, Mar 28, 2013 at 7:52 PM, Mikhail Kryshen mikh...@kryshen.netwrote:
On Thu, 28 Mar 2013 17:08:46 -0700
Mark Engelberg mark.engelb...@gmail.com wrote:
Bug or feature?
Certainly a feature for complex patterns with whitespace and embedded
comments.
For example, the following regexp
On Thu, Mar 28, 2013 at 6:36 PM, Andy Fingerhut andy.finger...@gmail.comwrote:
(defn print-regex-my-way [re]
(print #regex )
(pr (str re)))
That might be closer to what you want.
Yes. That does the trick. That extra level of converting the regular
expression to a string does the
On Sat, Mar 30, 2013 at 11:33 AM, Mark Engelberg
mark.engelb...@gmail.comwrote:
On Thu, Mar 28, 2013 at 6:36 PM, Andy Fingerhut
andy.finger...@gmail.comwrote:
(defn print-regex-my-way [re]
(print #regex )
(pr (str re)))
That might be closer to what you want.
Yes. That does
On Sun, Mar 31, 2013 at 10:46 PM, Andy Fingerhut
andy.finger...@gmail.comwrote:
If you print it as a string, then want to read it back in and convert back
to a regex, you must read it as a string, then call re-pattern on it. That
should preserve the original meaning.
Printing it as a
On Mon, Apr 1, 2013 at 1:00 AM, Michał Marczyk michal.marc...@gmail.comwrote:
Could you just preprocess the strings passed to re-pattern (or
patterns if you're getting those as input) to replace literal newlines
with escape sequences? I'm assuming you don't care about ?x given the
result you
Right now, I'm experimenting with seesaw. In Clojars, it appears the
latest version is 1.4.2.
When I include [seesaw 1.4.2] in my project.clj file, then the REPL comes
up as 1.3.0 (even though I explicitly define clojure 1.5.1 as a dependency
in the project.clj file). How do I make my preferred
Thanks everyone!
--
--
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 that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group,
I'm having trouble figuring out how to sign a library when deploying it to
clojars.
I'm using lein 2.1.2 and the clojars plugin (0.9.1).
I pasted my ssh key into clojars profile.
I successfully created a pgp pair with gpg, and as per directions, pasted
the entire public key into my clojars
When I do lein deploy clojars, the tool hangs after reporting that it has
created the jar.
Any idea what might be causing it to hang?
On Fri, Apr 5, 2013 at 7:19 PM, Nelson Morris nmor...@nelsonmorris.netwrote:
Yep. There is an issue for making it work over scp, which the
lein-clojars plugin
Instaparse is an easy-to-use, feature-rich parser generator for Clojure.
The two stand-out features:
1. Converts standard EBNF notation for context-free grammars into an
executable parser. Makes the task of building parsers as lightweight and
simple as working with regular expressions.
2. Works
On Tue, Apr 9, 2013 at 1:33 AM, Tassilo Horn t...@gnu.org wrote:
Nice, but providing the grammar as a plain string looks somewhat
unnatural to me. Why not something like this (parser being a macro)?
(def as-and-bs
(parser
S = AB* .
AB = A B .
A = a + .
B = b + .))
What version are you running?
As far as I know, .3 isn't even a valid representation for a number --
you'd have to write it as 0.3. So I'm not sure where you're running that
code snippet such that you don't get an immediate error.
On 1.5.1:
= (+ 0.3 1.7)
2.0
That said, I think most
On Tue, Apr 9, 2013 at 2:41 AM, Mark Engelberg mark.engelb...@gmail.comwrote:
What do you think would be gained by making it a macro? From my
perspective, a macro is essentially just a string that is being processed
by the Clojure reader (and thus subject to its constraints). If the
grammar
Thanks for the suggestion. I based the syntax off of EBNF, and hadn't run
across ABNF notation before your link just now. It shouldn't be too hard
to add support for ABNF's repetition syntax and comments. Getting the
semantics of the terminal values to precisely match the ABNF spec seems
like
Ah. That's pretty funny :)
On Tue, Apr 9, 2013 at 2:48 AM, Jim foo.bar jimpil1...@gmail.com wrote:
Hey Mark, don't get paranoid :)... this is all Cedric did!
user= (def .3 0.4)
#'user/.3
user= (+ .3 1.7)
2.1
Jim
On 09/04/13 10:46, Mark Engelberg wrote:
What version are you
Wow, the enthusiastic response has been really gratifying. Thanks for the
kind words; I hope as people try it out that it lives up to the hype.
On Tue, Apr 9, 2013 at 4:47 AM, Laurent PETIT laurent.pe...@gmail.comwrote:
Do you have a roadmap for the next releases ?
Initially, my focus will
On Tue, Apr 9, 2013 at 7:14 AM, Tassilo Horn t...@gnu.org wrote:
IMHO, it would be cool if a clojure parser library would use a similar
format (exploiting clojure data structures beyond lists where they make
sense), at least internally. Of course, one could still have other
frontends like
On Wed, Apr 10, 2013 at 12:22 AM, sesm sergey.smyshly...@gmail.com wrote:
Hi Mark,
Amazing stuff, I didn't know, that such general parsing techniques even
exist!
One minor comment: it would be nice to add direct links to GLL papers and
https://github.com/epsil/gll github repo to save
On Thu, Apr 11, 2013 at 7:08 AM, Stathis Sideris side...@gmail.com wrote:
Thanks, this looks fantastic! Is there any way to include comments in the
syntax at all?
Last night I started a v1.1 branch to start work on these feature
requests. The first feature I added was, in fact, support for
On Thu, Apr 11, 2013 at 7:41 PM, Dmitry Kakurin dmitry.kaku...@gmail.comwrote:
But your parser rules are somewhat new to me.
Both variations are accepted:
add = add-sub '+' add-sub
add = mul-div '+' add-sub
And in both cases some generated parsers are correct (arithmetically
On Fri, Apr 12, 2013 at 1:55 PM, Dmitry Kakurin dmitry.kaku...@gmail.comwrote:
Here is where my question is coming from:
If I were to use such parser in production I'd like it to be unambiguous.
And I'd like to detect ambiguity early, before my software ships/deployed.
Preferably during
On Fri, Apr 12, 2013 at 5:55 PM, Brandon Bloom brandon.d.bl...@gmail.comwrote:
Your readme says I had difficulty getting his Parsing with Derivatives
technique to work in a performant way. I was wondering if you could
please elaborate.
What kind of performance did you achieve?
How does
Yes, quite possible. I've added it to the enhancement list on the github
issues page.
On Sat, Apr 13, 2013 at 2:45 AM, David Powell djpow...@djpowell.net wrote:
Would it be possible to have an option to tag the parse tree with
meta-data indicating the character offset (or line column)?
--
On Thu, May 2, 2013 at 7:19 AM, Max Gonzih gon...@gmail.com wrote:
Hi, what do you think about dsl version using map?
The short answer is that this is already supported. In the github readme,
you'll find a section labeled Combinators, in which I outline
instaparse's dsl for creating grammars
What tools exist in Clojure for understanding whether a given variable is
boxed or primitive?
To get a better handle on boxing, I started playing around with things like:
(def x 1)
(def ^int x 1)
(def x (int 1))
I want to know how Clojure is storing that 1 in the various cases.
The only tool I
Instaparse is an easy-to-use, feature-rich parser generator for Clojure.
The big idea behind instaparse is to make it simple to convert grammars to
parsers without needing to know the idiosyncrasies of LL1, LALR, and other
esoteric grammar restrictions imposed by most parser generators.
When I
As part of the instaparse library, I created a wrapper around Clojure's
vectors that keeps the hashcode updated as the vector is modified. In
scenarios where you take a vector and then hash, then modify, then hash,
then modify, then hash, etc., this strategy of incremental hashing is
essential to
On Tue, May 14, 2013 at 3:56 AM, Jim jimpil1...@gmail.com wrote:
many thanks for this! :)
btw, is there any place where one can find your discussion between you and
Christophe? I'd love to know more about equiv...alternatively, do you plan
on making public what you've learned in some sort of
On Tue, May 14, 2013 at 6:17 AM, Laurent PETIT laurent.pe...@gmail.comwrote:
Mark, the combined qualities of the code, the documentation, the
communication, is inspiring !
Aw shucks. I'm blushing. Thanks guys.
--Mark
--
--
You received this message because you are subscribed to the
Where is it getting the examples from?
--
--
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 that posts from new members are moderated - please be patient with your
first post.
To
Using eval should be a rarity.
I'd use (every? identity [false false true]) to do a reduce-and, and I'd
use (some identity [false false true]) to do a reduce-or (keeping in mind
the latter actually returns nil rather than false).
--
--
You received this message because you are subscribed to
The most common way to do this in Clojure is to define your function such
that if the input is not in the domain, the function returns nil.
Since nil and false are the only falsey values in Clojure, you can use
ordinary tests to determine if the function returned a result. The idiom
that lets
Another possible design choice is to store a domain-testing predicate in
the function's metadata.
(with-meta (fn [x] ...) {:domain integer?})
(defn is-defined? [f x]
(- f meta :domain x))
--
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post
Yes and no. nrepl ritz lags behind slime, especially in areas such as
breakpoints and inspection.
On Mon, May 27, 2013 at 3:22 PM, David Nolen dnolen.li...@gmail.com wrote:
Doesn't ritz support nrepl? http://github.com/pallet/ritz
On Mon, May 27, 2013 at 5:53 PM, Mark Engelberg
On Mon, May 27, 2013 at 10:25 PM, Cedric Greevey cgree...@gmail.com wrote:
What about add-watch? Can be used with any of Clojure's mutable-value
containers -- atoms, refs, agents, vars. If one is getting set to an
inappropriate value, or you suspect it is, you can attach a watcher to it
that
I'm not sure what your point is.
I rely quite a bit on randomly generated tests, and of course, any
multithreaded app has nondeterministic elements that can be hard to
replicate.
For that matter, if you are simply experimenting with new code at the REPL,
it might not always be clear what
According to this article, Clojure does not yet have this facility:
http://java.dzone.com/articles/promises-and-futures-clojure
This is something that is being worked on and discussed, though:
http://dev.clojure.org/display/design/Promises
I've been using the lein clojars plugin to deploy to clojars with the lein
push command. It's been working great for me, but today, it's not
working. I recently upgraded to the newest version of leiningen, and
that's the only major change I can think of since my last deployment, so
I'm
This thread came up right around the time I was considering adding a
dependency on rhizome to instaparse to make it easy to visualize the parse
trees. Based on the discussion here, I decided it would be a bad idea to
include rhizome directly in instaparse's dependencies. Nevertheless, it
made
Short answer: This is fixed in 1.2.0-SNAPSHOT.
Long answer:
There was a file in instaparse that had two functions:
parser-str
and
Parser-str
On case-insensitive filesystems, the clojure compiler ends up spitting out
a bunch of classfiles that correspond to the different functions, and the
one
On Thu, Jun 6, 2013 at 4:27 PM, Mark Engelberg mark.engelb...@gmail.comwrote:
Short answer: This is fixed in 1.2.0-SNAPSHOT.
To be clear, just change your project file to [instaparse 1.2.0-SNAPSHOT]
and you should be good to go. As a bonus, there are some new perf
improvements and features
On Mon, Jun 10, 2013 at 2:13 AM, Frantisek Sodomka fsodo...@gmail.comwrote:
EBNF syntax for bounded repetition could be just simply A 3*5 and these
are equal:
A? is A*1
A+ is A1*
A* is A0*
Right now, in the EBNF syntax, numbers are valid non-terminal identifiers.
So for example, rather
On Mon, Jun 10, 2013 at 2:57 AM, Frantisek Sodomka fsodo...@gmail.comwrote:
Googling the exception operator:
http://avisynth.org/mediawiki/User:Gzarkadas/EBNF
Exception The effect is the logical negation of the rule
following. For example -a becomes ? all characters not equal to a
One of the main changes to 1.3 is that arithmetic operations on longs
do not automatically overflow.
In the early discussions of this new feature, it was pointed out that
people who want overflow capability can use the special prime
operators, but that the preferred way to do things would be to
On Sat, Jul 2, 2011 at 12:21 PM, James Keats james.w.ke...@gmail.com wrote:
A very recent quote by Abelson is relevant:
One of the things I’m learning here (Google) is the experience of
working on these enormous programs. I just never experienced that
before. Previously a large program to me
Ideally, I was hoping to start a more in-depth discussion about the
pros and cons of programming in the large in Clojure than just
waxing poetic about Clojure/Lisp's capabilities in the abstract :)
Yes, much of the initial excitement around Clojure comes from the
feeling of Wow, I can do so much
On Sat, Jul 2, 2011 at 8:19 PM, Luc Prefontaine
lprefonta...@softaddicts.ca wrote:
Were did you find the link between functional languages and close proximity of
errors ? That's a language design decision. You may want to use assertions
on your fns to validate inputs. That sould improve your
As of today, my lein uberjar command is no longer working on an
unchanged project that compiled perfectly three days ago. The errors
I'm getting seem to be suggesting that lein is no longer able to get
the contrib library for 1.2. Can anyone think of any reason why this
line:
:dependencies
More specifically, it seems to be that clojure.contrib.duck-streams is
no longer being found even though the project.clj file is unchanged.
Was duck-streams removed from the monolithic 1.2.0 contrib build?
--
You received this message because you are subscribed to the Google
Groups Clojure
Never mind. I figured out the problem. Somehow, one of the runs of
lein must have gotten interrupted in a way that left the compiled
duck-stream files corrupted in my classes directory. By manually
deleting the contents of the classes directory and starting fresh,
everything worked.
--Mark
--
On Fri, Jun 24, 2011 at 1:53 PM, Stuart Sierra
the.stuart.sie...@gmail.com wrote:
There is currently no plan for a Clojure 1.3-compatible release of old
clojure-contrib. However, if people with commit access to old
clojure-contrib have time to fix all the little things that prevent it from
Whoops, I thought I was asking on the dev list, but autocompletion
sent it to the regular clojure list. Sorry about that. I'm resending
to the dev list.
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to
On Sat, Jul 30, 2011 at 7:58 AM, Mark Rathwell mark.rathw...@gmail.com wrote:
One thing, though, is new users coming from Python/Ruby/etc really do seem
to have a hard time adjusting to the fact the standard is not to have a
Clojure installation, with a clj executable that you run scripts
On Sat, Jul 30, 2011 at 10:43 AM, Sean Corfield seancorfi...@gmail.com wrote:
On Sat, Jul 30, 2011 at 8:24 AM, Mark Engelberg
mark.engelb...@gmail.com wrote:
95% of the time, I just want to open a
file, write some Clojure code, and interactively test it in a REPL.
Really? Genuine question
On Fri, Jul 29, 2011 at 10:09 AM, abedra aaron.be...@gmail.com wrote:
Can you provide a couple of concrete examples for this? I will make
the ticket in JIRA and start working on it, but I am spread thin on
quite a few things at the moment and these examples will help a lot.
Cheers,
Aaron
On Sat, Aug 6, 2011 at 2:30 PM, Rich Hickey richhic...@gmail.com wrote:
Why all the attention to :use - I thought everyone agreed using it is a bad
idea?
...
The only benefit
I see is that you can avoid a (minimum 2 character) prefix.
The other benefit is it saves you from the cognitive load
The course website (for the actual classroom-based class that
underlies the online class) doesn't list any programming language as a
prerequisite. The only prerequisites listed are a strong
understanding of probability and linear algebra.
--
You received this message because you are subscribed
BTW, Norvig's older AI book uses LISP. According to his website, he
switched to Python because students complained that the LISP code did
not look enough like the pseudocode outline of how a given algorithm
works, and had trouble making the connection between the two.
--
You received this
On Mon, Aug 8, 2011 at 2:18 PM, daly d...@axiom-developer.org wrote:
It is trivial to make Lisp look like Python,
just put each paren on its own line and move them hard right.
Add a few macros (e.g. for) and you could probably parse it.
I agree with most of what you said, but not this.
(filter identity l) is a great way of removing all the false and nil
items from l
--
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 that posts from new members are moderated - please be
My guess is that nth (and by extension rand-nth) can't implicitly call
seq on the collection because if it did, you'd lose the fast access
that vectors provide. So you'll need to call seq on your set before
passing it to rand-nth.
--
You received this message because you are subscribed to the
The Machine Learning class from 2008 has been available at iTunes
University for a while, but I'm not aware of it having the same kinds
of support materials as the online AI class has said they will offer.
Be forewarned: the Machine Learning class is presented in a very math
intensive way
Nice. I'm glad these other classes are getting the full treatment.
It's really a shame they don't do a clearer job of defining the
prerequisites. For example, they should post some sort of pre-test
with specific examples of the kind of math that is needed to
understand the class. I find it
I had always assumed that vectors were sorted lexicographically. In
other words, you sort on the first element, and then refine by the
second element, and so on. I was surprised tonight to discover that
is not the case.
(compare abc b); Strings are compared lexicographically
-1
On Fri, Sep 2, 2011 at 11:14 AM, ax2groin ax2gr...@gmail.com wrote:
This code doesn't return the value I intuitively expect:
user= (not= 1 2 1)
true
This is exactly what I expect. Those values are not all equal.
--
You received this message because you are subscribed to the Google
You can do one linear pass over your data, accumulating a sorted set of the
best 10 items you've found so far. You seed the sorted set with the first
10 items from your list, then continue traversing your list. With each new
item you encounter, you ask if it is any better than the worst of the
2011 08:23, Mark Engelberg mark.engelb...@gmail.com wrote:
You can do one linear pass over your data, accumulating a sorted set of
the
best 10 items you've found so far. You seed the sorted set with the first
10 items from your list, then continue traversing your list. With each
new
item you
in the top 10.
Or have I misunderstood?
--
Dave
On 15 Sep 2011 08:54, Mark Engelberg mark.engelb...@gmail.com wrote:
If you maintain the invariant that at each point, your sorted set
contains
the top 10 you've seen so far, then from that invariant you can conclude
that at the end
Here's what I speculate the problem is:
Last time I checked, contains? doesn't work on transient sets.
Try rewriting (contains? tset %) as (tset %).
Let me know if that change fixes your program. This is a bug I reported
something like 1-2 years ago. If this turns out to be the source of your
On Fri, Sep 16, 2011 at 11:20 AM, David Nolen dnolen.li...@gmail.comwrote:
Examining the Java sources it looks like the transient collections do not
support contains? by design.
David
Unfortunately, another design decision in Clojure is that contains? returns
spurious results, rather than
Support of membership testing is pretty much the defining characteristic of
sets, transient or not.
Transient sets already support membership testing in the form of (my-set
item). If they support the IFn interface for membership testing, it's hard
for me to imagine that it would be much more
That's really no different from just sorting the list and taking the first
5. O(n log(n)).
And for really large data sets, this is going to consume a lot of memory.
The method I outlined would be O(n) and doesn't force the sequence to all be
resident in memory at the same time.
On Fri, Sep 16,
That heap-sort example is not really lazy. The
java.util.concurrent.PriorityBlockingQueue essentially sorts the whole
thing, and then the heap-sort is just making a lazy seq over that.
Also, note that the speed test at that link is only working with lists of
1000, and the original poster
401 - 500 of 1149 matches
Mail list logo