Re: clojure.contrib.trace not working on 1.2?

2010-09-08 Thread Scott Jaderholm
On Wed, Sep 8, 2010 at 7:30 AM, Mark Nutter  wrote:
> I seem to recall that 1.2 is using "chunked" lazy sequences for
> performance reasons, and fib is a lazy sequence. I wonder if you'd
> start seeing intermediate steps using (fib 20) instead of (fib 3)?

This fib doesn't look lazy to me so I don't think that's it.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: clojure.contrib.trace not working on 1.2?

2010-09-08 Thread Mark Nutter
I seem to recall that 1.2 is using "chunked" lazy sequences for
performance reasons, and fib is a lazy sequence. I wonder if you'd
start seeing intermediate steps using (fib 20) instead of (fib 3)?

m

On Tue, Sep 7, 2010 at 7:32 PM, Scott Jaderholm  wrote:
> Why does c.c.trace give different output on 1.2 than it did on 1.1?
>
> From 
> http://learnclojure.blogspot.com/2010/02/slime-2009-10-31-user-defn-fib-n-if-n-2.html
>
> On 1.1
>
> user> (dotrace (fib) (fib 3))
>
> TRACE t1880: (fib 3)
> TRACE t1881: |    (fib 2)
> TRACE t1882: |    |    (fib 1)
> TRACE t1882: |    |    => 1
> TRACE t1883: |    |    (fib 0)
> TRACE t1883: |    |    => 0
> TRACE t1881: |    => 1
> TRACE t1884: |    (fib 1)
> TRACE t1884: |    => 1
> TRACE t1880: => 2
> 2
> user>
>
> On 1.2
>
> user> dotrace (fib) (fib 3))
>
> TRACE t11624: (fib 3)
> TRACE t11624: => 2
>
> Thanks,
> Scott
>
> --
> 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, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: clojure.contrib.trace not working on 1.2?

2010-09-07 Thread Michał Marczyk
Hm, I would guess that the self-call gets "hard-wired", since if you
define fib thus:

(defn fib [n]
  (if (#{0 1} n)
n
(+ (#'fib (- 2 n)) (#'fib (dec n)

then it works as you expect.

Not that I'm really sure what's happening; just a conjecture. Also, I
believe I already bumped into this behaviour when playing with
alternative tracing schemes, but never realised its new to 1.2...
interesting.

Sincerely,
Michał

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


clojure.contrib.trace not working on 1.2?

2010-09-07 Thread Scott Jaderholm
Why does c.c.trace give different output on 1.2 than it did on 1.1?

>From 
>http://learnclojure.blogspot.com/2010/02/slime-2009-10-31-user-defn-fib-n-if-n-2.html

On 1.1

user> (dotrace (fib) (fib 3))

TRACE t1880: (fib 3)
TRACE t1881: |(fib 2)
TRACE t1882: ||(fib 1)
TRACE t1882: ||=> 1
TRACE t1883: ||(fib 0)
TRACE t1883: ||=> 0
TRACE t1881: |=> 1
TRACE t1884: |(fib 1)
TRACE t1884: |=> 1
TRACE t1880: => 2
2
user>

On 1.2

user> dotrace (fib) (fib 3))

TRACE t11624: (fib 3)
TRACE t11624: => 2

Thanks,
Scott

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en