loading...

Discussion on: Daily Challenge #82 - English Beggars

Collapse
citizen428 profile image
Michael Kohl

Making new functions by composing others without mentioning the actual arguments. In this specific case I did it for the higher-order ones in the pipeline:

(fun (i, _) -> i % count) -> (fst >> (flip (%) count))

or

(fun (_, l) -> List.sumBy (snd) l) -> (snd >> List.sumBy (snd))

One could maybe justify the second one (though it's probably still harder to read than the corresponding lambda for most people), but the first one isn't even shorter than the lambda and I had to implement flip myself since it's not part of F#'s standard library.