unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: steve tell <tell@telltronics.org>
Cc: Guile Mailing List <guile-user@gnu.org>
Subject: Re: logical shift operators in guile?
Date: Thu, 10 Jun 2010 00:45:21 +0200	[thread overview]
Message-ID: <m3bpbjq0zi.fsf@pobox.com> (raw)
In-Reply-To: <Pine.LNX.4.63.1006082248010.3432@ariel.telltronics.org> (steve tell's message of "Wed, 9 Jun 2010 00:04:41 -0400 (EDT)")

Hi Steve,

On Wed 09 Jun 2010 06:04, steve tell <tell@telltronics.org> writes:

> Does guile (1.8.x, or any version) have the integer logical shift
> operators, like C's << and >> ?

We have ash (arithmetic shift) but not lsh (logical shift). I admit I am
somewhat ignorant regarding when you would prefer lsh over ash. If it is
important (as it probably is) we should add lsh.

> While searching for those, I realized that what I was trying to do was
> represent small sets of booleans as the bits of an integer... and that
> somthing similar could be done in a more scheme-like fashion with
> bitvectors.
>
> But is there any way to copy the contents of bitvector a to another
> bitvector b of the same size, short of iterating over the elements?

There does not seem to be, though perhaps I am overlooking something.
There is array-copy!, but that is not implemented in the most efficient
way for contiguous uniform vectors like bitvectors. Would you like to
submit a patch to add bitvector-copy and/or bitvector-copy! ?

For my eye there's something still not right as far as bitvectors'
implementation. I guess I would prefer something with a bytevector as a
backing store... But that's a topic for another day.

Regards,

Andy
-- 
http://wingolog.org/



  reply	other threads:[~2010-06-09 22:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-09  4:04 logical shift operators in guile? steve tell
2010-06-09 22:45 ` Andy Wingo [this message]
2010-06-10  3:38   ` dsmich
2010-06-10 12:32 ` Thien-Thi Nguyen

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=m3bpbjq0zi.fsf@pobox.com \
    --to=wingo@pobox.com \
    --cc=guile-user@gnu.org \
    --cc=tell@telltronics.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).