Hi,
Am 24.11.2009 um 18:47 schrieb Garth Sheldon-Coulson:
I'd be really interested in hearing others' views on the propriety of
binding all the dynamic vars every time using bound-fn or equivalent.
I asked whether it should to take a map or not in the assembla thread
of the ticket. But ther
Happy it helped.
I should mention that I used Meikel's docs as a guide, but my code
don't actually push or pop all the thread bindings every time I return
a lazy seq or a fn.
It felt a little ugly to me to bind *all* the dynamic vars in the
namespace when I knew there were only two I needed to ca
On Mon, Nov 23, 2009 at 11:39 PM, Garth Sheldon-Coulson wrote:
> Hi Mark,
>
> In Clojuratica I make what I think is "good, clean, compelling use" of
> dynamic vars. I rewrote the code to use dynamic vars after I found that
> doing it the other way became unwieldy and inelegant.
OK this makes sens
Hi Mark,
In Clojuratica I make what I think is "good, clean, compelling use" of
dynamic vars. I rewrote the code to use dynamic vars after I found that
doing it the other way became unwieldy and inelegant.
To simplify a little, the API consists of just one main function, let's call
it math-evalua
Meikel's blog post quotes:
"running into a lot of such trouble is a sign, that you misuse dynamic
variables. Use them wisely."
I'd like to see examples of what you think is a good, clean,
compelling use of dynamic variables that are properly used wisely.
My own experience is that if the code is s
Would it be possible to create an implementation of delay and lazy-seq
that didn't use fn to delay evaluation, or atleast captured dynamic
variables?
(delay (+ x 3)) reasonable semantics in current clojure (let [x x]
(delay (+ x 3)))
(delay (fn [y] (+ x y))) semantics should be the same it alread
Chris, Graham,
Am 23.11.2009 um 21:21 schrieb Graham Fawcett:
Very nice. A generalized version might be more useful to your readers:
take an input seq, and return an output seq which is evaluated
stepwise in the binding environment.
Thank you for your good comments. I updated the post with a
On Sat, Nov 21, 2009 at 4:37 PM, Meikel Brandmeyer wrote:
> Hi,
>
> Am 21.11.2009 um 05:22 schrieb Mark Engelberg:
>
>> Which reminds me, every once in a while I see people talking about
>> this here, and brainstorming up some alternatives to binding that
>> might interact better with lazy data st
Hi,
On Nov 23, 3:32 pm, nchubrich wrote:
> Meikel, is get-thread-bindings only in a development version of
> Clojure? I have 1.09.11 and don't see it documented or usable (or in
> the online docs).
I'm not sure what 1.09.11 means, but the following commits added push-/
pop-/get-thread-bindings
Hi,
On Nov 23, 3:36 pm, Chouser wrote:
> >http://kotka.de/blog/clojure/Taming_the_Bound_Seq.html
>
> That's excellent Meikel, thanks. Any reson you didn't use the
> with-bindings macro to make your final example a bit simpler?
Woops. The reason might be the time of day (23 o'clock after gettin
On Sat, Nov 21, 2009 at 4:37 PM, Meikel Brandmeyer wrote:
> Hi,
>
> Am 21.11.2009 um 05:22 schrieb Mark Engelberg:
>
>> Which reminds me, every once in a while I see people talking about
>> this here, and brainstorming up some alternatives to binding that
>> might interact better with lazy data st
Meikel, is get-thread-bindings only in a development version of
Clojure? I have 1.09.11 and don't see it documented or usable (or in
the online docs).
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@google
Hi,
Am 21.11.2009 um 05:22 schrieb Mark Engelberg:
Which reminds me, every once in a while I see people talking about
this here, and brainstorming up some alternatives to binding that
might interact better with lazy data structures. Has there been any
real progress on this, or has every propos
> Richard, do you know where one can read about Rich Hickey's
> speculative work on scoping constructs? I did find a good description
> by him of what Clojure currently does, from 2007:
http://clojure.org/todo
http://www.assembla.com/spaces/clojure/tickets/2-Scopes
Better off asking Rich, I thi
Richard, do you know where one can read about Rich Hickey's
speculative work on scoping constructs? I did find a good description
by him of what Clojure currently does, from 2007:
http://markmail.org/message/kpuq4dvcavek26sp#query:+page:1+mid:mgfsubipgaqdmzru+state:results
--
You received this
> True, that's a problem. But couldn't the library protect itself by
> putting a (binding [*strict* false] ...) in front of its code?
> (Having a namespace-level binding construct would be helpful.)
That's exactly what I meant when I wrote "it would introduce a problem
that library authors have
Richard---
> What if you accidentally cause a library to realize an infinite
> lazy sequence?
True, that's a problem. But couldn't the library protect itself by
putting a (binding [*strict* false] ...) in front of its code?
(Having a namespace-level binding construct would be helpful.)
This rai
> Richard---
> It's not the same thing:
>
> (class (doall (map (fn [x] x) [1 2 3])))
> -> clojure.lang.LazySeq
>
> whereas
>
> (class (binding [*strict* true]
> (map (fn[x] x) [1 2 3])))
> -> clojure.lang.LazilyPersistentVector
From Clojure's perspective those *are* the same thing:
user=> (=
Richard---
It's not the same thing:
(class (doall (map (fn [x] x) [1 2 3])))
-> clojure.lang.LazySeq
whereas
(class (binding [*strict* true]
(map (fn[x] x) [1 2 3])))
-> clojure.lang.LazilyPersistentVector
Also, having a dynamic var that turns laziness on and off would allow
you to do it
http://clojure.org/lisps
"All (global) Vars can be dynamically rebound without interfering with
lexical local bindings. No special declarations are necessary to
distinguish between dynamic and lexical bindings."
Other part of that explanation is whether x in a given piece of code
refers to a lexi
Getting back to the initial post, this would be the (almost)
equivalent code in java:
public class Test{
static int x = 1;
void bindingX(int val){
x = val;
}
int dummyFn2(){
return x + 1;
}
void dummyFn(){
System.out.println("entering function: "
> It might be nice to have the option.
You do -- wrap the form in doall.
> (binding [*strict* true]
> (map (fn[x] x) [1 2 3]))
would be equivalent to
(doall (map identity [1 2 3]))
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post t
Regarding Clojure sequence functions: why couldn't they have the
option of returning non-lazy seqs? Because you don't always really
need lazy seqs. It might be nice to have the option.
(map (fn[x] x) [1 2 3] :strict) -> [1 2 3]
or even
(binding [*strict* true]
(map (fn[x] x) [1 2 3])
On Sat, Nov 21, 2009 at 12:17 PM, Mark Engelberg
wrote:
> Intuitively, it seems to me that what one wants is for lazy data
> structures to contain bound values in some sort of closure-like thing
> so rebindings after the fact don't affect the data structure, but
> regular functions should retain t
On Sat, Nov 21, 2009 at 8:12 AM, Armando Blancas
wrote:
> I sympathize with your difficulties, but isn't there something
> fundamentally incompatible between the later-or-never of lazy-seq and
> the this-way-here-and-now for which dynamic binding is good for? In
> this case you picked laziness ove
I sympathize with your difficulties, but isn't there something
fundamentally incompatible between the later-or-never of lazy-seq and
the this-way-here-and-now for which dynamic binding is good for? In
this case you picked laziness over code simplification, maybe it'll be
the other way around some t
On Fri, Nov 20, 2009 at 8:02 PM, Mark Engelberg
wrote:
> Dynamic binding is confusing, and should be used with care.
Elaborating on my previous point: it's especially confusing because
dynamic binding interacts poorly with lazy data structures, which is
predominantly what you deal with in Clojure
Conceptually, the best way to think about it is that your binding sets
the global x to 100 and restores the global x to 1 when exiting the
scope of the binding construct. It has no effect on your local x.
Dynamic binding is confusing, and should be used with care. If you
stick with the lexical s
Even though I have used Clojure, I hadn't looked at the scoping rules
in detail. I am getting more confused as I read the documentations. I
made a small test to try out the scoping resolutions and am apalled at
the complexity. Could somebody explain the intent and various rules
that Clojure uses?
29 matches
Mail list logo