[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Number question
From: |
Mario Domenech Goulart |
Subject: |
Re: [Chicken-users] Number question |
Date: |
28 Sep 2007 09:24:48 -0300 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 |
Hi William,
On Fri, 28 Sep 2007 08:19:24 -0400 William Ramsay <address@hidden> wrote:
> I'm trying to convert rgb values to hex strings. The algorithm to
> make the conversion is simple enough. The problem is that the math
> involved produces real numbers rather than whole numbers (i.e. I get
> 12.0 instead of just plain 12). When I try to use this number
> against a list of equivalent hex strings (i.e. position 12 is "C") I
> get an error because 12.0 is a bad argument type for a list-ref. How
> do I convert the 12.0 to 12?
You can use inexact->exact:
csi> (list-ref '(1 2 3) (inexact->exact 2.0))
3
Best wishes,
Mario