(define my-alist
'((a . 1)
))
(set! my-alist (acons 'b 2 my-alist))
my-alist ==> ((b . 2) (a . 1))
(define (alist-prepend alist key value)
(set! alist (acons key value alist)))
(alist-prepend my-alist 'c 3)
my-alist ==> ((b . 2) (a . 1))
How can
> (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. T
;; Hi.
;;
;; How can I change the following code so that
;; it returns "2 0.25 0."? That is: return
;; integers without decimal point, otherwise
;; round to as many decimal places as needed,
;; but not more than 4.
(let ((a 2.0)
(b 1/4)
(c 1/3))
(format #t "~&~a ~a ~a" a b c))