Re: [Chicken-users] Tracing (Another NOOB Q)
Hi Erik, On Tue, 1 Nov 2011 16:47:21 + Erik Falor wrote: > On Tue, Nov 01, 2011 at 11:53:51AM -0400, Mario Domenech Goulart wrote: >> Hi Curtis, >> >> Thanks for pointing that out. The ,tr command has indeed been removed >> (version 4.3.0). I've fixed the manual. > > I attempted to create my own ,tr command to wrap the trace/untrace > function from the trace egg, but I'm stuck on converting a string into > a procedure name. > > Here's what I have in my .csirc: > ;; define the ,tr toplevel command to toggle tracing of a function > (let* ((trace-symbol 'tr) > >(help-text > (string-append >"," >(symbol->string trace-symbol) >" FUNCTION Toggle tracing of FUNCTION")) > >(toggle-tracing > (lambda () >(let ((function-str (read-line))) > (if (= 0 (string-length function-str)) >(print (string-append "Usage: " help-text)) >(trace/untrace (string->symbol function-str))) > (toplevel-command > trace-symbol > toggle-tracing > help-text)) > > This fails at the point that I pass a symbol to trace/untrace. How > should I convert a string into a procedure's name? I presume this is > possible because it is surely what the reader does all day long. Maybe something like: (let* ((trace-symbol 'tr) (help-text (sprintf ",~a FUNCTION Toggle tracing of FUNCTION" trace-symbol)) (toggle-tracing (lambda () (trace/untrace (eval (read)) (toplevel-command trace-symbol toggle-tracing help-text)) Best wishes. Mario -- http://parenteses.org/mario ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Tracing (Another NOOB Q)
Hi Curtis, On Tue, 1 Nov 2011 08:52:09 -0700 Curtis Cooley wrote: > In the manual on the wiki it says you can use the ,tr command to trace > a function like: > > #;5> ,tr fact > #;5> (fact 3) > |(fact 3) > | (fact 2) > | (fact 1) > | (fact 0) > | fact -> 1 > | fact -> 1 > | fact -> 2 > |fact -> 6 > 6 > > but there does not appear to be a ,tr command anymore. I've tried a > couple of the others that seemed similar, but could not find anything. > This would be really helpful as I make my way through SICP. Can it > still be done? Thanks for pointing that out. The ,tr command has indeed been removed (version 4.3.0). I've fixed the manual. You can use the trace egg (http://wiki.call-cc.org/egg/trace). Here's an example: csi> (use trace) csi> (define (fact n) (if (< n 2) 1 (* n (fact (- n 1) csi> (trace fact) ; tracing fact csi> (fact 3) [0] (fact 3) [1] (fact 2) [2] (fact 1) [2] fact -> 1 [1] fact -> 2 [0] fact -> 6 6 Best wishes. Mario -- http://parenteses.org/mario ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Tracing (Another NOOB Q)
In the manual on the wiki it says you can use the ,tr command to trace a function like: #;5> ,tr fact #;5> (fact 3) |(fact 3) | (fact 2) | (fact 1) | (fact 0) | fact -> 1 | fact -> 1 | fact -> 2 |fact -> 6 6 but there does not appear to be a ,tr command anymore. I've tried a couple of the others that seemed similar, but could not find anything. This would be really helpful as I make my way through SICP. Can it still be done? -- Curtis Cooley curtis.coo...@gmail.com blog:http://ponderingobjectorienteddesign.blogspot.com === Leadership is a potent combination of strategy and character. But if you must be without one, be without the strategy. -- H. Norman Schwarzkopf ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] test egg
On Tue, 1 Nov 2011 20:17:44 +0900 Alex Shinn wrote: > On Tue, Nov 1, 2011 at 7:24 PM, Christian Kellermann > wrote: >> * Alex Shinn [01 11:06]: >>> >> #;2> (test 4 (+ 2 2)) >>> >> >>> >> Error: (cdr) bad argument type: #f >>> >>> I'll fix this as soon as I get home, but it's not >>> very meaningful to use tests without any group. >> >> Ah I guess the confusion comes from the example above which is the >> one from the docs... > > Yes - you basically always want to use a group, > but it's nice to be able to run simple examples in > the repl. > > Fixed now. Thanks for the quick fix, Alex. Curtis: version 0.9.9.4 is available. "chicken-install test" should install it. Best wishes. Mario -- http://parenteses.org/mario ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] test egg
On Tue, Nov 1, 2011 at 7:24 PM, Christian Kellermann wrote: > * Alex Shinn [01 11:06]: >> >> #;2> (test 4 (+ 2 2)) >> >> >> >> Error: (cdr) bad argument type: #f >> >> I'll fix this as soon as I get home, but it's not >> very meaningful to use tests without any group. > > Ah I guess the confusion comes from the example above which is the > one from the docs... Yes - you basically always want to use a group, but it's nice to be able to run simple examples in the repl. Fixed now. -- Alex ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] test egg
* Alex Shinn [01 11:06]: > >> #;2> (test 4 (+ 2 2)) > >> > >> Error: (cdr) bad argument type: #f > > I'll fix this as soon as I get home, but it's not > very meaningful to use tests without any group. Ah I guess the confusion comes from the example above which is the one from the docs... -- Who can (make) the muddy water (clear)? Let it be still, and it will gradually become clear. Who can secure the condition of rest? Let movement go on, and the condition of rest will gradually arise. -- Lao Tse. ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] test egg
On Tue, Nov 1, 2011 at 6:47 PM, Mario Domenech Goulart wrote: > Hi Curtis, > > On Mon, 31 Oct 2011 20:07:57 -0700 Curtis Cooley > wrote: > >> I'm trying to get the test egg working, but I'm not getting very far. >> I'm using chicken to learn scheme, so I'm really new at all this. I'm >> running Linux Mint 11, but I've downloaded and compiled chicken 4.7 >> because Mint came with 4.2 and I could not even get the test egg to >> load. Any help or pointers are much appreciated. I'm trying to take a >> TDD pass through SICM. >> >> Here's the output from csi: >> >> #;1> (require-extension test) >> ; loading /usr/local/lib/chicken/6/test.import.so ... >> ; loading /usr/local/lib/chicken/6/regex.import.so ... >> ; loading /usr/local/lib/chicken/6/irregex.import.so ... >> ; loading /usr/local/lib/chicken/6/extras.import.so ... >> ; loading /usr/local/lib/chicken/6/test.so ... >> ; loading /usr/local/lib/chicken/6/regex.so ... >> #;2> (test 4 (+ 2 2)) >> >> Error: (cdr) bad argument type: #f > > It seems that the latest release of the test egg is broken. You can try > version 0.9.9.2, which is the last before the latest (alas, you'd need a > copy of the svn repo to find that out, since the version history in the > docs has not been updated). > > To install 0.9.9.2 you can run: > > $ chicken-install test:0.9.9.2 > > I hope that helps. It's not completely broken, you just need to call (test-begin) before any tests (or use test-group). I'll fix this as soon as I get home, but it's not very meaningful to use tests without any group. -- Alex ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] test egg
Hi Curtis, On Mon, 31 Oct 2011 20:07:57 -0700 Curtis Cooley wrote: > I'm trying to get the test egg working, but I'm not getting very far. > I'm using chicken to learn scheme, so I'm really new at all this. I'm > running Linux Mint 11, but I've downloaded and compiled chicken 4.7 > because Mint came with 4.2 and I could not even get the test egg to > load. Any help or pointers are much appreciated. I'm trying to take a > TDD pass through SICM. > > Here's the output from csi: > > #;1> (require-extension test) > ; loading /usr/local/lib/chicken/6/test.import.so ... > ; loading /usr/local/lib/chicken/6/regex.import.so ... > ; loading /usr/local/lib/chicken/6/irregex.import.so ... > ; loading /usr/local/lib/chicken/6/extras.import.so ... > ; loading /usr/local/lib/chicken/6/test.so ... > ; loading /usr/local/lib/chicken/6/regex.so ... > #;2> (test 4 (+ 2 2)) > > Error: (cdr) bad argument type: #f It seems that the latest release of the test egg is broken. You can try version 0.9.9.2, which is the last before the latest (alas, you'd need a copy of the svn repo to find that out, since the version history in the docs has not been updated). To install 0.9.9.2 you can run: $ chicken-install test:0.9.9.2 I hope that helps. Best wishes. Mario -- http://parenteses.org/mario ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] test egg
I'm trying to get the test egg working, but I'm not getting very far. I'm using chicken to learn scheme, so I'm really new at all this. I'm running Linux Mint 11, but I've downloaded and compiled chicken 4.7 because Mint came with 4.2 and I could not even get the test egg to load. Any help or pointers are much appreciated. I'm trying to take a TDD pass through SICM. Here's the output from csi: #;1> (require-extension test) ; loading /usr/local/lib/chicken/6/test.import.so ... ; loading /usr/local/lib/chicken/6/regex.import.so ... ; loading /usr/local/lib/chicken/6/irregex.import.so ... ; loading /usr/local/lib/chicken/6/extras.import.so ... ; loading /usr/local/lib/chicken/6/test.so ... ; loading /usr/local/lib/chicken/6/regex.so ... #;2> (test 4 (+ 2 2)) Error: (cdr) bad argument type: #f Call history: (##core#lambda () 4) (##core#begin 4) (lambda38 () (+ 2 2)) (##core#lambda () (+ 2 2)) (##core#begin (+ 2 2)) (+ 2 2) (cons39 (cons39 (quote40 name41) #f) (quote40 ((source42 + 2 2) (source36 + 2 2 (cons39 (quote40 name41) #f) (quote40 name41) (##core#quote name41) (quote40 ((source42 + 2 2) (source36 + 2 2))) (##core#quote ((source42 + 2 2) (source36 + 2 2))) (test-run37 (lambda38 () 4) (lambda38 () (+ 2 2)) (cons39 (cons39 (quote40 name41) #f) (quote40 ((so.. (cons39 (cons39 (quote40 name41) #f) (quote40 ((source42 + 2 2) (source36 + 2 2 (cons39 (quote40 name41) #f) (+ 2 2) <-- -- Curtis Cooley curtis.coo...@gmail.com blog:http://ponderingobjectorienteddesign.blogspot.com === Leadership is a potent combination of strategy and character. But if you must be without one, be without the strategy. -- H. Norman Schwarzkopf ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users