diff options
| author | Paul Buetow <paul@buetow.org> | 2021-05-31 10:09:22 +0100 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2021-05-31 10:09:22 +0100 |
| commit | d0f66e3e2a12223b0895e5c113859263d5c3f527 (patch) | |
| tree | 42a3f4e2f74062a74367d6c47efab54a69b6d5ab /gemfeed/2010-04-09-standard-ml-and-haskell.md | |
| parent | aea412fed459d5c87f2eb4305e57f2fcc92d3e19 (diff) | |
Publishing new version
Diffstat (limited to 'gemfeed/2010-04-09-standard-ml-and-haskell.md')
| -rw-r--r-- | gemfeed/2010-04-09-standard-ml-and-haskell.md | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/gemfeed/2010-04-09-standard-ml-and-haskell.md b/gemfeed/2010-04-09-standard-ml-and-haskell.md index 5b9b38d8..90212b66 100644 --- a/gemfeed/2010-04-09-standard-ml-and-haskell.md +++ b/gemfeed/2010-04-09-standard-ml-and-haskell.md @@ -2,13 +2,13 @@ > Written by Paul Buetow 2010-04-09 -I am currently looking into the functional programming language Standard ML (aka SML). The purpose is to refresh my functional programming skills and to learn something new too. Since I already know a little Haskell, could I do not help myself and I implemented the same exercises in Haskell too. +I am currently looking into the functional programming language Standard ML (aka SML). The purpose is to refresh my functional programming skills and to learn something new too. Since I already knew a little Haskell, I could not help myself, and I also implemented the same exercises in Haskell. -As you will see, SML and Haskell are very similar (at least when it comes to the basics). However, the syntax of Haskell is a bit more "advanced". Haskell utilizes fewer keywords (e.g. no val, end, fun, fn ...). Haskell also allows to explicitly write down the function types. What I have been missing in SML so far is the so-called pattern guards. Although this is a very superficial comparison for now, so far I like Haskell more than SML. Nevertheless, I thought it would be fun to demonstrate a few simple functions of both languages to show off the similarities. +As you will see, SML and Haskell are very similar (at least when it comes to the basics). However, the syntax of Haskell is a bit more "advanced". Haskell utilizes fewer keywords (e.g. no val, end, fun, fn ...). Haskell also allows to write down the function types explicitly. What I have been missing in SML so far is the so-called pattern guards. Although this is a very superficial comparison for now, so far, I like Haskell more than SML. Nevertheless, I thought it would be fun to demonstrate a few simple functions of both languages to show off the similarities. -Haskell is also a "pure functional" programming language, whereas SML also makes explicit use of imperative concepts. I am by far not a specialist in either of these languages but here are a few functions implemented in both, SML and Haskell: +Haskell is also a "pure functional" programming language, whereas SML also makes explicit use of imperative concepts. I am by far not a specialist in either of these languages, but here are a few functions implemented in both SML and Haskell: -## Defining a multi data type +## Defining a multi-data type Standard ML: @@ -151,9 +151,9 @@ delete_one m w = do delete_one’ x = (x, False) ``` -## Higher order functions +## Higher-order functions -The first line is always the SML code, the second line always the Haskell variant: +The first line is always the SML code, the second line the Haskell variant: ``` fun make_map_fn f1 = fn (x,y) => f1 x :: y |
