unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Kevin Ryde <user42@zip.com.au>
Cc: bug-guile@gnu.org
Subject: Re: garbled documentation
Date: Fri, 09 Jan 2004 08:06:28 +1000	[thread overview]
Message-ID: <87ekuaf63f.fsf@zip.com.au> (raw)
In-Reply-To: 200312311825.hBVIPB42016073@pc18.math.umbc.edu

"Rouben Rostamian" <rostamian@umbc.edu> writes:
>
>  - Scheme Procedure: bit-set*! v kv obj
>  - C Function: scm_bit_set_star_x (v, kv, obj)
>
> This description is garbled.  The procedure arguments are listed
> as "v kv obj" while the description refers to "uve, BV, BOOL", etc.

Yep.  It's not really as clear as it could be either.

> In fact, most descriptions under the section "Bit Vectors" suffer from
> the same problem.

I made a bit of a revision:


Bit Vectors
-----------

Bit vectors are a specific type of uniform array: an array of booleans
with a single zero-based index.

They are displayed as a sequence of `0's and `1's prefixed by `#*',
e.g.,

     (make-uniform-vector 8 #t #f) =>
     #*00000000

 - Scheme Procedure: bit-count bool bitvector
 - C Function: scm_bit_count (bool, bitvector)
     Return a count of entries in BITVECTOR equal to BOOL.  For example,

          (bit-count #f #*000111000)  => 6

 - Scheme Procedure: bit-position bool bitvector start
 - C Function: scm_bit_position (bool, bitvector, start)
     Return the index of the first occurrance of BOOL in BITVECTOR,
     starting from START.  If there is no BOOL entry between START and
     the end of BITVECTOR, then return `#f'.  For example,

          (bit-position #t #*000101 0)  => 3
          (bit-position #f #*0001111 3) => #f

 - Scheme Procedure: bit-invert! bitvector
 - C Function: scm_bit_invert_x (bitvector)
     Modify BITVECTOR by replacing each element with its negation.

 - Scheme Procedure: bit-set*! bitvector uvec bool
 - C Function: scm_bit_set_star_x (bitvector, uvec, bool)
     Set entries of BITVECTOR to BOOL, with UVEC selecting the entries
     to change.

     If UVEC is a bit vector, then those entries where it has `#t' are
     the ones in BITVECTOR which are set to BOOL.  When BOOL is `#t'
     it's like UVEC is OR'ed into BITVECTOR.  Or when BOOL is `#f' it
     can be seen as an ANDNOT.

          (define bv #*01000010)
          (bit-set*! bv #*10010001 #t)
          bv
          => #*11010011

     If UVEC is a uniform vector of unsigned long integers, then
     they're indexes into BITVECTOR which are set to BOOL.

          (define bv #*01000010)
          (bit-set*! bv #u(5 2 7) #t)
          bv
          => #*01100111

 - Scheme Procedure: bit-count* bitvector uvec bool
 - C Function: scm_bit_count_star (bitvector, uvec, bool)
     Return a count of entries in BITVECTOR which are equal to BOOL,
     with UVEC selecting the entries to consider.

     UVEC is interpreted in the same way as `bit-set*!' above.  Namely,
     if UVEC is a bit vector then entries which have `#t' there are
     considered in BITVECTOR.  Or if UVEC is a uniform vector of
     unsigned long integers then it's the indexes in BITVECTOR to
     consider.

     For example,

          (bit-count* #*01110111 #*11001101 #t) => 3
          (bit-count* #*01110111 #u(7 0 4) #f)  => 2



_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-guile


      reply	other threads:[~2004-01-08 22:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-31 18:25 garbled documentation Rouben Rostamian
2004-01-08 22:06 ` Kevin Ryde [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ekuaf63f.fsf@zip.com.au \
    --to=user42@zip.com.au \
    --cc=bug-guile@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).