Newsgroups: comp.lang.scheme
Path: cantaloupe.srv.cs.cmu.edu!rochester!udel!news.mathworks.com!uhog.mit.edu!bloom-beacon.mit.edu!gatech!howland.reston.ans.net!ix.netcom.com!netcom.com!bakul
From: bakul@netcom.com (Bakul Shah)
Subject: Re: bit manipulation operators in scheme?
Message-ID: <bakulCzA10M.G9D@netcom.com>
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
References: <3a0s1q$ej1@tweedledumb.cygnus.com> <BLUME.94Nov12114556@dynamic.cs.princeton.edu> <bakulCz7zK8.Cw@netcom.com> <3a74lc$f42@goanna.cs.rmit.oz.au>
Date: Mon, 14 Nov 1994 21:29:10 GMT
Lines: 29

ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) writes:

>bakul@netcom.com (Bakul Shah) writes:
>>Only in an ideal world.  How many people use 1's complement
>>machines these days?  Other than that it is easy to define bit
>>operations portably.

I should've said `it is easy to define bit operations (that can
be implemented efficiently on most machines) portably'.

>It is easy to *define* bit operations portably whether the underlying
>hardware uses 2s complement, 1s complement, sign-and-magnitude, decimal,
>biquinary, balanced ternary, or counting on its tentacles.  To start
>with, there is no reason why a Scheme program should know or care what
>the "word length" of the underlying hardware is (assuming it to have
>such a thing, not all computers have had "words").  It is not hard to
>all the bitwise operations in terms of bignum arithmetic, without any
>reference at all to the underlying hardware.  (I didn't say it's fast!)

Point taken.  But I hope you are not suggesting that a Scheme
_programmer_ should also not care about the underlying hardware.
It is unwise to assume all the world is a VAX/386/Turing machine
but it is equally unwise to not know what operations are
efficient on the hardware you have access to, especially when
many of the same operations are efficient to a similar degree on
99.9% of the computers in use.  I don't think the blackbox
approach works all that well.

Bakul Shah
