I'm sure this must be a stupid question: why are !count-parallel and !count
both defined as nullable, whereas other similar (parallel) aggs (sum, max,
min) are not? Is it to prevent count from counting nulls? And yet one
can call (count ...) without the prefix, and one can count ?foo or !foo, so
I'm at a loss to explain the syntax/meaning of the ! prefix on the count
function itself.

Mike

Search Discussions

  • Nathan Marz at Nov 10, 2011 at 7:02 pm
    The ! prefixing !count has nothing to do with it being "nullable", It's
    actually just a regular aggregator that I didn't have a better name for.
    Usage of !count looks like this:

    (<- [?count] (source !val) (c/!count !val :> ?count))

    !count takes in one input variable. Null values are interpreted as "0" and
    non-null values are interpreted as "1". !count returns the sum of those
    interpreted values. So !count counts the number of non-null values for that
    variable.

    -Nathan

    On Thu, Nov 10, 2011 at 10:35 AM, R Daneel wrote:

    I'm sure this must be a stupid question: why are !count-parallel and
    !count both defined as nullable, whereas other similar (parallel) aggs
    (sum, max, min) are not? Is it to prevent count from counting nulls? And
    yet one can call (count ...) without the prefix, and one can count ?foo or
    !foo, so I'm at a loss to explain the syntax/meaning of the ! prefix on the
    count function itself.

    Mike

    --
    Twitter: @nathanmarz
    http://nathanmarz.com
  • R Daneel at Nov 10, 2011 at 7:11 pm
    Thanks! Why does calling c/count also work without the prefix?
  • Nathan Marz at Nov 10, 2011 at 7:12 pm
    They're completely different functions. c/count will return the count,
    regardless of whether values are null or not. c/!count only returns the
    count of non-null values.
    On Thu, Nov 10, 2011 at 11:11 AM, R Daneel wrote:

    Thanks! Why does calling c/count also work without the prefix?


    --
    Twitter: @nathanmarz
    http://nathanmarz.com
  • R Daneel at Nov 10, 2011 at 7:16 pm
    Aha! Thanks!

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcascalog-user @
categoriesclojure, hadoop
postedNov 10, '11 at 6:35p
activeNov 10, '11 at 7:16p
posts5
users2
websiteclojure.org
irc#clojure

2 users in discussion

R Daneel: 3 posts Nathan Marz: 2 posts

People

Translate

site design / logo © 2021 Grokbase