guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Request to add *-resize! functions for contiguous mutable data structure


From: Vijay Marupudi
Subject: Request to add *-resize! functions for contiguous mutable data structures.
Date: Fri, 6 Aug 2021 09:33:04 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0

Hello!

I was curious if Guile would be willing to provide a series of
new procedures for resizing contiguous memory regions.

(bytevector-resize! <bytevector> new-size [fill])
(vector-resize! <vector> new-size [fill])

The [fill] parameter could be used if the new-size is bigger than
the current size.

This would make writing imperative code easier and more
performant. I acknowledge that it is not idiomatic Scheme to use
mutable data structures, however this is useful to me for
dealing with large amounts of text data, in which I need random
access and flexible data storage. It would allow me to move off
my custom C extension vector and allow me to use other
vector-* functions.

Ideally, this would use libc's `realloc` to make the resize
quick, so that it can avoid data copying whenever possible.

Regards

Vijay Marupudi
PhD Student in Human Centered-Computing
Georgia Tech



reply via email to

[Prev in Thread] Current Thread [Next in Thread]