Functions are so central to functional programming that they get their own operators. This demonstrates function piping and composition:
-- basic version of a function with 3 steps-- takes in a string which is supposed to be numeric-- and creates a list of integers up to that numbercreateRangestr=List.range1(Result.withDefault0(String.toIntstr))-- the problem above is that it reads inside-out-- this piped equivalent reads just like my brain thinks of the stepscreateRangestr=str|>String.toInt|>Result.withDefault0|>List.range1-- composed "point-free" equivalentcreateRange=String.toInt>>Result.withDefault0>>List.range1
The last one is considered hard to understand at first. >> takes the output of the first function and provides it as an input to the second. Basically welding the functions together into one.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Functions are so central to functional programming that they get their own operators. This demonstrates function piping and composition:
The last one is considered hard to understand at first.
>>
takes the output of the first function and provides it as an input to the second. Basically welding the functions together into one.