Working on the Project Euler questions, I wanted to evaluate the
performance of different solutions to a problem. Staring out using
'time', I quickly found that it would be easier to calculate
performance in Scheme rather than copying and pasting the performance
results into a spreadsheet. With that in mind, I looked at how to use
the 'time-apply' function, and in particular how to get at individual
values.
It surprised me because the results external representation didn't
look like a list. Still, I figured it is a list, and tried to get the
'car', getting the error message error message:
(car (time-apply + '(1 2 3)))
Error: context expected 1 value, received 4 values: (6) 0 0 0
On close reading, I found that the documentation doesn't say that a
list of values is returned, just that 4 values are returned. Perhaps
it would be more obvious if it said "there are multiple return values
from this function".
Remembering that mzscheme can do multiple return values, I went back to this:
http://www.cs.rice.edu/CS/PLT/packages/doc/mzscheme/node7.htm
and found out how to get the values of 'time-apply'.
Is this is the right way to utilize 'time-apply'?