(vector-set! bucket (truncate x) y)

From: Ron Stanonik <stanonik_at_cogsci.ucsd.edu>
Date: Fri, 11 Aug 2000 10:58:16 -0700

We're porting some code to stk which computes a bargraph.
We're using a vector to hold the bar values.
We truncate the x value to obtain the bargraph index.
Unfortunately, truncate doesn't return an integer, so vector-set! complains.
For example,

        (define bucket (make-vector 10 0))
        (vector-set! bucket (truncate 5.3) 11)

complains "bad index 5.0".

Indeed

        STk> (real? (truncate 5.3))
        #t

So, truncate isn't returning an integer. Sorry if this is a newbie
question, but how do I get an integer from a real?

We're running STk on RedHat.

        STk> (version)
        "4.0.1"

Thanks,

Ron Stanonik
stanonik_at_cogsci.ucsd.edu
Received on Fri Aug 11 2000 - 19:58:36 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST