[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: SRFI-151 (Bitwise Operations) Implementation
From: |
John Cowan |
Subject: |
Re: SRFI-151 (Bitwise Operations) Implementation |
Date: |
Thu, 9 Jan 2020 12:50:37 -0500 |
On Thu, Jan 9, 2020 at 7:55 AM Frank Terbeck <address@hidden> wrote:
Linus Björnstam wrote:
> > Your bitwise-nand etc takes more arguments than they have to. They are
> > 2-argument procedures according to the spec, which gives you better
> performance
> > than the apply-dance you are doing now. Maybe have a bitwise-nand and a
> > bitwise-nand*?
>
> Yeah, I did that on purpose. The performance argument is probably valid,
> though. However, I don't want to extend the API. Maybe I'll put in a
> case-lambda there.
>
The reason bitwise-nand and friends have only two arguments (and this comes
from Olin's original) is that they aren't associative: it's ambiguous
whether (bitwise-nand a b c) means (bitwise-nand (bitwise-nand a b) c) or
(bitwise-nand a (bitwise-nand b c)), and these are *not* equivalent.
Rather than choosing one of these arbitrarily, users have to say what they
mean.
John Cowan http://vrici.lojban.org/~cowan address@hidden
Any sufficiently-complicated C or Fortran program contains an ad-hoc,
informally-specified bug-ridden slow implementation of half of Common Lisp.
--Greenspun's Tenth Rule of Programming (rules 1-9 are unknown)