2

I am a Java programmer looking to learn Functional Programming. My aim is to implement a simple use case (say a simple text-based game like tic-tac-toe) in various Functional Programming languages (i.e. Clojure, Scala) in order to learn the ins and outs of each.

Are there any FP gurus out there who can recommend a specific use case that I could begin with? Or is Tic Tac Toe (noughts and crosses) good enough to get started?

Note that at this point I will be focusing on JVM based languages.

om-nom-nom
  • 62,329
  • 13
  • 183
  • 228
Mark
  • 455
  • 1
  • 5
  • 11
  • 1
    I hate to say it, but this is too broad and/or primarily opinion based. In addition, whether you use a JVM language or not doesn't matter, does it? – Ingo May 09 '14 at 08:36
  • I added the note about JVM in case it was relevant for someone, but I see your point. – Mark May 09 '14 at 09:49
  • 2
    Take a look at: https://www.coursera.org/course/progfun - it covers the basics of functional programming using Scala. It should be easier to learn other FP languages. – Akos Krivachy May 09 '14 at 10:25
  • You can also look at implementing some of, say, list operations, in the preferred language of your choice just using the primitive operations. For example how would you implement a 'set' by using a list and the operations available for working on list. If you are into Clojure, try http://www.4clojure.com/ – grdvnl May 09 '14 at 14:30
  • 2
    @AkosKrivachy I think the first part of https://www.coursera.org/course/proglang is a lot focussed towards fundamentals of functional programming, without the noise of Scala syntax. – grdvnl May 09 '14 at 14:32

1 Answers1

2

I think Tic-Tac-Toe would help you, indeed. Let me share how I started, I started learning by,

  • Writing arithmetic functions in Clojure; for example, next-prime, prime?, factors, prime-factors, and stuff like that
  • Then making those idiomatic as far as I could
  • Then ask question here, or anywhere, to improve a particular function

Here is the link of math.arithmetic.

Note: It's missing a decent README. I'll put that later. Actually, I never thought of sharing this because it's so trivial.

[Edited]

You can try 4clojure.

4Clojure is a resource to help fledgling clojurians learn the language through interactive problems.

[Edited, again]

There is also Project Euler, which many people have found useful for precisely this sort of thing.

Project Euler is a series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve.

dsm
  • 10,263
  • 1
  • 38
  • 72
Adeel Ansari
  • 39,541
  • 12
  • 93
  • 133
  • 2
    Tic-Tac-Toe make a nice small problem domain that is well understood. Any small problem domain that you understand and are interested in would make project for learning a new language. You want to do something you know well so you can focus on the implementation rather than the problem being solved. – M Smith May 09 '14 at 13:02
  • @dsm: A very appropriate addition, indeed. Thanks. – Adeel Ansari May 12 '14 at 06:10