Counters are expected to land in Riak 1.4! See this pull-request.
h/t to @russelldb for the demo code.
| class Chapter | |
| include Mongoid::Document | |
| field :position, :type => Integer | |
| field :title, :type => String | |
| field :identifier, :type => String | |
| embedded_in :book | |
| embeds_many :elements | |
| def self.process!(git, file) |
| woop = { | |
| foo: "bar", | |
| qux: "baz" | |
| } | |
| woop.each.with_index do |(name, value), index| | |
| puts "#{index}: #{name} = #{value}" | |
| end |
| class Hello | |
| def self.first | |
| "Boo!" | |
| end | |
| private | |
| def self.second | |
| "Buh!" | |
| end |
Counters are expected to land in Riak 1.4! See this pull-request.
h/t to @russelldb for the demo code.
| module Main | |
| import Prelude.Algebra | |
| record GCounter : Type where | |
| MkGCounter : (value : Int) -> GCounter | |
| gcjoin : GCounter -> GCounter -> GCounter | |
| gcjoin l r = (MkGCounter ((value l) + (value r))) |
| -- In `f` we want to keep piping (part of) the result of one function into | |
| -- another, and stop as soon as something fails | |
| f :: [A] -> Either String (B, [A]) | |
| f xs = | |
| case f1 xs of | |
| Left s -> Left s | |
| Right (res1, xs') -> | |
| case f2 xs' of | |
| Left s -> Left s | |
| Right (res2, xs'') -> |