unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* bytevector seems to be missing in Guile
@ 2023-01-07 16:34 Sascha Ziemann
  2023-01-07 20:07 ` Matt Wette
  0 siblings, 1 reply; 7+ messages in thread
From: Sascha Ziemann @ 2023-01-07 16:34 UTC (permalink / raw)
  To: guile-user

Is the procedure "bytevector" missing in Guile?

I tried this:
guile --r7rs -c '(write (bytevector 1 2 3))'

R7RS defines it on page 49.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: bytevector seems to be missing in Guile
  2023-01-07 16:34 bytevector seems to be missing in Guile Sascha Ziemann
@ 2023-01-07 20:07 ` Matt Wette
  2023-01-07 21:12   ` Wolf
  0 siblings, 1 reply; 7+ messages in thread
From: Matt Wette @ 2023-01-07 20:07 UTC (permalink / raw)
  To: guile-user

On 1/7/23 8:34 AM, Sascha Ziemann wrote:
> Is the procedure "bytevector" missing in Guile?
>
> I tried this:
> guile --r7rs -c '(write (bytevector 1 2 3))'
>
> R7RS defines it on page 49.
>

maybe you need (import (rnrs bytevectors))




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: bytevector seems to be missing in Guile
  2023-01-07 20:07 ` Matt Wette
@ 2023-01-07 21:12   ` Wolf
  2023-01-07 21:56     ` Taylan Kammer
  0 siblings, 1 reply; 7+ messages in thread
From: Wolf @ 2023-01-07 21:12 UTC (permalink / raw)
  To: Matt Wette; +Cc: guile-user

[-- Attachment #1: Type: text/plain, Size: 715 bytes --]

On 2023-01-07 12:07:31 -0800, Matt Wette wrote:
> On 1/7/23 8:34 AM, Sascha Ziemann wrote:
> > Is the procedure "bytevector" missing in Guile?
> > 
> > I tried this:
> > guile --r7rs -c '(write (bytevector 1 2 3))'
> > 
> > R7RS defines it on page 49.
> > 
> 
> maybe you need (import (rnrs bytevectors))

I'm far from expert, but it looks to me like (bytevector) in particular is not
provided by guile.

I think the way in guile is

    #vu8(1 2 3)

Or you could make it from list of integers:

    (use-modules (rnrs bytevectors))
    (u8-list->bytevector '(1 2 3))

W.

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: bytevector seems to be missing in Guile
  2023-01-07 21:12   ` Wolf
@ 2023-01-07 21:56     ` Taylan Kammer
  2023-01-08  0:20       ` Robby Zambito
  0 siblings, 1 reply; 7+ messages in thread
From: Taylan Kammer @ 2023-01-07 21:56 UTC (permalink / raw)
  To: guile-user

On 07.01.2023 22:12, Wolf wrote:
> On 2023-01-07 12:07:31 -0800, Matt Wette wrote:
>> On 1/7/23 8:34 AM, Sascha Ziemann wrote:
>>> Is the procedure "bytevector" missing in Guile?
>>>
>>> I tried this:
>>> guile --r7rs -c '(write (bytevector 1 2 3))'
>>>
>>> R7RS defines it on page 49.
>>>
>>
>> maybe you need (import (rnrs bytevectors))
> 
> I'm far from expert, but it looks to me like (bytevector) in particular is not
> provided by guile.
> 
> I think the way in guile is
> 
>     #vu8(1 2 3)
> 
> Or you could make it from list of integers:
> 
>     (use-modules (rnrs bytevectors))
>     (u8-list->bytevector '(1 2 3))
> 
> W.
> 

IIRC you should be able to import (scheme bytevectors), which is R7RS.

The (rnrs bytevectors) module is R6RS.

-- 
Taylan




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: bytevector seems to be missing in Guile
  2023-01-07 21:56     ` Taylan Kammer
@ 2023-01-08  0:20       ` Robby Zambito
  2023-01-08 12:19         ` Sascha Ziemann
  0 siblings, 1 reply; 7+ messages in thread
From: Robby Zambito @ 2023-01-08  0:20 UTC (permalink / raw)
  To: guile-user

In R7RS, the bytevector constructor is exported by (scheme base) (not (scheme bytevector)). It seems like the confusion is caused by --r7rs not evaluating in an environment that provides (scheme base).



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: bytevector seems to be missing in Guile
  2023-01-08  0:20       ` Robby Zambito
@ 2023-01-08 12:19         ` Sascha Ziemann
  2023-01-08 20:35           ` Robby Zambito
  0 siblings, 1 reply; 7+ messages in thread
From: Sascha Ziemann @ 2023-01-08 12:19 UTC (permalink / raw)
  To: guile-user

Am So., 8. Jan. 2023 um 01:21 Uhr schrieb Robby Zambito
<contact@robbyzambito.me>:
>
> In R7RS, the bytevector constructor is exported by (scheme base) (not (scheme bytevector)). It seems like the confusion is caused by --r7rs not evaluating in an environment that provides (scheme base).
>

Thanks, this helps!

But quote from R7RS page 29:

> For convenience and ease of use, the
> global Scheme environment in a REPL must not be empty,
> but must start out with at least the bindings provided by
> the base library.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: bytevector seems to be missing in Guile
  2023-01-08 12:19         ` Sascha Ziemann
@ 2023-01-08 20:35           ` Robby Zambito
  0 siblings, 0 replies; 7+ messages in thread
From: Robby Zambito @ 2023-01-08 20:35 UTC (permalink / raw)
  To: guile-user


Sascha Ziemann <ceving@gmail.com> writes:

> But quote from R7RS page 29:
>
>> For convenience and ease of use, the
>> global Scheme environment in a REPL must not be empty,
>> but must start out with at least the bindings provided by
>> the base library.

Yes I think it's a bug (or at least misleading) that using --r7rs
doesn't import (scheme base). I dug around to see what that flag
actually does. All it does is call (install-r7rs!), which adds .sld to
the load extensions and sets some reader settings.

The documentation isn't technically wrong, since there is /a/ base
library (notice write isn't missing), it's just that there are several
"base" libraries: (guile), (scheme base), and (rnrs base), and the "base
library" is referring to the first one. I think it would be ideal for
--r7rs to use (scheme base) as the base library and for --r6rs to use
(rnrs base) or (rnrs) as the base library.



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-01-08 20:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-07 16:34 bytevector seems to be missing in Guile Sascha Ziemann
2023-01-07 20:07 ` Matt Wette
2023-01-07 21:12   ` Wolf
2023-01-07 21:56     ` Taylan Kammer
2023-01-08  0:20       ` Robby Zambito
2023-01-08 12:19         ` Sascha Ziemann
2023-01-08 20:35           ` Robby Zambito

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).