Created
July 3, 2009 10:10
-
-
Save jgouly/140040 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*** why-potion-4476f678fd22706ada7acf2c425c9336328b38c5/core/table.c 2009-07-01 00:07:26.000000000 +0100 | |
--- why-potion-4476f678fd22706ada7acf2c425c9336328b38c5-1/core/table.c 2009-07-03 11:04:06.000000000 +0100 | |
*************** PN potion_tuple_put(Potion *P, PN cl, PN | |
*** 204,209 **** | |
--- 204,216 ---- | |
return potion_table_put(P, PN_NIL, potion_table_cast(P, self), key, value); | |
} | |
+ PN potion_tuple_map(Potion *P, PN cl, PN self, PN block) { | |
+ PN_TUPLE_EACH(self, i, v, { | |
+ potion_tuple_put(P, cl, self, PN_NUM(i), PN_CLOSURE(block)->method(P, block, self, v)); | |
+ }); | |
+ return self; | |
+ } | |
+ | |
PN potion_tuple_print(Potion *P, PN cl, PN self) { | |
PN_TUPLE_EACH(self, i, v, { | |
potion_send(v, PN_print); | |
*************** void potion_table_init(Potion *P) { | |
*** 265,270 **** | |
--- 272,278 ---- | |
potion_type_callset_is(tpl_vt, PN_FUNC(potion_tuple_put, "index=N,value=o")); | |
potion_method(tpl_vt, "at", potion_tuple_at, "index=N"); | |
potion_method(tpl_vt, "each", potion_tuple_each, "index=N"); | |
+ potion_method(tpl_vt, "map", potion_tuple_map, "index=N"); | |
potion_method(tpl_vt, "clone", potion_tuple_clone, 0); | |
potion_method(tpl_vt, "first", potion_tuple_first, 0); | |
potion_method(tpl_vt, "join", potion_tuple_join, 0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment