Arc Forumnew | comments | leaders | submitlogin
Transcribe your Arc REPL session
3 points by fallintothis 3486 days ago | 1 comment
I don't know if anyone will ever need this, but I was bored, so I wrote a little script to log your REPL interactions.

  arc> (load "transcribe/transcribe.arc")
  nil
  arc> (transcribe "test")
  ;;; Starting transcription
  arc (log)> (+ 1 2)
  3
  arc (log)> (def fact (n)
               (if (<= n 0)
                   1
                   (* n (fact (- n 1)))))
  #<procedure: fact>
  arc (log)> (fact 5)
  120
  arc (log)> (load "trace/trace.arc")
  nil
  arc (log)> (trace fact)
  *** tracing fact
  nil
  arc (log)> (fact 5)
  1. Trace: (fact 5)
    2. Trace: (fact 4)
      3. Trace: (fact 3)
        4. Trace: (fact 2)
          5. Trace: (fact 1)
            6. Trace: (fact 0)
            6. Trace: fact ==> 1
          5. Trace: fact ==> 1
        4. Trace: fact ==> 2
      3. Trace: fact ==> 6
    2. Trace: fact ==> 24
  1. Trace: fact ==> 120
  120
  arc (log)> :a
  ;;; Ending transcription
  done
  arc> :a

  $ cat test
  ;;; Transcript of Arc REPL session on 28 February 2010 at 12:30 am GMT

  ; arc> (+ 1 2)
  3
  ; arc> (def fact (n) (if (<= n 0) 1 (* n (fact (- n 1)))))
  #<procedure: fact>
  ; arc> (fact 5)
  120
  ; arc> (load "trace/trace.arc")
  nil
  ; arc> (trace fact)
  *** tracing fact
  nil
  ; arc> (fact 5)
  1. Trace: (fact 5)
    2. Trace: (fact 4)
      3. Trace: (fact 3)
        4. Trace: (fact 2)
          5. Trace: (fact 1)
            6. Trace: (fact 0)
            6. Trace: fact ==> 1
          5. Trace: fact ==> 1
        4. Trace: fact ==> 2
      3. Trace: fact ==> 6
    2. Trace: fact ==> 24
  1. Trace: fact ==> 120
  120
  ; arc> :a

  ;;; Transcript stopped on 28 February 2010 at 12:31 am GMT
URL: http://bitbucket.org/fallintothis/transcribe/


4 points by shader 3486 days ago | link

You should put this on anarki.

Btw, how hard would it be to build trace in at a lower level, so that we can get more interesting error messages?

Maybe building in trace would be too much, but better debug info would be nice.

-----