Coming to Ocaml from Ruby, Lisp, Haskell, and Erlang [closed] - functional-programming

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 3 years ago.
Improve this question
I've been reading about Ocaml's consistent speed, rapid prototyping ability, and excellent memory management, and decided to take it up.
As I've already got Ruby, *lisp, Haskell, and Erlang under my belt, I'm interested specifically in what KISS-violating features I should look out for in Ocaml.
If you've started Ocaml with a background in the above languages, what was the most frustrating thing to grok? How did you get around this difficulty? What analogies helped you get into the flow of the language?
I'd also be interested in knowing whether you have done more than simply learn Ocaml, and have actually converted to it for a large percentage of your coding problems.

I found an excellent resource on Ocaml and its relation to most other languages: http://www.soton.ac.uk/~fangohr/software/ocamltutorial/lecture1.html
Not only does it explain the why, it also explains many of the little quirks likely to snag you as you begin.
Ah, I found a cheatsheet highlighting almost all of its syntactic weirdnesses.

I have heard the APress Practical OCaml is awful as well.
Introduction to Objective Caml is excellent and specifically addresses a few anti-KISS gotchas, such as ways the type-system can be unforgiving.

Coming to OCaml from a C++ background, I found replacing classes with variant types to be the hardest transition (and it was easy!).

There is a book about Ocaml "Practical Ocaml" it's not a really good book, but at least for getting started it's good enough. It's a quite practical language, which unfortunatly a "strange" syntax. If you like to see some "real" Ocaml then just look at the Shootout pages.
Regards
Friedrich

Related

How much math/physics does a full stack engineer need? [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 2 years ago.
Improve this question
So, imagine a person that likes math/physics/engineering problems. He also likes science and programming. Let's call him D.
D is in his mid-twenties, has much to learn about life and programming. He has the most experience in Pascal, C++, C, Python, Javascript. He also peaked into web development tools a bit. Note that, D is very enthusiast about solving & programming math/physics driven problems and can not imagine his job to completely lack such problems.
Now D got a really interesting offer to become a full stack engineer. The only concern is, that he is completely unfamiliar with this part of the development world. D likes the offer, but does not know how much math/physics, if any, is included in an everyday life of a full stack engineer. Is that none at all? Some? Or does it depend on the project? Could it be the most desirable knowledge in some cases?
Anyway D does not have the answers to any of the questions and is therefore having trouble accepting/denying the given offer. He is afraid that the lack of scientific approach in full stack development could bore him to death.
What do you think? I know people that are really good full stack engineers but bad (or none) math/physics knowledge. But I don't know any that good mathematician/physicist to go for a full stack engineering career. Can you help D?
The most helpful tip for D:
D should not make a Full Stack Developer career if he is afraid that the lack of scientific approach in full stack development could bore him to death.
Because, most probably it will do even if the project is somehow science-related. It is a rare case when a FSD will be loaded with interesting math/physics driven problems.
Better to find C++ or python positions with relevant specialization. Perhaps the most of relevant vacations that will make D happy are located in GameDev area.
P.S. Math/Physics related problems and Scientific Approach are different things =)

Mathematical notation or Pseudocode? [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 2 years ago.
Improve this question
At this moment I am concerned about which is the best way to explain an algorithm intuitively.
I have try to read some pseudocode an wow it may be complex for some cases (specially for math applications even more than the formulas itself or pure code like in PHP, C++ or Py). I have thought how about describe algorithms from mathematical notation in a way such that a mathematician could understand it and a web developer too.
Do you think it is a good idea ? (IF all the grammars and structure, symbols and modelings of it will be well explained and it is compact)
Example:
Binary Search
It even could help to simplify algorithm complexity if a mathematical analysis is done (I think)
Depends on the algorithm. For me, I know I would have never gotten the concept of trees if I didn't get a visual drawing. Also the concept of nodes, while a drawing is good, actually seeing the data structure written down is better for that case.
It's student to student basis. I personally see that example of the Binary Search as the worst type of example but am sure some math individual would maybe understand that better.

Explain how the functional programming model differs from the procedural or object orientated models [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Can anyone explain how the functional programming model differs from the procedural or object orientated models.
I cannot conclude a good answer myself.
in my opinion FP is about pure functions (that is functions in a mathematical sense) - which implies referential transparency and, if you continue the thouhgt, immutable data.
This is the biggest difference I see: you don't mutate data - and most other aspects either directly follow from this or from cool type-systems (which are not necessary for a language to be called functional) and the academic nature.
But of course there is far more to it and you can read papers, complete books or just wikipedia about it.
please note that you can dispute the pure property and then things get a lot more fuzzy ... which should not surprise you, as most functional languages in wide to allow for mutation (Clojure, Scala, F#, Ocaml, ...) and there are not many pure ones.
In this case the biggest difference might be the way you abstract things with higher-order-functions (at least functions should be first class citizens - meaning you can pass them around and have them as values).
But overall this question is really opinionated and will very likely be closed as to broad or something - maybe you should ask for details instead of the big picture

Spreadsheets that use a functional-programming language [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I'd like to know if there exists a spreadsheet application which uses an existing functional-programming language to define functions.
I've already heard about Resolver One which uses python, but I'm more interested in anything which uses a purely functional language like Haskell.
Thanks
Spreadsheets are quite a popular application among functional programmers. They have been a recurring theme in papers over the years. Some of the more memorable papers include
Spreadsheet Functional Programming by David Wakeling (2007).
Forms/3 by Margaret Burnett and many others (2001)
Implementing Function Spreadsheets by Peter Sestoft (2008)
You can also read about an effort to make Excel more functional.
For each of these papers I have either read the paper or heard a talk based on the papers. None of the papers is fabulous but all of them are good. I think the one with the most interesting ideas is by Sestoft—and his experimental results are pretty amazing.
If you count JavaScript as a functional programming language you can use Google Web Scripts for Google Spreadsheets :)
There's Scheme In A Grid (http://siag.nu/siag/), but it's looking kind of out of date.
There's also Haxcel (http://www.mrtc.mdh.se/projects/Haxcel/), which was a thesis project.
If you want to do functional programming in a spreadsheet the best practical choice is probably Resolver One, as you've already noted. (I would say "functional programming" in this context means first-class functions that work with other spreadsheet functions and the sheet itself - i.e. you could write a function that returns a function, call it and have the result go in a cell for yet other cells to call, etc. I don't know if OpenOffice and Google Docs will do that.)
A colleague and I have been working on a little project to do this within Excel, using a syntax very close to Excel formulas. I described it briefly in a comment on Roy MacLeans's VBA Blog:
http://roymacleanvba.wordpress.com/2009/08/04/domain-specific-languages-%e2%80%93-part-2/#comment-130
It's changed some since I posted that, but if you want to call our very-minimal syntax a "language", it's certainly "pure". (And I'm still planning to release it to the vast universe of FP-implemented-in-VBA enthusiasts, but stuff keeps coming up...)
There is herculus.io
But it seems down currently.
The guide describes a concept I find very interesting: https://app.herculus.io/doc/guides/app/

Common R idioms [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
What good resources are there for R idioms, in the same line as there are for Java and Python?
I would primarily recommend the R Inferno. In particular, study section 3 on vectorization, which is probably the key concept in R programming.
Beyond that, I would second Dirk's recommendation of John Chambers book.
Going a step farther: the R language is derived primarily from Scheme. One of the best ways to deeply understand R programming (as compared to a language like Java or C) is by learning about functional programming. For this, the best resource might be SICP (the "Structure and Interpretation of Computer Programs", available free online) which uses Scheme. You can find the relevant video lectures online as well: MIT 6.001 and Berkeley 61a.
There is Rosetta Code which presents many common programming tasks in different programming languages. Then there is a blog post by Stephen Turner that lists several ressources for programmers coming from other languages, for instance you can find slides from Drew Conway who compares Python with R.
Easy: 2200+ packages and counting on CRAN :)
Actually, jokes aside, the best description I have read was in Chambers (2008).
This is a very interesting question -- R is indeed full of idioms, and the situation is made even more difficult by the fact that there are many idioms for data analysis, in addition to the more general programming ones. Combined with R's expressiveness and its penchant for violating the principle of least surprise, this often makes the learning curve a bit steeper than one would like.
Personally, I picked up most of what I know by reading help, reading various tutorials and tip collections, and occasionally looking at source code of built-in functions. R FAQ has useful tidbits to start with. Revolution Computing has links to good resources, particularly for programmers. Also, I found Howard Seltman's collection of tips and links to be useful; I would bet that links on that page would cover most useful R idioms, but I am curious to see what else is out there.
This may or may not help you on your quest to figuring out R. But back when I was getting accustomed to R, I found that matlab to R dictionaries helped quite a bit (i.e. assuming you know how to use matlab). I can't seem to find the one I used, but found this one, which seems to illustrate things nicely.
Nowadays, I'd say the most definite resource on all details of the R language is Hadley Wickham's book.
Reading this, you'll get a very thorough understanding of how R works.
The book covers - among many other things - functional and object-oriented approaches to programming in R. Other chapters are devoted to the basic data structures and to performance issues in R.
Note that this really is a published, high-quality book that is freely accessible online.
There is also Rchaeology: Idioms of R Programming by Paul E. Johnson, which is one of the vignettes for the rockchalk package.
He says 'it includes "deep insights" and programming advice that reflects the customs and mannerisms of the R leaders.'

Resources