#### Topic: The guidebook in and OCaml

I here wrote recently about interesting language OCaml and was surprised, why it did not fly up. Well and so, mastered recently book Real World OCaml, yes with a draft bare ran  powerful to try. Began with the list of all possible  the list of integer numbers. At first  a variant on a python: def permutations (s): if len (s)> 1: for i, v in enumerate (s): for p in permutations (s [0: i] + s [i+1:] ): yield [v] + p else: yield s def main (): for p in permutations ([1, 2, 3]): print (p) if __ name __ == ' __ main __ ': main () Like quite good to receive result "here and now" needlessly to write a library function. Then made a variant on OCaml and sent on code reveiw. The variant turned out long, but the worker. And then the clever person came, and showed, how it is necessary, instead of as at me. The decision and is shorter, and , whether that, than mine. Here the thought here came that I am far not the first person who wants to learn to write in the functional style, having behind shoulders experience with imperative languages. Someone can to me already made the list of that, whence it is necessary to begin and where to go?

#### Re: The guidebook in and OCaml

Hello, monax, you wrote: M> Here the thought here came that I am far not the first person who wants to learn to write in the functional style, having behind shoulders experience with imperative languages. Someone can to me already made the list of that, whence it is necessary to begin and where to go? In my opinion, it suffices: 1. A recursion 2. A pattern  in signatures f-tsy and guard' 3. The composition f-tsy if is remaining  depends on language.

#### Re: The guidebook in and OCaml

Hello, monax, you wrote: showListOfLists = unlines. map showList showList = unwords. map show perms (x:xs) ys = map (x:) (perms xs ys) ++ perms xs (x:ys) perms [] _ = [] main = putStrLn \$ showListOfLists \$ perms [1. 5] []  are purely mathematical formulas