Penguin

Differences between version 28 and previous revision of Forth.

Other diffs: Previous Major Revision, Previous Author, or view the Annotated Edit History

Newer page: version 28 Last edited on Tuesday, March 20, 2007 5:21:38 pm by SamuelFalvo Revert
Older page: version 27 Last edited on Tuesday, March 20, 2007 5:20:35 pm by SamuelFalvo Revert
@@ -115,9 +115,9 @@
  * Forth has issues using local variables, but can maintain global state with ease. Haskell has issues using global state, but can maintain local variables with ease. To address these issues, ANSI Forth introduces a portable locals wordset, while Haskell introduced monads to deal with global state. Both constructs are fully expressable in the core language, and both address (essentially) different sides of the same problem. 
  
  * Forth allows the compiler to be extended by fundamentally altering the compiler in terms of words written in the base language itself. Haskell utilizes monads for this same purpose. 
  
- * Haskell uses the <tt>&gt;&gt; =</tt> operator to compose the ''right-hand's'' monadic function onto the results returned by the ''left-hand'' computation. This is, save for the threading of state, ''normal function composition.'' In Forth, which is described mathematically as a purely combinator-based language, composition is performed by concatenation -- e.g., simply listing one word after another. Hence, both Forth and Haskell code can be expressed via function composition, and therefore, reasoned about algebraically. 
+ * Haskell uses the <tt>>> =</tt> operator to compose the ''right-hand's'' monadic function onto the results returned by the ''left-hand'' computation. This is, save for the threading of state, ''normal function composition.'' In Forth, which is described mathematically as a purely combinator-based language, composition is performed by concatenation -- e.g., simply listing one word after another. Hence, both Forth and Haskell code can be expressed via function composition, and therefore, reasoned about algebraically. 
  
  * Forth allows one to freely alter the return stack. Return stack items are (usually) return addresses, and therefore, (partial) continuations. Freely altering the return stack is dangerous and can produce unstable software. However, there are nonetheless distinct *patterns* of return stack manipulations you can use to produce _extremely_ compact representations of fairly high-level control flow structures. This introduces the concept of "return conventions," as distinct from "calling conventions." It turns out that Haskell uses return conventions as well, under the hood, to optimize pattern-matching in case and function evaluation. 
  
 As you can see, Forth shares many traits with functional languages, and therefore doesn't always apply to the AssemblyLanguage programmer. In fact, besides embedded devices, ''music'' is one of Forth's application domains, as it is used in some of UCSD's music courses. Forth has successfully been used in artificial intelligence research, and is the language of choice for NASA on many satellites and planetary probes. In these environments, the functional correctness and compactness of Forth weighs more heavily than the use of assembly language.