This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Tuple types
- To: guile at sourceware dot cygnus dot com
- Subject: Tuple types
- From: Diego Dainese <ddainese at dsi dot unive dot it>
- Date: 23 Apr 2000 14:45:52 +0200
Hi,
Python has a type 'tuple' that can be automatically unpacked when
assigned:
tup = 1, "pippo"
num, name = tup
print num
print name
This is very useful when a tuple is used as return argument of
function; it would be nice if Guile supports some sort of tuple types
too.
My idea is to define a 'let'-like special form that permit more that
one variable name in a single binding, and if so unpack the init
argument that must be of type tuple; in example:
(let-tuple* ((tup (tuple 1 "pippo"))
(num name tup))
(display num)
(display name))
--
Diego Dainese