Extracting numerical value from range

59 views
Skip to first unread message

Mirko Vukovic

unread,
Mar 29, 2015, 8:28:40 PM3/29/15
to scre...@googlegroups.com
Hi,

I wrote the following code to convert between Celsius and Fahrenheit scales:

(defun f<->c (&key f c)
  (let ((vf (a-real-betweenv -1e3 1e3 'f))
(vc (a-real-betweenv -1e3 1e3 'c)))
    (when f (assert! (=v vf f)))
    (when c (assert! (=v vc c)))
    (assert! (=v vf (+v (*v 9/5 vc) 32)))
    (list vf vc))) 

When I run it, I get an answer such as
SCREAMER-USER> (value-of (first (f<->c :c 100)))
[F real 212:212]

I am assuming that screamer has narrowed down the range of values 
to 212:212.

How can I extract the values?  Did I overlook something in the documentation,
or do I have to use solve?

Is there a better way to write this problem?

Thanks,

Mirko
Reply all
Reply to author
Forward
0 new messages