" is the first character is treated as part of the program; all other lines are comment. In Bird-style you have to leave a blank before the code. > fact :: Integer -> Integer > fact 0 = 1 > fact n = n * fact (n-1) And you have to leave a blank line after the code as well."> " is the first character is treated as part of the program; all other lines are comment. In Bird-style you have to leave a blank before the code. > fact :: Integer -> Integer > fact 0 = 1 > fact n = n * fact (n-1) And you have to leave a blank line after the code as well.">

Presentation is loading. Please wait.

Presentation is loading. Please wait.

UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 330 Programming Language Structures Literate Programming in Haskell Fall.

Similar presentations


Presentation on theme: "UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 330 Programming Language Structures Literate Programming in Haskell Fall."— Presentation transcript:

1 UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 330 Programming Language Structures Literate Programming in Haskell Fall 2009 Marco Valtorta mgv@cse.sc.edu

2 UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Literate Programming http://www.haskell.org/haskellwiki/Literate_programm ing http://www.haskell.org/onlinereport/literate.html "The main idea is to regard a program as a communication to human beings rather than as a set of instructions to a computer." [Donald Knuth] Haskell literate programs use the.lhs extension –Two styles: Bird and LaTeX –Hutton uses Bird style

3 UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Example of “Bird Style” literate program The literate style encourages comments by making them the default. A line in which ">" is the first character is treated as part of the program; all other lines are comment. In Bird-style you have to leave a blank before the code. > fact :: Integer -> Integer > fact 0 = 1 > fact n = n * fact (n-1) And you have to leave a blank line after the code as well.


Download ppt "UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 330 Programming Language Structures Literate Programming in Haskell Fall."

Similar presentations


Ads by Google