Yet another basic question

Discussion of Scheme and Racket
Post Reply
keval
Posts: 6
Joined: Tue Apr 28, 2009 10:06 pm

Yet another basic question

Post by keval » Tue Jun 02, 2009 8:38 pm

Greetings.
I'm working my way through "Structure and Interpretation of Computer Programs" and am working on a program that calls for the use of the primitive "runtime" as a way to measure how long it took the computer to calculate the answer. Unfortunately, my version of Scheme doesn't recognize "runtime." Any ideas on solutions or work-arounds?
Thanks,
Kevin

Paul Donnelly
Posts: 148
Joined: Wed Jul 30, 2008 11:26 pm

Re: Yet another basic question

Post by Paul Donnelly » Wed Jun 03, 2009 12:56 am

What version of Scheme is that? Consult its documentation for an equivalent function. For example, PLT Scheme seems to provide TIME-APPLY.

keval
Posts: 6
Joined: Tue Apr 28, 2009 10:06 pm

Re: Yet another basic question

Post by keval » Wed Jun 03, 2009 9:31 am

I'm using Dr. Scheme.

gugamilare
Posts: 406
Joined: Sat Mar 07, 2009 6:17 pm
Location: Brazil
Contact:

Re: Yet another basic question

Post by gugamilare » Wed Jun 03, 2009 10:46 am

keval wrote:I'm using Dr. Scheme.
DrScheme is an interactive, integrated, graphical programming environment that is included with PLT Scheme.
You can use time-apply.

keval
Posts: 6
Joined: Tue Apr 28, 2009 10:06 pm

Re: Yet another basic question

Post by keval » Wed Jun 03, 2009 9:35 pm

I think that's it. Can you give me a quick and dirty example of how to use time-apply? It seems to want two arguments (first a procedure, then a list). It's not following the same form as "runtime."
Many thanks

Paul Donnelly
Posts: 148
Joined: Wed Jul 30, 2008 11:26 pm

Re: Yet another basic question

Post by Paul Donnelly » Thu Jun 04, 2009 1:49 pm

keval wrote:I think that's it. Can you give me a quick and dirty example of how to use time-apply? It seems to want two arguments (first a procedure, then a list). It's not following the same form as "runtime."
Many thanks
It works just like regular apply.

Code: Select all

(foo 'a 'b 'c) is the same as (apply foo '(a b c))
TIME-APPLY just does timing on top of applying.

keval
Posts: 6
Joined: Tue Apr 28, 2009 10:06 pm

Re: Yet another basic question

Post by keval » Thu Jun 04, 2009 8:20 pm

That's got it.
Thanks loads,
Kevin

duncan
Posts: 31
Joined: Wed May 27, 2009 9:07 pm

Re: Yet another basic question

Post by duncan » Sat Jun 20, 2009 11:40 am

Luckily there's not a lot of implementation specific stuff in SICP, so you can probably use any Scheme you want. But I think it was written with MIT scheme in mind. MIT scheme is free (and actually it was one of the really early pieces of free software in the FSF sense- I think Sussman is still on the FF board.)

Anyway, I doubt you'll run into a lot of issues like this in SICP, so there's no big reason to switch if you like Dr. Ed, etc. But you could also use MIT Scheme. You'd probably want to use Emacs for that, but I think it's not a bad idea to get used to emacs if you want to do Lisp. I've never been very crazy about Dr. Scheme's user interface, and I find it hard to imagine actually doing real work in it, though YMMV.

Anyway, like I said, it probably doesn't make much difference. I actually got a friend of mine going in CL by installing Lispworks on his laptop and then working through the first parts of SICP in CL with him. Part of what's nice about SICP is that it deals in the eternal verities a lot more than it deals in the specifics of the platform.

Post Reply