cleanup old allany.nim example

This commit is contained in:
Andreas Rumpf 2018-05-28 19:45:12 +02:00
commit cd1b0aa87e

View file

@ -1,22 +1,20 @@
# All and any # All and any
template all(container, cond: untyped): bool = template all(container, cond: untyped): bool =
block: var result = true
var result = true for it in items(container):
for it in items(container): if not cond(it):
if not cond(it): result = false
result = false break
break result
result
template any(container, cond: untyped): bool = template any(container, cond: untyped): bool =
block: var result = false
var result = false for it in items(container):
for it in items(container): if cond(it):
if cond(it): result = true
result = true break
break result
result
if all("mystring", {'a'..'z'}.contains) and any("myohmy", 'y'.`==`): if all("mystring", {'a'..'z'}.contains) and any("myohmy", 'y'.`==`):
echo "works" echo "works"