Skip to content

Instantly share code, notes, and snippets.

View veslav3's full-sized avatar
🏠
Working from home

Roy Honders veslav3

🏠
Working from home
View GitHub Profile
### Keybase proof
I hereby claim:
* I am veslav3 on github.
* I am veslav (https://keybase.io/veslav) on keybase.
* I have a public key ASDLLnu8a5fvmVgXU1bR3gmBhjwyIFLK_bSnAC4OKHp9mAo
To claim this, I am signing this object:

Haskell coding challenge

As the final part of this blogging series I will put myself to the test using a coding challenge. I am really glad that I have been prepared to do this challenge.

Give me six hours to chop down a tree and I will spend the first four sharpening the axe. Abraham Lincoln

Create tic-tac-toe in Haskell with a board size of 3.

Image I think this challenge is great to do because of the user input that needs to be processed into the game, which has been a challenge to do with Haskell.

Day three the mind meld

Today I will continue with the third and last chapter of the seven languages in seven weeks book about haskell.

Classes and Types

In this section we will go over the type system in Haskell again. You can find the types like this:

Prelude> :set +t
Prelude> 'c'
'c'
it :: Char

Day two spock's great strength with Haskell

Today I will continue with the second chapter of the seven languages in seven weeks book about haskell.

Anonymous functions

In haskell anonymous functions exist. These are function without a name. They are started off with the following characters "(" and closed with the character ")".

(\x -> x ++ " captain.") "Logical,"
"Logical, captain."

Using anonymous functions has the most effect when using it in combination with other functions:

Day one logical with Haskell

Today I started reading the Haskell chapter in the seven languages in seven weeks book. (https://pragprog.com/book/btlang/seven-languages-in-seven-weeks) In this blog series I will report my findings about the language and focus on the differences with languages like Java and C#.

Discovering the language

One interesting thing that I noticed is that string concatenation happens using a double plus sign:

Prelude> "hello" ++ " world"
"hello world"

In order to concatenate characters together you will need to define a character array, this will result in a string.