view samples/hashset.tp @ 294:d1dc2d70bdfd

Move OS module out of backend Javascript into a proper module file. Add normal bytearray to bytearray module. Add read:to method to os module for reading into a bytearray.
author Michael Pavone <pavone@retrodev.com>
date Thu, 24 Jul 2014 21:58:26 -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"
			}
		}
	}
}