ocaml / v2.ocaml.org

Implementation of the ocaml.org website.
http://ocaml.org
Other
323 stars 351 forks source link

99problems.md add solution for #22 #1592

Closed crap0101 closed 5 months ago

crap0101 commented 3 years ago

Issue Description

Please include a summary of the issue.

Fixes # (issue)

Changes Made

alternative solution for number 22

crap0101 commented 2 years ago

...a variant which do not stack overflow :-D

`let range start stop =

let op = if stop > start then (-) else (+) in let rec aux s acc = function | 0 -> s :: acc | n -> aux (op s 1) (s :: acc) (n - 1) in aux stop [] (abs (start - stop));; `