I'm assuming the StackOverflow link you refer to is
http://stackoverflow.com/questions/3259825/trouble-with-lazy-convolution-fn-in-clojure.
I would think about the problem this way: to compute the value at index i in
the output list, you multiply together each pair of values in the input lists
Thanks Michał
I suppose this raises a deeper question - should an expression and
what it evaluates to always be interchangeable in source code? I
naively assumed it should, but then after reading Kyle's explanation
decided that maybe there is a difference?
On Jul 17, 2:18 am, Michał Marczyk
and serialized continuations ? could they be used to save a image of
a moment of a execution to return to it lately?
--
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
Hi All-
I've just posted a summary of feedback and the plan moving forward for
ClojureDocs.org (http://groups.google.com/group/clojuredocsorg/
browse_thread/thread/af7edbf85a6607c4). If you're interested in being
involved in shaping the site please take a look (and sign up for the
group).
I'd
Islon- See the week 1 post on the CD.org group (http://
groups.google.com/group/clojuredocsorg/browse_thread/thread/
af7edbf85a6607c4) as to where this fits in on the timeline.
Lee- Very cool, I've added it to the UserVoice page.
Daniel- I agree, a great search experience is key for
On 16 July 2010 20:57, Isaac Hodes iho...@mac.com wrote:
I am trying to create a lazy/functional/efficient/Clojuresque function
to carry out convolution on two lists/vectors of (ideally BigDecimals
but that may be inefficient) doubles.
Perhaps something like this?
(defn convolve [ns ms]
Hi Toni,
The key thing is that you can implement protocol on Object.
So if you have one protocol per function, (Let's call your function f1,...,
fn and the protocols implementing them F1,,Fn)
You can define a default value for each function:
(extend-type Object
F1 (f1 ...) Fn
Hi,
Am 16.07.2010 um 20:56 schrieb Jeffrey Schwab:
On 7/16/10 2:42 PM, Cyrus Harmon wrote:
Going to http:// clojure.org, searching for git and following the Clojure
goes git link would lead one to
http://groups.google.com/group/clojure/msg/ca4fb58428052554 which suggests
that the
Hi Zack,
I just had a look at ClojureDocs.org and it's really neat!
Some observations I made:
- When I view the docs of let's say clojure.set/rename, the clojure.set
part is a link. But instead of pointing to to clojure.set summary
page, it is only http:.
- In the source section, not all
Hi,
one way to do that is using extend.
(def defaults
{fn1 (fn ...)
fn2 (fn ...)
fn3 (fn ...)})
(defrecord R1 [...])
(def R1-fns
{fn1 (fn ...)})
(defrecord R2 [...])
(def R2-fns
{fn2 (fn ...)
fn3 (fn ...)})
(extend YourProtocol
R1 (merge defaults R1-fns)
R2 (merge defaults
clojure-namespaces should be treated like java-namespaces: (ns
foo.bar) instead of (ns foo-bar)
On Sat, Jul 17, 2010 at 3:45 AM, Eric Thorsen ethor...@enclojure.org wrote:
Congrats on the 1.2 beta guys!
When I AOT a defrecord it does not javaize the clojure namespace into
a proper java
2010/7/17 Moritz Ulrich ulrich.mor...@googlemail.com
clojure-namespaces should be treated like java-namespaces: (ns
foo.bar) instead of (ns foo-bar)
I think he refered to the fact that the hyphen in the (single) namespace
segment was not translated into an underscore.
// raek
--
You
That's correct...not generating a valid java package from the clojure
namespace...hyphens to underscores does not appear to happen for
defrecord in 1.2 beta.
On Jul 17, 8:29 am, Rasmus Svensson r...@lysator.liu.se wrote:
2010/7/17 Moritz Ulrich ulrich.mor...@googlemail.com
clojure-namespaces
On Jul 16, 11:26 pm, Frederick Polgardy f...@polgardy.com wrote:
Where's the link? :)
-Fred
Whew. Here it is; my bad!
http://stackoverflow.com/questions/3259825/trouble-with-lazy-convolution-fn-in-clojure
--
You received this message because you are subscribed to the Google
Groups
Hi Clojurians,
The recent 1.2 beta release is the first time I played with 1.2. When
reading the release notes, I saw a number of new namespaces. I was
able to find most of them (clojure.java.io, etc.) on the API site
(http://richhickey.github.com/clojure/). However, I could not find
the
Dear all,
I was wondering if they were a way to define a record type with identity as
an equality semantic?
(defrecord A[]
Object
(hashCode ...)
(equals ...))
do not work.
Is there a way to do that?
(Defining a deftype around the defrecord is a bit annoying)
Best regards,
Nicolas.
--
Hi Benny,
The 1.2 release source site has moved to
http://github.com/clojure/
-Regards, Adrian
On Sat, Jul 17, 2010 at 8:00 AM, Btsai benny.t...@gmail.com wrote:
Hi Clojurians,
The recent 1.2 beta release is the first time I played with 1.2. When
reading the release notes, I saw a number
On 7/17/10 5:50 AM, Meikel Brandmeyer wrote:
On 7/16/10 2:42 PM, Cyrus Harmon wrote:
Going to http:// clojure.org, searching for git and following the Clojure goes
git link would lead one to
http://groups.google.com/group/clojure/msg/ca4fb58428052554 which suggests that the
rickhickey page
No. Use identical? if you want to test for object identity. IIRC
Rich commented that the inability to override equals/hashCode was
intentional as value equality was the correct approach. See
http://clojure.org/state
On Jul 17, 7:00 am, Nicolas Oury nicolas.o...@gmail.com wrote:
Dear all,
I
This statement is interesting. Part of what makes the Python implementation so
expressive is precisely the use of functional constructs like list
comprehensions, ranges, and all the awesome stuff in itertools. A purely
imperative implementation would probably be as clunky as the purely
Well. I totally agree that value equality is the correct approach. And I am
very happy it is the default.
But, in some situations, you want to have accessors but do want to have
identity as an equality.
You cannot use identical? in Clojure data structures, for example.
I am in a situation where
I tried to run Jame's code, but the compiler (1.2 beta) squawked at me:
Unable to resolve symbol: indexed in this context
[Thrown class java.lang.Exception]
What do I need to pull in to pick up the indexed function?
On Sat, Jul 17, 2010 at 5:08 AM, James Reeves jree...@weavejester.com wrote:
More specifically, I am trying to build Hash Consed trees whose nodes are
records.
http://en.wikipedia.org/wiki/Hash_consing
This is a necessary step in a lot of algorithms. It is a benefit of being
principled about not mutating values.
And it can not be implemented, without overriding hashCode
It's in contrib.seq-utils
http://richhickey.github.com/clojure-contrib/seq-utils-api.html#clojure.contrib.seq-utils/indexed
On Jul 17, 2010, at 1:41 PM, David Cabana drcab...@gmail.com wrote:
I tried to run Jame's code, but the compiler (1.2 beta) squawked at me:
Unable to resolve symbol:
On 17 July 2010 18:41, David Cabana drcab...@gmail.com wrote:
I tried to run Jame's code, but the compiler (1.2 beta) squawked at me:
Unable to resolve symbol: indexed in this context
[Thrown class java.lang.Exception]
What do I need to pull in to pick up the indexed function?
Sorry, I
Hello,
I wrote a persistent LRU cache, but I'm not sure I am satisfied with
the interface in particular (and perhaps the implementation). It's at:
http://github.com/scode/plru
git://github.com/scode/plru.git
(Btw in general I'd appreciate any feedback - especially negative
about the
Peter Schuller peter.schul...@infidyne.com writes:
lru-peak - [value]
I take it you meant peek, not peak.
[...]
One possibility I was thinking of was that, since the expected use
case of an LRU cache is so specific, it may be acceptable to have the
lru library itself provide a
lru-peak - [value]
I take it you meant peek, not peak.
Yes - Yes. How embarrassing ;) Thanks.
One possibility I was thinking of was that, since the expected use
case of an LRU cache is so specific, it may be acceptable to have the
lru library itself provide a side-effect aware interface
Another thing occurred to me: While not necessarily important in the
cache of an LRU cache, one might want a data structure, even if it
tends to be used in a side-effectful manner, to participate in STM
co-ordinated transactions. If one hides an underlying ref, this means
that either callers do
The Programming Clojure book states: Functions that use dynamic
bindings are not pure functions.. (P2.0, page 174).
I do not understand why this must be the case, can someone explain why?
PS. I tried to post this on the discussion page for the book
(http://forums.pragprog.com/forums/91), but
The ways to define methods with different arities in deftype and
extend-type syntactically differ:
(deftype Foo []
P
(bar [x] x)
(bar [x y] (+ x y)))
(extend-type Foo
P
(bar ([x] x)
([x y] (+ x y
Is this inconsistence deliberate decision?
--
You received this message
Thank you Adrian. I did see in the release announcement thread that
that is the new source site for 1.2. However, I was unable to find an
online API there. http://richhickey.github.com/clojure/ is the only
online API I have seen. And again, the other new 1.2 namespaces like
clojure.java.io
Thanks everyone for the input! I've also got some nice replies on
Stack Overflow – there's some sort of a discussion there as well.
I thought I'd add my voice to the crowd. First off, purely imperative
C is fairly elegant itself. I've made it a simple function (along with
the Python version on
I thought this problem was interesting enough to merit better
treatment than I can give it here, hence a blog post was in order.
Brief version: I think I have a lazy, functional, and idiomatic
implementation with decent performance. Check it out here:
Hi,
2010/7/17 Paul Richards paul.richa...@gmail.com
The Programming Clojure book states: Functions that use dynamic
bindings are not pure functions.. (P2.0, page 174).
I do not understand why this must be the case, can someone explain why?
Because then the result of the function does not
Hi, Try this:
(defn stationary-convolve [n fs gs]
(let [window-size (count fs)
padding (repeat window-size 0)
padded-gs (concat padding gs padding)
new-center (+ n window-size)
window-of-gs (subvec (vec padded-gs)
(- (inc new-center)
(defn ^{:static true} convolve ^doubles [^doubles xs ^doubles is]
(let [xlen (count xs)
ilen (count is)
ys (double-array (dec (+ xlen ilen)))]
(dotimes [p xlen]
(dotimes [q ilen]
(let [n (+ p q), x (aget xs p), i (aget is q), y (aget ys n)]
(aset ys
On Jul 17, 2010, at 3:43 PM, Isaac Hodes wrote:
It's just a shame, it seems to me, that there is such a nice way to
represent the procedure in Python or even C, yet Clojure (or any Lisp
really) struggles to idiomatically answer this question of
convolution.
No, it's pretty easy to do
(def *forty-two* 42)
(defn impure-add42 [n]
(+ n *forty-two*))
(impure-add42 1)
= 43
(binding [*forty-two* 23]
(impure-add42 1))
= 65
On Sun, Jul 18, 2010 at 12:57 AM, Laurent PETIT laurent.pe...@gmail.com wrote:
Hi,
2010/7/17 Paul Richards paul.richa...@gmail.com
The Programming
Hi David,
Would appreciate if you could try out my attempt at this [1] on your
machine. My machine ain't as fast as yours apparently...
[1]
I tried this, it runs in about the same amount of time as it did for you.
On Sat, Jul 17, 2010 at 7:17 PM, Carson c.sci.b...@gmail.com wrote:
Hi David,
Would appreciate if you could try out my attempt at this [1] on your
machine. My machine ain't as fast as yours apparently...
[1]
On 17 Jul, 22:43, Isaac Hodes iho...@mac.com wrote:
It's just a shame, it seems to me, that there is such a nice way to
represent the procedure in Python or even C, yet Clojure (or any Lisp
really) struggles to idiomatically answer this question of
convolution.
I'll have to disagree with the
This example is beside the point of the original question. It uses mutable
arrays. It's very much dropping to the Java level. Am I missing something?
-Fred
--
Science answers questions; philosophy questions answers.
On Jul 17, 2010, at 6:04 PM, David Nolen wrote:
(defn ^{:static true}
Have you taken a look at my attempt at a solution (on the other/
original thread)?
https://groups.google.com/group/clojure/tree/browse_frm/thread/ee4169bc292ab572/6d03461efde166ad?rnum=11_done=%2Fgroup%2Fclojure%2Fbrowse_frm%2Fthread%2Fee4169bc292ab572%3F#doc_6d03461efde166ad
I don't know if it
I think it really doesn't get any clearer than this in terms of intent. While I
was adept at calculus-level math 20 years ago, I've forgotten the little I knew
of matrices. This is the first algorithm that has communicated by visual
inspection (to me) exactly what a convolution is.
-Fred
--
I notice that only certain type hints turn into concrete java types in
the signature of the genned constructors and field definitions (such
as int and float) where as string, date, etc. turn into Objects.
Do these other type hints just get discarded/ignored?
Thanks,
Eric
--
You received this
I guess different people see things differently. I actually didn't
understand the intent of the imperative version, even though it takes
less lines I guess. There's quite a few things called convolution.
My naive implementation was functional and pretty fast. Turns out it
can be even faster
Thanks David.
On Jul 17, 4:58 pm, David Nolen dnolen.li...@gmail.com wrote:
I tried this, it runs in about the same amount of time as it did for you.
On Sat, Jul 17, 2010 at 7:17 PM, Carson c.sci.b...@gmail.com wrote:
Hi David,
Would appreciate if you could try out my attempt at this [1]
Interestingly, the results are different for me.
; SLIME 2010-05-01
user (def *forty-two* 42)
#'user/*forty-two*
user (defn impure-add42 [n] (+ n *forty-two*))
#'user/impure-add42
user (impure-add42 1)
43
user (binding [*forty-two* 23] (impure-add42 1))
24
On Jul 18, 7:14 am, Moritz Ulrich
On Sun, Jul 18, 2010 at 11:32 AM, Carson c.sci.b...@gmail.com wrote:
I guess different people see things differently. I actually didn't
understand the intent of the imperative version, even though it takes
less lines I guess. There's quite a few things called convolution.
My naive
Yes, sorry, my post referred to the source, not the online doc API.
Perhaps someone else can answer regarding that?
On Sat, Jul 17, 2010 at 5:58 PM, Btsai benny.t...@gmail.com wrote:
Thank you Adrian. I did see in the release announcement thread that
that is the new source site for 1.2.
This might be of related interest:
http://kotka.de/blog/2010/03/The_Rule_of_Three.html
On Jul 17, 3:19 pm, Peter Schuller peter.schul...@infidyne.com
wrote:
Another thing occurred to me: While not necessarily important in the
cache of an LRU cache, one might want a data structure, even if it
52 matches
Mail list logo