[CM] Notes from the Metalevel text

Randolph Latimer rdlatimer at tjhsst.edu
Thu May 7 07:29:55 PDT 2009


Is it possible that the Windows version has bugs as far as loading scm
progs from within cm?

I'm getting strange error messages for simple files from Chap 7.

For example..
chap7.scm     (I think that's an ok file name?)

(define x 1)       

(define (scale-hz hz mul)
  (* hz (expt 2 mul)))             <--- If I save this, then load (see
below) from cm, this may work ok, but when
                                         I add in the next function, then
resave, I may get error messages

(define lowest-freq 6.875)

(define (keynum->hertz knum)
  (* lowest-freq (expt 2 (/ (+ knum 3) 12))))



cm>(load "chap7.scm")      <--- sometimes loads ok, sometimes gives strange
error messages

I'm using Vim, but seems to act oddly also with xemacs 

I'm in Windows

Do you think the cm for windows may be a little buggy, loading scm files
this way? or maybe it's something I'm doing?




On Thu, 7 May 2009 08:29:07 -0500, Heinrich Taube <taube at uiuc.edu> wrote:
> On May 7, 2009, at 7:39 AM, Randolph Latimer wrote:
> 
>> Okay, thanks for the update. I'd prefer to keep with CM3, keep  
>> current.
>> Perhaps there are equivalent functions/variables in CM3 for CM2 items,
>> such as
>>  (pwd)  -> (cwd)  and (cd) -> (chdir)
> 
> i guess maybe i should add the old names back, this wasnt intended to  
> change. for now you can do
> 	(define pwd cwd)
> 	(define cd chdir)
> 
> 
>>  let me know if there are equivalents to *scale*, (hertz..)   
>> (keynum...)
> 
> in general cm3 names are terser (you want to keep typing down when you  
> send things interactively )
> 
> hertz -> hz
> keynum -> key
> 
> you dont need *scale* anymore, a scale is just a list of (probably  
> floating point) key numbers. if you want to define your own scales you  
> can use the handy 'scale' function, for example this will define a  
> just major scale  on middle C over two octaves (15 steps):
> 
> (define just-c-major
>    (let ((just-major '(9/8 10/9 16/15 9/8 10/9 9/8 16/15)))
>      (scale 15 60 (ratio->steps just-major)))
> 
> since a scale is list you can do anything you want with it, eg
> 
> (list-ref just-c-major 7)
> (pick just-c-major)
> (make-cycle just-c-major)
> 
>> (new...)
> 
> there are no objects. just use lists to hold your data. to send data  
> somewhere use one of the send methods or its underlyin function, eg
> 
> (mp:midi :key 90)
> (send "mp:midi" :key (between 60 90))
> 
> 
>> These are nice examples in the text, it'd be good to be able to keep
>> similar examples, just update the syntax
> 
> 
> its on my todo list, but unfortunately that list is infinately long.  
> ill do some this summer, if you figure things out send them to me so i  
> dont have to do it



More information about the Cmdist mailing list