Transformation of Imperative Statements into Functional Expressions
暂无分享,去创建一个
DURING THE LAST FEW YEARS THERE HAS BEEN A STRONG INTEREST IN HIGH LEVEL FUNCTIONAL PROGRAMMING LANGUAGES, SUCH AS HOPE, MIRANDA, AND ML. IN CONTRAST TO THE IMPERATIVE PROGRAMMING LANGUAGES WHERE SIDE EFFECTS ARE SUPPORTED AS THE PRIMARY METHOD OF CHANGING THE STATE OF A TAS, THESE LANG- UAGES FORCE REFERENTIAL TRANSPARENCY BY USING THE LAMBDA ABSTRANCTION CON- STRUCT AS THE ONLY WAY TO INTRODUCE VARIABLE BINDINGS. THESE FUNCTIONAL LANGUAGES ARE BUILT ON TOP OF THE LAMBDA CALCULUS, BUT THEY ALSO PROVIDE SOME ADVANCED FEATURES, LIKE POLYMORPHIC TYPE CHECKING AND PATTERN MATCHING FOUND IN MODERN HIGH LEVEL PROGRAMMING LANGUAGES. THE LAMBDA CALCULUS IS AS EXPRESSIVE AS CONVENTIONAL IMPERATIVE LANGU- AGES AND HAS THE ADVANTAGE OF A SIMPLE, UNIFORM SYNTAX AND SEMANTICS. SIM- PLICITY AND UNIFORMITY ARE HIGHLY DESIRABLE BECAUSE THEY REDUCE THE CHANCES OF ERRORS DURING PROGRAMMING AND OFTEN MAKE THE CODE EASY TO UNDERSTAND AND DEBUG. THESE FEATURES ALSO FACILITATE THE PROOFS ABOUT PROGRAMS. FUNCTIONAL LANGUAGES ARE ALSO SUITABLE FOR CONCURRENT SYSTEMS, BECAUSE PARALLEL GRAPH REDUCTION METHODS ARE VERY SIMPLE AND EFFICIENT. THERE ARE SOME CASES THOUGH, WHERE IMPERATIVE PROGRAMMING SEEMS MORE APPROPRIATE AND NATURAL. FOR EXAMPLE, IT IS DIFFICULT TO EXPRESS IN FUNCTIONAL NOTATION A SEQUENCE OF ACTIONS THAT MUST BE PERFORMED IN A STRICT ORDER. TO SPECIFY SUCH A SEQUENCE OF ACTIONS A COMPLICATED EXPRESSION WITH LAMBDA ABSTRACTIONS MUST