I should add, "oops, ignore what I wrote". :)
see:
https://groups.google.com/group/clojure/tree/browse_frm/thread/33366bccc6df7756/415072576d83b757?rnum=11&_done=%2Fgroup%2Fclojure%2Fbrowse_frm%2Fthread%2F33366bccc6df7756%3F#doc_0d0a3759a0a10328
Carson
On Jul 17, 3:58 pm, Carson wrote:
> Hi, T
Hi Per,
woh, take it easy. I don't claim to be an expert. Thanks for showing
me that though. It certainly didn't seem right at first, but I had
trouble figuring out the laziness in clojure, me being new to it.
Anyway, have a good weekend!
Carson
On Jul 17, 10:02 pm, Per Vognsen wrote:
> How a
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
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
> tends to be used in a side
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 wrote:
> 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
On Sun, Jul 18, 2010 at 11:32 AM, Carson 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 implementation was function
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
w
Thanks David.
On Jul 17, 4:58 pm, David Nolen 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 wrote:
> > Hi David,
> > Would appreciate if you could try out my attempt at this [1] on your
> > machine. My machine ain'
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 with
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 mes
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
--
Sc
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
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} convol
On 17 Jul, 22:43, 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.
I'll have to disagree with the conclusion.
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 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]
>
> https://groups.googl
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]
https://groups.google.com/group/clojure/tree/browse_frm/thread/ee4169bc292ab572/6d03461efde166ad?rnum=11&_done=%2Fgroup%2Fclojure%2Fbrowse_frm%2Fthread%2Fee4
(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 wrote:
> Hi,
>
> 2010/7/17 Paul Richards
>>
>> The "Programming Clojure" book states: "Functions that use
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 conv
(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 n
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) w
Hi,
2010/7/17 Paul Richards
> 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 *only* depend o
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:
http://erl.nfshost.com/2010/07/17/discrete-co
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 the
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 show
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 becau
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), b
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 not
> Assuming there is a legitimate need for a persistent data structure
> (such as for concurrent background introspection purposes), what would
> be your favored approach in terms of an interface?
I should clarify that no, I'm not really willing to use a state monad
since I'm trying to figure out t
>> 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
Peter Schuller 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 side-effect aware interface
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 implem
On 17 July 2010 18:41, David Cabana 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 should have ment
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 wrote:
> I tried to run Jame's code, but the compiler (1.2 beta) squawked at me:
> Unable to resolve symbol: indexed in this con
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
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 wrote:
> Perhaps something lik
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
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 functiona
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 wrote:
> Dear all,
>
> I was wondering if th
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 pag
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 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 of new namespaces.
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 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 clojur
On Jul 16, 11:26 pm, Frederick Polgardy 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 "Clojure" group.
To p
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 wrote:
> 2010/7/17 Moritz Ulrich
>
> > clojure-namespaces should be treated like java-namespaces: (ns
2010/7/17 Moritz Ulrich
> 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 received this message because yo
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 wrote:
> Congrats on the 1.2 beta guys!
>
> When I AOT a defrecord it does not javaize the clojure namespace into
> a proper java package name.
> (ns this-
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 R
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 r
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 t
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 (fn)
On 16 July 2010 20:57, Isaac Hodes 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]
(loop [nums (fo
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 documentation
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 li
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 n
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 wrot
54 matches
Mail list logo