App-RecordStream

 view release on metacpan or  search on metacpan

lib/App/RecordStream/DomainLanguage.pm  view on Meta::CPAN

   mr_agg(<snippet>, <snippet>[, <snippet>])
   mr_aggregator(<snippet>, <snippet>[, <snippet>])
      __FORMAT_TEXT__
      Take a map snippet, a reduce snippet, and an optional squish snippet to
      produce an ad-hoc aggregator based on map reduce.  The map snippet takes
      \$r representing a record and returns its mapped value.  The reduce
      snippet takes \$a and \$b representing two mapped values and combines
      them.  Finally, the squish snippet takes a mapped value \$a representing
      all the records and produces the final answer for the aggregator.

      Example(s):
      __FORMAT_TEXT__
         Track count and sum to produce average:
            mr_agg(<<[1, {{ct}}]>>, <<[\$a->[0] + \$b->[0], \$a->[1] + \$b->[1]]>>, <<\$a->[1] / \$a->[0]>>)

   rec()
   record()
      __FORMAT_TEXT__
      A valuation that just returns the entire record.
      __FORMAT_TEXT__

   snip(snip)
      __FORMAT_TEXT__
      Takes a snippet and returns both the snippet and the snippet as a
      valuation.  Used to distinguished snippets from scalars in cases where it
      matters, e.g.  min('{{x}}') interprets it is a keyspec when it was meant
      to be a snippet (and then a valuation), min(snip('{{x}}')) does what is
      intended.  This is used internally by <<...>> and in fact <<...>> just
      translates to snip('...').
      __FORMAT_TEXT__

   subset_agg(<snippet>, <aggregator>)
   subset_aggregator(<snippet>, <aggregator>)
      __FORMAT_TEXT__
      Takes a snippate to act as a record predicate and an aggregator and
      produces an aggregator that acts as the provided aggregator as run on the
      filtered view.

      Example(s):
      __FORMAT_TEXT__
          An aggregator that counts the number of records with a time not above 6 seconds:
             subset_agg(<<{{time_ms}} <= 6000>>, ct())

   type_agg(obj)
   type_scalar(obj)
   type_val(obj)
      __FORMAT_TEXT__
      Force the object into a specific type.  Can be used to force certain
      upconversions (or avoid them).
      __FORMAT_TEXT__

   valuation(sub { ... })
   val(sub { ... })
      __FORMAT_TEXT__
      Takes a subref, creates a valuation that represents it.  The subref will
      get the record as its first and only argument.
      __FORMAT_TEXT__

      Example(s):
         To get the square of the "x" field:
            val(sub{ \$[0]->{x} ** 2 })

   xform(<aggregator>, <snippet>)
      __FORMAT_TEXT__
      Takes an aggregator and a snippet and produces an aggregator the
      represents invoking the snippet on the aggregator's result.
      __FORMAT_TEXT__

      Example(s):
         To take the difference between the first and second time fields of the record collection:
            xform(recs(), <<{{1/time}} - {{0/time}}>>)
HELP
}

1;



( run in 0.814 second using v1.01-cache-2.11-cpan-5735350b133 )