StringCalculator Kata in F# – revision 1

“Learn at least one new language every year” – The Pragmatic Programmer book.
Late 2014 I have decided to learn F#. This is my first attempt at String Calculator Kata in F#.


Podbij ↑

You can find String Calculator Kata rules on Roy Osherove’s blog.

Below is video of me doing the Kata. I’m sure this can be done a lot better. I just don’t know how – yet! If you have any suggestions please let me know. But don’t give me solutions! I haven’t watched any F# String Calculator Katas on purpose!

BTW If you are VIM user and see I’m not using it optimally please let me know.

EDIT: It turns out Vimeo displays this video in HD only on their site. You can watch it here: https://vimeo.com/116838669

Podbij ↑

Reklamy

Jedna uwaga do wpisu “StringCalculator Kata in F# – revision 1

  1. This code is not beautiful but you did it in 15 minutes, very fast. Good job 🙂

    If you want to refactor it and make much simpler, here are some of my advice:
    1. Consider the text characters that you have to skip while parsing. Do you have to search for a specific character to be omitted or maybe you can just check the range (more generic way)?
    2. Use smaller functions. Name them to make the code more readable.
    3. Try to not use indexes at all.
    4. Try to process the text at onces.
    5. Try to think about text as a list of characters. Maybe it will help you to approach in a different way to solve the problem.
    6. Fold function (aka reduce or aggregate) is very powerful weapon in functional languages. Use it 🙂

    Polubienie

Skomentuj

Wprowadź swoje dane lub kliknij jedną z tych ikon, aby się zalogować:

Logo WordPress.com

Komentujesz korzystając z konta WordPress.com. Wyloguj /  Zmień )

Zdjęcie na Google+

Komentujesz korzystając z konta Google+. Wyloguj /  Zmień )

Zdjęcie z Twittera

Komentujesz korzystając z konta Twitter. Wyloguj /  Zmień )

Zdjęcie na Facebooku

Komentujesz korzystając z konta Facebook. Wyloguj /  Zmień )

w

Connecting to %s