Mercurial > repos > tabletprog
view samples/hashset.tp @ 172:8d466c5a7dff
Fixed a few bugs. Improved the "symbol not found" error messages. Added a "signed?" method to integer objects
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 21 Aug 2013 07:59:34 -0700 |
parents | cbc92ee13f35 |
children |
line wrap: on
line source
#{ main <- { inset <- #["foo" "bar" "foobar" 1 2 3] notin <- #["baz" "qux" "bazqux" 4 5 6] myset <- sets hash foreach: inset :idx el { myset add: el } foreach: inset :idx el { if: (myset contains?: el) { print: "set contains " . el . "\n" } else: { print: "set doesn't contain " . el . "\n" } } foreach: notin :idx el { if: (myset contains?: el) { print: "set contains " . el . "\n" } else: { print: "set doesn't contain " . el . "\n" } } } }