[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: In search of cool Scheme
From: |
Harvey J. Stein |
Subject: |
Re: In search of cool Scheme |
Date: |
23 May 2001 11:22:59 -0400 |
"Hans O. Lowe" <address@hidden> writes:
> Sam & Klaus,
>
> I don't know about doing it with data stream and delayed evaluation,
> but I was thinking of something simple like this:
>
> (define (differentiate y)
> (if (list? y)
> (cond ((eq? (car y) '+) (cons '+ (map differentiate (cdr y))))
> ((eq? (car y) '-) (cons '- (map differentiate (cdr y))))
> ((eq? (car y) 'sin) (list '*
> (list 'cos (cadr y))
> (differentiate (cadr y))))
> (else 'y))
> (cond ((number? y) 0)
> ((eq? y 'x) 1)
> (else (list 'differentiate y)))))
>
> ;;; Try this:
> (display (differentiate '(4 x (sin u))))
Don't forget to add in a macro to do:
(let ((x 3) (u 4)) (eval (differentiate '(* x (sin u)))))
--
Harvey Stein
Bloomberg LP
address@hidden
Re: In search of cool Scheme, Klaus Schilling, 2001/05/22
- Re: In search of cool Scheme, Hans O. Lowe, 2001/05/22
- Re: In search of cool Scheme, Hans O. Lowe, 2001/05/23
- Re: In search of cool Scheme,
Harvey J. Stein <=
- Re: In search of cool Scheme, Hans O. Lowe, 2001/05/23
- Re: In search of cool Scheme, Harvey J. Stein, 2001/05/24
- Re: In search of cool Scheme, Harvey J. Stein, 2001/05/24
- Re: In search of cool Scheme, Hans O. Lowe, 2001/05/24
Re: In search of cool Scheme, Alex Shinn, 2001/05/22