[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Gstrings
- From: Dirk Laurie <dpl@...>
- Date: Sun, 17 Apr 2011 15:51:02 +0200
Generalized strings (gstrings)
A gstring g is a list whose string representation is the
concatenation of the string representations of its values,
joined by g.sep. Other 'pairs' values of g are irrelevant.
Example:
t=gstring({true,'false'},'/')
print(gstring({0,t,math.sin},', ')) -->
0, true/false, function: 0x93e0700
z={1,{2,3},{{4,5},{{6,7,8},9}}}
print(gstring(z,{'\n', " ", ' + ', "*"})) -->
1
2 3
4 + 5 6*7*8 + 9
If all separators are empty, a gstring is a rope, see e.g.
http://lua-users.org/wiki/LuaRopes
Seen this generalization? Like it?
Dirk