Gee Is zip function usable?
- From: san hoi <hoisan49 gmail com>
- To: libgee-list gnome org
- Subject: Gee Is zip function usable?
- Date: Fri, 30 Jul 2010 01:39:01 -0400
1) scala case:
val array1 = Array(1,2,3,4)
val array2 = Array(5,6,7,8)
println(array1.zip(array2).mkString(","))
=> (1,5),(2,6),(3,7),(4,8)
2) ruby case: (enum.c)
>> [1,2].zip([3,4])
=> [[1, 3], [2, 4]]
>> [1,2].zip([3,4], [5,6])
=> [[1, 3, 5], [2, 4, 6]]
3) boo case: (Builtins.cs)
http://github.com/bamboo/boo/blob/master/src/Boo.Lang/Builtins.cs
firstNames = ("Charles", "Joe", "P")
middleNames = ("Jr", "church", "son")
lastNames = ("Whittaker", "Manson", "Diddy")
x = zip(firstNames, middleNames, lastNames)
for y in x:
print join(y)
//print y[0], y[1]
4) python case: (from http://codepad.org/XCqnHdAe)
Alpha=[list(u"abcde__"),list(u"fghijkl"),list(u"mnopq__")]
Alpha.reverse()
for d in apply(zip, Alpha):
for i in d: print i,
print
zip function => transposed matrix is usable. I think so.
At least individually.
Is plan to implement zip function (or method) in libgee?
Regards.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]