Changes between Version 1 and Version 2 of LambdasVsPatternMatching


Ignore:
Timestamp:
Jul 5, 2012 1:22:20 PM (22 months ago)
Author:
jeltsch
Comment:

added notes regarding arrow notation (proc expressions)

Legend:

Unmodified
Added
Removed
Modified
  • LambdasVsPatternMatching

    v1 v2  
    1616}}} 
    1717However, when this situation nests (e.g. monadic bind) and variables have the same type, naming becomes painful and often degrades to not-so-meaningful ```meaningfulName1```, ```meaningfulName2```, ... 
     18 
     19A similar problem exists with {{{proc}}} expressions from arrow notation, which can be regarded as generalized lambda expressions. We sometimes have expressions of the following structure: 
     20{{{ 
     21proc meaningfulName -> case meaningfulName of 
     22    Pat1 -> ... 
     23    Pat2 -> ... 
     24}}} 
     25Here, the dots stand for arrow expressions, not ordinary expressions. 
    1826 
    1927== The proposals == 
     
    3947    * Looks weird (no hint of being a lambda abstraction) 
    4048    * Single-argument solution (see the note) 
     49    * Cannot be generalized to cover also {{{proc}}} expressions 
    4150 
    4251=== !LambdaCase: ```\case``` === 
     
    5867  * Pros 
    5968    * No conflicts with the current syntax (the sequence ```\ case``` is illegal) 
     69    * An analog syntax for {{{proc}}} expressions can be gained by replacing {{{\}}} with {{{proc}}} 
    6070  * Cons 
    6171    * Single-argument solution (see the note). One way to extend it to support multiple arguments is 
     
    7989  * Pros 
    8090    * Multi-argument solution (see the note) 
     91    * An analog syntax for {{{proc}}} expressions can be gained by replacing {{{\}}} with {{{proc}}} 
    8192  * Cons 
    8293    * Breaks current idioms. For example, 
     
    105116    * No conflicts with the current syntax 
    106117    * Multi-argument solution (see the note) 
     118    * An analog syntax for {{{proc}}} expressions can be gained by replacing {{{\}}} with {{{proc}}} 
    107119  * Cons 
    108120    * Deciding on the keyword may take years