guile-user
[Top][All Lists]
Advanced

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

attempt to make a transparent binding


From: Oleg A. Paraschenko
Subject: attempt to make a transparent binding
Date: Mon, 6 Dec 2004 09:15:37 +0300

  Hello,

  I'm making a binding to a C program. One of the memory structures in
the program is a list which can contain sublists and strings. I'd like
to present this structure as the Scheme list in Guile, so the usual list
functions like 'car', 'cdr', 'for-each' etc would work.

  A trivial approach is to write a function (let name it "memory->list")
which creates a real Scheme list from the data. But I wonder if it is
possible to complicate things.

  First, the data in memory are big enough, and full instantiation of
lists wastes resources, especially because I use only small part of the
data. Instead, I'd like to have lazy instantiation. Let "memory->list"
returns a special type of pair in which car and cdr are instantiated on
demand. Is it possible?

  The second. Having Scheme data, I'd like to get the origin of this data
in the C program. Currently I think about mapping from SCMs to C
structures in C-Guile glue, but I'm afraid this is bad for garbage
collection.

  I'd be thankful for your comments and suggestions.

  Regards, Oleg




reply via email to

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