Learning Scala as first 'functional' language? [closed] - scala

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
Since Scala is a 'OO meets functional' language, is it a good idea for me to learn Scala as my first functional language as I know most OO concepts (from learning Java)?
Or would it be better if I learned a pure functional language such as Haskell, then mixed my knowledge of OO and functional programming together so I better understand Scala?
As functional programming is greatly different to what I'm used to, I want to make sure I learn the concepts in a way that I can transfer then between functional language to functional language and not get caught up on OO and functional concepts that only relate to Scala.

I'd recommend a language that exposes its FP traits more explicitly than Scala. You can still write OO code in Scala without dipping into FP at all.
If you want academic purity, go learn Haskell. The language now has a rich ecosystem and is gaining traction, and is definitely production ready, so you don't have to be afraid that what you learn will be lost. http://learnyouahaskell.com is a great starting point that is available for free on the web.
At some point in time you may want to learn a Lisp dialect. There's a whole plethora of them available today, with varying degrees of success, but you have probably heard of Clojure, which runs on top of JVM.
I am not aware of any good free resources, but I can recommend https://pragprog.com/book/shcloj2/programming-clojure. The book is a little bit old - it covers version 1.3 and we're currently approaching 1.7 - but is still relevant, and goes straight to the point. Once you've gone through that you're ready for something meatier, like Fogus' 'The Joy of Clojure'.
There is also a great site full of short programming problems in Clojure, which I recommend that you check out - google for '4Clojure'.

Scala is a pretty good first functional programming language. I personally didn't understand Haskell until after learning Scala. Learning Scala means the only new part is the functional programming part. You don't have to worry about a drastically different syntax or type system, and you don't have to learn about monads just to do simple IO. To make sure what you're learning is transferrable, don't use any vars, just vals.
At a certain point Scala's type system becomes unwieldy, as you dive into the abyss of implicits, covariance, and contravariance to try to use concepts such as monads. At that point, you will have enough background in functional programming to switch to Haskell and actually understand it. Haskell's type system is much better suited for such topics.
In other words, Scala makes beginner functional programming concepts easy, but advanced concepts harder, which makes it a very good gateway language.

Related

What are the benefits of learning Lisp (or a dialect) if you have a good grasp of functional programming [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
Basically, what I'm asking is, when people say that learning Lisp will enlighten you, are they just talking about learning functional programming in general or is there some deeper benefit?
Personally, and I'm sure most people feel like this, I'm quite scared by the syntax. I feel like it gets in the way and I don't see the benefit in having all expressions look the same. Never had a problem interpreting expressions in a language...
However, Haskell was a beast as well, but after learning it I can confirm that I approach problems differently and that it was a worthwhile experience.
So, the question is. Is it worth it? What does Lisp offer that NO other languages offer? I know people are eager to promote the language they use, but if there are other languages that took the good parts of Lisp and incorporated them in a more manageable form, then I don't see a reason to learn Lisp specifically.
Lisp is the programmable programming language
Lisp offers something no other language does - "code is data".
This means that the code you write is a list which can be processed by Lisp.
This leads to a powerful macro facility, which means that you have the full power of Lisp itself at macroexpansion time.
Far more from merely adding new syntactic constructs like with-something, one can define a whole DSL in a few forms.
More information:
Examples of what Lisp's macros can be used for
Lisp Macro
Macros: Defining Your Own
http://weitz.de/macros.lisp

Getting started with Prolog [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
i'm rephrasing my question as it is deemed too opinion based. I will try to be more specific this time.
I wish to learn programming languages to expand my way of thinking and expressing problems:
Here are some background. My purposes for learning specific languages.
Scala as an OO-Functional hybrid for reactive programming
Clojure as a Lisp dialect for experiencing the power of macros
Note that Scala being statically typed and Clojure being dynamic is a bonus for me as i get to learn their pros and cons at the same time
What are the things to pay attention to in the process of learning Prolog that would help me think better?
So far, my research suggests that one of the most powerful feature of Prolog is its ease of implementing "Backtracking".
previous Version:
I figured I should learn prolog to add to my arsenal of programming.
But what is the essence of prolog? As in, what are the main features
and what should I expect to take away from the experience?
It would be nice to compare to Scala and Clojure as they're my
language of choice at the moment. I'm learning Scala mainly for actor
model/reactive programming, and the OO and functional approaches seem
really powerful to me. I took up Clojure because I wanted to pick up a
Lisp dialect to experience the power of macros, and so far, Clojure
had the most momentum. So what extras would Prolog give me?
Can I get those benefits/experience/features in Erlang since it's
syntax is derived from Prolog?
Thanks for looking at my question. Hope to hear all those wonderful
answers.

Where to start with dependent type programming? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
There is an Idris tutorial, an Agda tutorial and many other tutorial style papers and introductory material with never ending references to things yet to learn. I'm kind of crawling in the middle of all these and most of the time I'm stuck with mathematical notations and new terminology appearing suddenly with no explanation. Perhaps my math sucks :-)
Is there any disciplined way to approach dependent type programming? Like when you want to learn Haskell, you start with "Teach yourself a Haskell", when you want to learn Scala, you start with Odersky's book, for Ruby you read that weird tutorial with mutated bugs in it. But I can't start Agda or Idris with their books. They are way above my head. I tried Coq and got stuck in its all-about-teorm-proving style. Agda requires a huge math background and Idris, well, let's leave that for now!
I understand static type systems very well, I am kind of proficient with Scala and I can use Haskell if necessary. I understand the Functional Paradigm and use it day to day, I understand Algebraic Data Types and GADTs (quite smoothly actually) and I recently managed to comprehend the Lambda Cube. I'm lacking in the math and logic parts, though.
I would highly recommend Software Foundations. This book is quite good at introducing you to Coq one step at a time. There is a lot of theorem proving, yes, but that's part of the deliciousness of dependent types. It's a great feeling when the line between "programming" and "proving" starts to blur.
I'm lacking in the math and logic parts, though.
I think Software Foundations does a pretty good job of bringing you up to speed for the logic you need to know. Already being comfortable with the concept of implication helps, though.
(Notice: This is a self advertisement)
I am writing an Agda tutorial and my primary goal is to
let people to play with Agda without theoretical background.
This tutorial may solve most of your problems:
tries to explain Agda programming without outer references
requires only secondary school mathemtaics
tries to teach programming practices also
It is under development, but the first half is kind of ready.

Dissimilar Scala book in near future [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I've seen quite a few books about Scala, but those are so similar to each other. Wonder what titles (related to Scala) would you like to see that would differ from "main stream"?
At this point, all Scala books are about teaching Scala. That's natural, as most readers won't be familiar with Scala.
As time passes, we'll likely need books with Scala Patterns (which can be very different from Java patterns) and anti-Patterns, coding tips, advanced algorithms, or topic-specific, like concurrency or strategic programming.
The Lift book kind of fits in the category of topic-specific, but it is really much more about the Lift library and Lift usage than about general Scala usage for web programming.
Another topic-specific book on the way is "actors in scala" - which was mentioned at the Scala BASE meetup - currently being authored (or co-authored at least) by Martin Odersky.
The actors framework offers a substantially new concurrency model (pioneered in Erlang) that aims to make writing concurrent code easier than traditional shared state concurrency, as well as offering better scalability for multi-core architectures.
One important thing we don't yet have is an entry-level book, suitable for Scala as a first language, rather than as a next step after Java, assuming some familiarity with the JVM APIs and the syntax of Java.
At the moment there is not a text on the language that I could really recommend to a bright youngster (late teens) who wants to start programming with something better than the Hobson's choice of Pascal available in the IT classes at school -- not that any of the other (quasi-)functional languages are in much better state.

How to start programming for the iPhone? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I come from a .Net C# background, what's the best way to learn how to program native applications for the iPhone?
Have a look at the Stanford course on iPhone development. It will really get you started.
Everyone has posted nice resources, but even if you already know the language you have to use, I just wanted to state it so that other people who probably don't know it, can see.
The language used for developing Apple sanctioned, native applications is Objective-C. Of course, you can mix in C and C++, but the SDK itself is in Objective-C, so you might want to learn that. It looks a bit scary at first to most people, usually those coming from higher level languages such as C#. The brackets and supposed 'verboseness' turns some people off. After a while though, it grows on you and you'll notice it's a very readable and self-documenting language.
I personally used the book titled Learning Objective-C which was perfect for me as someone who is already familiar with programming languages, preferably C-style languages, and wanted to learn about the main differences in that language. The other, longer and I imagine better reference of a book is the popular Programming in Objective-C 2.0. This book is longer and starts off assuming the reader has 0 programming experience, going over control structures, Object Oriented Programming basics, etc. I believe both books have cheaper and searchable PDF versions.
Have fun and I hope all goes well for you in this venture.
In case you didn't know it: You can also use C# to program on the iPhone through MonoTouch. And in fact MonoTouch does also compile down to native ;)
I found the Beginning iPhone 3 Development book to be a very good way to get started.