[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: scheme (format) question
From: |
Mark Polesky |
Subject: |
Re: scheme (format) question |
Date: |
Sun, 22 Mar 2009 22:16:19 -0700 (PDT) |
> (define (my-format bool string . list-of-nums)
> (apply format bool string (map set-precision list-of-nums)))
>
> (let ((a 2.0)
> (b 1/4)
> (c 1/3))
> (my-format #t "~&~a ~a ~a" a b c))
Kjetil,
Awesome. Thanks. I knew there was something simple,
I just couldn't figure it out. That little dot helps
alot! And now for my next question...
Is there a way for a pair within an alist to retrieve
values from other pairs within the same alist? I know
the following code doesn't work, because "my-alist"
is still undefined when I'm calling it, but is there
a way to make it do what I want?
(define my-alist
`((a 1)
(b ,(+ 1 (cadr (assq 'a my-alist))))))
Thanks.
- Mark