User loginNavigation 
Points in the Pattern Matching Design SpaceFunctional languages often have a pattern matching construct. The weakest form is destructuring: let (x,y) = f(z) in x+y The left hand side is an expression that usually constructs a data structure, but by using it in a pattern matching position the compiler emits code to perform the inverse of that operation: instead of constructing a pair, we destructure a pair. The general form is: let f(x) = y in ... The compiler inverts the operation f and emits this: let x = f^1(y) in ...
However, the operation f is not always surjective, that is the equation match ys with  [] > ...  x::xs > ...
The other limitation is that f is not always injective, that is the equation for abs(x) = y do print(x) For example if y is 2, then x gets bound to 2 and 2 in turn, iterating over all solutions. Note that we can generalise this to a general predicate: for P do ... Where P is a predicate. For example: for x in xs do ... To iterate over all pairs x in xs and y in ys where x for x in xs && y in ys && x < y do ... JMatch is an example of this kind of pattern matching. This raises the question which predicates can we use in a pattern match? For example: for prime(n) && n < 100 do ... We'd like this to iterate over the prime numbers that are smaller than 100, but how can we implement this? It is impossible to do this efficiently for any predicate, but how can we give the programmer the tools to implement the patterns he wants to use efficiently? Another extension of pattern matching is logic variables like in Prolog. This allows us to reason about incomplete information, where a part of a data structure is left unspecified. For example executing Futher extension is constraint programming, where we are not only able to leave out a part of a data structure, we can also specify partial information about a value. For example the constraint What is the state of the art in pattern matching and its extensions? How can we extend the scope of patterns that can be matched, and in which other ways can we increase the power of pattern matching? By Jules Jacobs at 20110122 21:27  LtU Forum  previous forum topic  next forum topic  other blogs  7187 reads

Browse archivesActive forum topics 
Recent comments
5 hours 49 min ago
6 hours 7 min ago
6 hours 10 min ago
2 days 2 hours ago
2 days 12 hours ago
2 days 19 hours ago
2 days 19 hours ago
3 days 3 hours ago
3 days 3 hours ago
3 days 6 hours ago