Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Changeset [dc52e1d16eebfbca200add57115bf33d95f9962d] by Douglas Creager

Revision dc52e1d16eebfbca200add57115bf33d95f9962d, committed by Douglas Creager · November 19th, 2008 @ 11:32 PM

Functions defined in multiple branches

The CSPM parser now supports defining functions using multiple branches, such as:

length(<>) = 0 length(<_>^xs) = 1 + length(xs)

reverse(<>) = <> reverse(^xs) = reverse(xs) ^

(These two examples are included as test cases.) Since lambdas were already implemented using multiple pattern-based clauses, this patch only required syntax manipulations to create the right AST. No new evaluation logic was needed. http://github.com/hst/hst/commit...

5 changed files

  • M cspm/src/HST/CSPM/Definitions.lhs
  • M cspm/src/HST/CSPM/Parser.hs
  • M cspm/src/HST/CSPM/Parser.ly
  • M cspm/src/HST/CSPM/Types.hs
  • M cspm/tests/expressions/test-lambdas.sh