This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Tuple types


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]