From 9ec39fd590902fcc811d002c3f9c9c208021964f Mon Sep 17 00:00:00 2001 From: Jon Rafkind Date: Mon, 14 Nov 2011 16:49:47 -0700 Subject: [PATCH] [honu] add format and a facility to convert floats to integers --- collects/honu/main.rkt | 2 ++ collects/honu/private/common.rkt | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/collects/honu/main.rkt b/collects/honu/main.rkt index 0251e03a6a..16bb004d00 100644 --- a/collects/honu/main.rkt +++ b/collects/honu/main.rkt @@ -24,6 +24,8 @@ length substring void + format + integer (rename-out [honu-cond cond] [null empty] [current-inexact-milliseconds currentMilliseconds] diff --git a/collects/honu/private/common.rkt b/collects/honu/private/common.rkt index 4d95647a0c..8861e047f6 100644 --- a/collects/honu/private/common.rkt +++ b/collects/honu/private/common.rkt @@ -10,6 +10,11 @@ (provide sqr) (define (sqr x) (* x x)) +;; convert a float to an integer +(provide integer) +(define (integer x) + (inexact->exact (round x))) + (provide honu-cond) (define-honu-syntax honu-cond (lambda (code context)