We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents f849f73 + 1ee62f1 commit 5734356Copy full SHA for 5734356
examples/count.janet
@@ -0,0 +1,9 @@
1
+# total of values for which pos? results in truthy value
2
+(count pos? [math/-inf -1 0 1 math/pi]) # -> 2
3
+
4
+# multiple data structures can be handled
5
+(count (fn [x y] (neg? (+ x y))) [-1 -1 -1] [-1 0 1]) # -> 2
6
7
+# predicate may not be applied to all values (e.g. 99)
8
+(count |(pos? (* $0 $1 $2)) [-3 -2] [-1 0 99] [3 2]) # -> 1
9
0 commit comments