group-by does not filter, in contrast to distinct.
And I'm really only interested in one of the values considered equal
according to my keyfn. So if I sed group-by, I'd have to wrap it with
a call to map or similar. This is certainly an option, but I'd rather
not create all the intermediate vector
I agree with you, Michal.
But let me rephrase the question, maybe my initial long-winded post
wasn't clear enough on that.
Rather than having a separate fn 'distinct-by' in addition to the
existing 'distinct', which, apart from the hard-coded keyfn would be
EXACTLY the same, shouldn't we just gen
Agree, it might make sense to do that performance-wise. Although I'm
hoping that the compiler would be able to inline that as well
(optimizing away calls to identity).
Btw, what does :inline-arities do? It sounds like this could do what
we want.
On Feb 24, 5:03 am, Sean Devlin wrote:
> I guess I
In many real applications (I guess that rules out fibonacci), memoize
will consume a lot of memory and create OutOfMemoryErrors sooner or
later. Often you want to only keep the latest items in the cache and
forget about older ones.
I've seen a variant of memoize that evicts items based on a time-t
te:
> On 8 March 2010 05:31, Eugen Dück wrote:
>
> > And here's a variant that evicts elements when the size of the cache
> > exceeds some limit. In that case, the first item that was put in it
> > will be dissoc'ed. I'm using an array-map to accomplish this:
wrote:
> Hi,
>
> On Mar 9, 4:41 am, Eugen Dück wrote:
>
>
>
> > Good points! Testing array-map briefly led me to believe they can be
> > used as the clojure equivalent of Java\s LinkedHashMaps.
>
> > Here's a version that uses a vector to remember order o
Laurent, Meikel, Christophe,
I guess I must be missing something obvious, but can't we just put
more than one thing into an atom in order to get atomic behavior?
Using, say, a vector. Using the simple bounded memoizer as an example,
this looks to me like it works:
(defn bounded-memoize
[f capac
On Mar 13, 4:51 pm, Christophe Grand wrote:
> My variations on memoize use a single atom: your bounded-memoize id roughly
> equivalent to my memoize2 + fifo-strategy,
> seehttp://gist.github.com/330644#LID19.
I finally found the time to fully read your gist, and I see you are
indeed doing the sa
On Mar 14, 11:57 am, Eugen Dück wrote:
> This gap shrinks when using memoize7 thanks to the use of delays, but
> it is not completely closed and can still lead to multiple delays of
> the same computation. If we want to get rid off this gap and make it
Actually, I take that back.
Hi Christophe,
your fifo-strategy (the one that uses "identity" as the hit method)
does not work:
user=> (def g (memoize7 identity (fifo-strategy 3)))
#'user/g
user=> (g 1)
1
user=> (g 1)
java.lang.IllegalArgumentException: Wrong number of args passed to:
core$identity (NO_SOURCE_FILE:0)
You hav
On Mar 14, 5:42 pm, Meikel Brandmeyer wrote:
> really shows, that concurrent programming is not trivial. Not even for
> „trivial“ things like a memoised function.
True. It's not too hard to be correct, but being correct and
performant at the same time is a different issue...
Thinking about your
On Mar 14, 7:59 pm, Christophe Grand wrote:
> Well the fn passed to swap! can be retried so in case of "bad luck" you'll
> still create several delays.
You're absolutely right!
I wonder whether we can make any statement about the likeliness of
this happening in memoize6/7 vs. memoize7-variant or
All,
Developing in clojure is a lot of fun, at least it was for me and a
project of mine - except for one thing: Deploying the app as Java Web
Start app, that took me a bit of time to figure out, and not only
because Java Web Start is broken in debian squeeze (for a workaround,
see bugs.debian.org
That would be great! Please post the link here when you're done.
On Mar 18, 5:15 pm, LauJensen wrote:
> Eugen,
>
> Fantastic insight - I cant wait to work that into a blogpost :)
>
> Lau
>
> On 17 Mar., 15:56, Eugen Dück wrote:
>
> > All,
>
> > Develo
till
only see a white panel, try resizing the window. But it should re-
layout automatically now.
And make sure to draw the strokes in the right order and direction.
Cheers
Eugen
On Mar 23, 5:30 pm, Zmitro Lapcjonak wrote:
> On Mar 17, 4:56 pm, Eugen Dück wrote:
>
> > The comple
I just tried starting it from a Windows box, and for some reason, the
kanjis are not displayed there. Maybe it's a font issue, not sure yet.
Will investigate.
On Mar 24, 9:06 pm, Eugen Dück wrote:
> Hi Zmitro,
>
> you should see kanjis being detected as you draw the strokes. M
I fixed a couple of other issues, most of which show only on Windows.
You should see Kanjis now on the right-hand side when drawing.
Eugen
On Mar 23, 5:30 pm, Zmitro Lapcjonak wrote:
> On Mar 17, 4:56 pm, Eugen Dück wrote:
>
> > The complete jnlp can be found athttp://dueck.org/k
I'd like to announce 漢識 Boom!, a handwriting recognition software for
Japanese Kanjis.
It is available at http://dueck.org/kanshiki-boom/
Currently, it will be useful mainly for learners of the Japanese
language, as
* it requires the user to use the official stroke order and direction
(although
On Mar 27, 1:10 am, Jarkko Oranen wrote:
> This looks neat. I probably won't find much use for it though, as my
> input method already has this functionality, and even that doesn't get
> much use due to the fact that I am horrible at writing kanji with the
> mouse (I'm left-handed, but my mouse-ha
I was always assuming I can GPL my Clojure project, just as I can GPL
projects using completely closed compilers and/or runtime environments
(?). And the EPL itself is not restrictive when it comes to "non-
derived work". But then I read a couple of threads in this group, and
also got a response "y
When I do
(apply interleave some-colls)
and some-colls is a sequence/collection of only one sequence/
collection, it will throw:
user=> (apply interleave [[1 2]])
java.lang.IllegalArgumentException: Wrong number of args passed to:
core$interleave (NO_SOURCE_FILE:0)
(Of course I don't need the a
; special case? If not, I don't see a reason to include it.
> --
> Paul Hobbs
>
> On Sat, May 29, 2010 at 1:32 AM, Eugen Dück wrote:
> > When I do
>
> > (apply interleave some-colls)
>
> > and some-colls is a sequence/collection of only one sequ
And we could actually also add an no-arg version. My own version of
interleave that I use looks like this:
(defn interleav
([] nil)
([c] (seq c))
([c1 c2] (interleave c1 c2))
([c1 c2 & colls] (apply interleave c1 c2 colls)))
I guess that's as generic as it gets.
Does Rich read all thread
Suppose I have two collections:
(def x [1 2])
(def y [[\a \b] [\d \e] [\f \g]])
And want to iterate over them in the following manner:
user=> (map list x (transpose y))
((1 (\a \d \f))
(2 (\b \e \g)))
Where this is the transpose fn:
(defn transpose
[in]
(partition (count in) (apply interle
n: Wrong number of args passed to:
core$interleave (NO_SOURCE_FILE:0)
On Jun 6, 9:51 pm, Eugen Dück wrote:
> Suppose I have two collections:
>
> (def x [1 2])
> (def y [[\a \b] [\d \e] [\f \g]])
>
> And want to iterate over them in the following manner:
>
> user=> (map li
That's perfect - Thanks!
On Jun 7, 11:43 am, ataggart wrote:
> (map list x (apply map list y))
>
> On Jun 6, 5:51 am, Eugen Dück wrote:
>
> > Suppose I have two collections:
>
> > (def x [1 2])
> > (def y [[\a \b] [\d \e] [\f \g]])
>
> > And wa
I plan on doing ICFP 2010 next weekend in clojure (1.1), if the
problem is interesting. In preparation, I'm currently doing the
(implementation-wise) crucial bits of last year's contest.
I put the first part of my implementation online:
http://read-eval-puke.blogspot.com/2010/06/icfp-2009-orbit-bi
BTW, there will also be a 24h lightning round for those who can't
waste an extended weekend.
On Jun 12, 11:51 am, Eugen Dück wrote:
> I plan on doing ICFP 2010 next weekend in clojure (1.1), if the
> problem is interesting. In preparation, I'm currently doing the
> (implement
So, I'm done for this weekend. What I have (and put on the blog)
* a binary parser
* the vm (interpreted, maybe I can turn it into a compiled vm in the
coming week? any ideas? macros? have to think about it)
* a graphical visualizer
* a controller "framework", allows you to solve the actual proble
OK, I'm done for this weekend. Here's what I got:
* the binary reader
* the vm ("interpreted" for now - would like to make a "compiled" vm.
still have to think about it, I guess macros would help?)
* a graphical visualizer
* a controller framework to solve the actual problems
The code is surprisi
Recently, I implemented last year's ICFP problem. Part of it is
writing a VM that consists of memory slots, some registers and input
and input ports. It takes a list of instructions, works them off one
after the other, reading from input or memory, calculating something
and the changing registers o
Thanks Nicolas,
your first variant resembles the generated code much closer than my
initial approach, which is great. I need the eval though, to be able
to pass in non literals. In my real program I'm reading the
instructions from a binary file. So if I want to be able to do
something like this:
Say I have this sorted map, using strings as keys:
x=> (sorted-map "ab" 1 "n" 2)
{"ab" 1, "n" 2}
When I do a subseq
x=> (subseq (sorted-map "ab" 1 "n" 2) > "aa")
(["ab" 1] ["n" 2])
I get back both entries.
Now if I do the same subseq on the same map, except that I turn all
strings into charact
t;ab") 1
(vec "n") 2) > (vec "a"))
([[\a \b] 1] [[\n] 2])
So is this then the best way to get the sorting behavior I need?
On Jul 10, 6:09 pm, Eugen Dück wrote:
> Say I have this sorted map, using strings as keys:
>
> x=> (sorted-map "ab" 1 "
string-like-coll-comparator
[coll1 coll2]
(or (first (drop-while zero? (map compare coll1 coll2)))
(- (count coll1) (count coll2
Now, is this the way to get the sorting behavior I want or is anyone
aware of something simpler or more performant?
On Jul 10, 6:09 pm, Eugen Dück wrote:
:54 pm, Eugen Dück wrote:
> Well, turns out string-like-coll-comparator has a bug:
>
> x=> (subseq (sorted-map-by string-like-coll-comparator (vec "ab") 1
> (vec "n") 2) > (vec "a"))
> NullPointerException clojure.lang.AFunction.compare (AFunctio
Anyone who has seen the subject implemented in Java/Swing might have
been stunned by the hundreds of lines of code that were deemed
necessary for it, with their appropriate share of bugs. (And an
implementation I've seen in C#/NetAdvantage was even worse, which was
less related to the language itse
e 2)) inc identity)
(quot value tick-size)
value))
On Jan 23, 11:18 am, Eugen Dück wrote:
> Anyone who has seen the subject implemented in Java/Swing might have
> been stunned by the hundreds of lines of code that were deemed
> necessary for it, with their appropriate share of b
In June 2009, Rich wrote in "clojure goes git!":
> Some items are still outstanding:
>
> Importation of existing issues
> Placement of generated contrib documentation
> Patch submission policy
>
> In particular, please don't send pull requests via GitHub at this
> time.
An
On Feb 5, 11:00 am, Sean Corfield wrote:
> On Fri, Feb 4, 2011 at 5:24 PM, Eugen Dück wrote:
> > Furthermore, I was really surprised to find
> > onhttp://clojure.org/contributing
> > that I have to send a (non-e)mail around the world to be able to
> > contribute
On Feb 5, 11:51 am, Sean Corfield wrote:
> off to Rich... If someone really feels signing and mailing an
> agreement is "too much work" then they don't seem very committed to
> contributing, IMO. It's really not much of a hardship is it?
Things like github's pull requests are really great, as the
I'm using a macro that, stripped down to just expose my problem, looks
like this:
(defmacro quoted-param
[x]
`(println '~x))
It's all nice if I call it like
(quoted-param 23)
It will print the number 23. The following, however, will print
"asdf", rather than 23:
(def asdf 23)
(quoted-param
On Feb 5, 1:52 pm, Eric Lavigne wrote:
> This makes me think that the original macro needs some refactoring.
> There should be a function that handles most of the work, and a macro
> to make your code shorter in the common case.
>
> (defn unquoted-param [x] (println x))
>
> (defmacro quoted-param
n Sat, Feb 5, 2011 at 12:08 AM, Eugen Dück wrote:
> > yes, the code is more complex and it is in contrib. Changing contrib
> > requires you to send an intercontinental mail first, as mentioned in
> > my other post today... :) Reason enough to first checkout the other
> > opti
scan -> email would be more convenient for me.
@Chistopher
> people keep citing it as some unique requirement foisted upon the community
> by a power hungry dictator
That's a generalization that lacks any relation to this thread, and I
guess even the clojure community in general. I'm not aware o
A while back the discussion on the "bounded memoize" thread in this
forum lead to Meikel writing up a nice summary of how to do caching,
providing a pluggable strategy: lru, ttl, fifo, etc. Meikel's writeup
can be found at
http://kotka.de/blog/2010/03/memoize_done_right.html
It presents a bunch of
And if you don't have time to read the whole blog post - it's very
detailed - and just read code, you could scroll down to cgrand's
memoize8 function at https://gist.github.com/330644
On Feb 6, 8:32 pm, Eugen Dück wrote:
> A while back the discussion on the "bounded
l requests by CA signers, I'm still hopeful though,
as I don't see the legal issue there, and there's a hint in "please
don't send pull requests via GitHub AT THIS TIME".
Cheers
Eugen
On Feb 5, 11:45 am, Mike Meyer wrote:
> On Fri, 4 Feb 2011 18:36:34 -0800
Not that size should matter when it comes to legalistics, but it
appears the already mentioned KDE project, claiming that "the KDE
community is the second largest Free Software community" by most
measures, after the linux kernel, does not seem to have introduced a
CA requirement by now. (From quick
There's an example on metadata that resembles a repl session snippet
(although not exactly):
user=> (def x 1)
user=> (def y 2)
user=> ^{:x x} [x y 3]
^{:x 1} [1 2 3]
I interpret that as "the reader prints out meta data", which of course
is not true (by default). It could be changed, e.g. to
user
Java Web Start is super easy to use for end users, if that is an
option for you. All they have to do is click a link on a web page. The
signing part is a bit of a pita to set up, unless you follow one of
the quick howtos on web start for Java in general, and maybe by now
there are some clojure (lei
51 matches
Mail list logo