Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Haskell: Point-free style

Point-free Style programming is a programming paradigm in functional programming, in which a function definition does not include information regarding its arguments, function is defined through function composition.

square x = x*x
add10Tox x = 10 +x

process = square.add10Tox

process function is defined in point-free style (don’t include any arguments). By using point-free style, we can develop program in compact and cleaner way.


process 10 = square.add10Tox 10 = square(add10Tox 10) = square (10 + 10) = square (20) = 400
*Main> let square x = x*x
*Main> let add10Tox x = 10 +x
*Main>
*Main> let process = square.add10Tox
*Main>
*Main> process 10
400
*Main> process 20
900



Previous                                                 Next                                                 Home


This post first appeared on Java Tutorial : Blog To Learn Java Programming, please read the originial post: here

Share the post

Haskell: Point-free style

×

Subscribe to Java Tutorial : Blog To Learn Java Programming

Get updates delivered right to your inbox!

Thank you for your subscription

×