[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-hackers] Numbers egg interaction with other compiled code.

From: Tony Sidaway
Subject: [Chicken-hackers] Numbers egg interaction with other compiled code.
Date: Wed, 21 Oct 2009 23:53:11 +0100

Here's a bit of code that shows my problem.  This is with stock
chicken 4.1.0 and the latest release of numbers.egg

(module fred (export f)(import chicken scheme)
(declare (not usual-integrations))
(define (f n) (negative? n)))

Compile this, load it into csi and import.

> (f #b101010)
===> #f

> (f #b1010101010101010101010101010101010)
"Illegal number syntax" error because it's too big.

Okay, let's try bignums.

> (use numbers)
Error: (negative?) bad argument type: 11453246122

It doesn't seem to be expecting a bignum.

On the other hand:

> (negative? #b1010101010101010101010101010101010)
===> #f

What's going on?  I thought (not usual-integrations) would make sure
the redefined version of "negative?" would be picked up by code inside
module fred, but evidently this isn't the case, at least at the
default level of code optimization.

Is this a bug or do I just misunderstand how Scheme is supposed to work?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]