background
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| background [2021/04/23 07:16] – [Understanding] f2b216 | background [2025/10/08 00:44] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 5: | Line 5: | ||
| - | ====== Difficulties? | + | ====== Difficulties |
| - | Learning Haskell | + | Learning Haskell |
| The reasons for the difficulties in learning Haskell, may be: | The reasons for the difficulties in learning Haskell, may be: | ||
| * Before I started with Haskell, I was only used to imperative languages (Assembler, C, Pascal, Modula-2, C++, PHP, and more). The most, I was used to C++. | * Before I started with Haskell, I was only used to imperative languages (Assembler, C, Pascal, Modula-2, C++, PHP, and more). The most, I was used to C++. | ||
| - | * The difference between the imperative paradigm and the functional paradigm is like the differnce | + | * The difference between the imperative paradigm and the functional paradigm is like the difference |
| - | * Often, the code examples | + | * Often, the code examples are not appropriate. |
| * ..or I am to stupid? | * ..or I am to stupid? | ||
| - | * A lot of the available examples are outdated. | + | * A lot of the available examples are outdated, and incompatible with current packages, libraries and compiler versions. |
| * Often just incomplete. | * Often just incomplete. | ||
| - | * Often incompatible with the current packages. | ||
| * Often they contain confusing useless, warning generating statements. | * Often they contain confusing useless, warning generating statements. | ||
| * Example here: [[confusing: | * Example here: [[confusing: | ||
| Line 22: | Line 21: | ||
| * See the comments in [[https:// | * See the comments in [[https:// | ||
| * Some information are only available on stackoverflow or reddit. | * Some information are only available on stackoverflow or reddit. | ||
| - | * If you place questions on stackoverflow, | + | * If you place questions on stackoverflow, |
| ====== About ====== | ====== About ====== | ||
| Line 29: | Line 27: | ||
| ===== Understanding ===== | ===== Understanding ===== | ||
| - | I was may be a techie since I was a curious child. At an age of approximately 8 years, I assambled an electric DC Motor, and believe still to remember that I was shocked and amazed that it worked. I was so keen to understand... | + | I consider myself |
| - | + | ||
| - | This craving to understand is a very big driver. | + | |
| + | This craving to understand is a very big driver - for me. | ||
| ===== Understanding Haskell ===== | ===== Understanding Haskell ===== | ||
| - | Let's put this question on hold: How can people live together | + | Just to imagine how rich Haskell is in terms of abstraction - and to understand how must can be and sometimes has to be understood - enyoy the example below. |
| - | In the meantime, let's understand | + | The following shows how 10 primes are evaluated and displayed starting with the one millionth prime number. |
| * Example )< | * Example )< | ||
| Line 60: | Line 57: | ||
| </ | </ | ||
| - | To understand this code (7 lines of code) completely I have to understand the following: | + | To understand this code (8 lines of code) completely I have to understand the following: |
| - Packets | - Packets | ||
| - Import | - Import | ||
| Line 87: | Line 84: | ||
| * Haskell is fast. | * Haskell is fast. | ||
| - | * The execution of the algorithm above takes approximately 1 minute. | + | * The execution of the algorithm above takes approximately 1 minute |
| * Haskell supports parallel execution. | * Haskell supports parallel execution. | ||
| * Is very good testable and validatable to rock solid code. | * Is very good testable and validatable to rock solid code. | ||
| * Haskell programs can solve problems that I would not dare to solve without - at least without a functional programming language like Haskell. | * Haskell programs can solve problems that I would not dare to solve without - at least without a functional programming language like Haskell. | ||
| + | |||
| + | |||
| + | ---- | ||
| )< | )< | ||
| + | |||
| + | The following code (sieve of Erastothenes) will also work but by far not as fast for large numbers (approximately 100 times slower for the first 20 thousand prime numbers): | ||
| + | <code Haskell> | ||
| + | primes = let sieve (n0:lrn) = n0 : sieve [ n | n <- lrn, n `mod` n0 /= 0 ] in sieve [2..] | ||
| + | </ | ||
| )< | )< | ||
background.1619155012.txt.gz · Last modified: (external edit)
