summary refs log tree commit diff stats
path: root/lib/system.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <andreas@andreas-desktop>2009-12-07 01:21:35 +0100
committerAndreas Rumpf <andreas@andreas-desktop>2009-12-07 01:21:35 +0100
commit90119066adf6a9a2e8d779d4955637c6dd99aba3 (patch)
treef05e2bbf6aad693cc8455ff5e51b33dd5ec7ed6d /lib/system.nim
parent196ef92c86d8b8971d4b316f7c18e404842c4b9b (diff)
downloadNim-90119066adf6a9a2e8d779d4955637c6dd99aba3.tar.gz
version 0.8.5: bugfixes; compiler now maintained in Nimrod
Diffstat (limited to 'lib/system.nim')
-rwxr-xr-xlib/system.nim5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/system.nim b/lib/system.nim
index 9a64362c5..174d739cd 100755
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -1120,6 +1120,11 @@ proc find*[T, S: typeDesc](a: T, item: S): int {.inline.}=
     inc(result)
   result = -1
 
+proc contains*[T](a: openArray[T], item: T): bool {.inline.}=
+  ## Returns true if `item` is in `a` or false if not found. This is a shortcut
+  ## for ``find(a, item) >= 0``.
+  return find(a, item) >= 0
+
 proc pop*[T](s: var seq[T]): T {.inline, noSideEffect.} = 
   ## returns the last item of `s` and decreases ``s.len`` by one. This treats
   ## `s` as a stack and implements the common *pop* operation.