
Hi in C type languages a function must be declared before its application. Would I be right in thinking that this isn't the case in Functional languages? For example: transmit :: String -> String transmit = decode . channel . encode channel :: [[Int]] -> [[Int]] channel = id Cheers, Paul

On Sat, 2007-09-29 at 17:58 +0100, PR Stanley wrote:
Hi in C type languages a function must be declared before its application. Would I be right in thinking that this isn't the case in Functional languages? For example: transmit :: String -> String transmit = decode . channel . encode channel :: [[Int]] -> [[Int]] channel = id
It's not the case in Haskell. Not only is the above valid, but so is: transmit = decode . channel . encode channel :: [[Int]] -> [[Int]] transmit :: String -> String channel = id

On Sat, Sep 29, 2007 at 12:05:01PM -0500, Derek Elkins wrote:
On Sat, 2007-09-29 at 17:58 +0100, PR Stanley wrote:
Hi in C type languages a function must be declared before its application. Would I be right in thinking that this isn't the case in Functional languages? For example: transmit :: String -> String transmit = decode . channel . encode channel :: [[Int]] -> [[Int]] channel = id
It's not the case in Haskell. Not only is the above valid, but so is:
transmit = decode . channel . encode
channel :: [[Int]] -> [[Int]]
transmit :: String -> String
channel = id
It is, however, the case in other functional languages like ML. Declaration-before-use, as a design decision, is independant of functionality. Stefan
participants (3)
-
Derek Elkins
-
PR Stanley
-
Stefan O'Rear