Skip to content

Instantly share code, notes, and snippets.

@robkuz
Created December 12, 2017 15:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robkuz/8a29aacf064093c8f6589b8b397110c2 to your computer and use it in GitHub Desktop.
Save robkuz/8a29aacf064093c8f6589b8b397110c2 to your computer and use it in GitHub Desktop.
Some Code puzzle
Given the following definitions
|>> : map/fmap
v: NonEmptyList<SomeRecord>
SomeRecord: {foo: Option<_>; bar: Option<_>; baz: Option<_>}
isSomeList: SomeRecord -> List<bool, string>
//string: the name of the field
//bool: if Some then true else false
What does this code do?
v
|>> isSomeList
|> concat
|> List.countBy id
|>> snd
|> distinct
|> length
|> ((=) 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment