DEV Community

Discussion on: JavaScript is almost pythonic

Collapse
 
kayis profile image
K

How about BuckleScript, a OCaml compiler back-end that eats OCaml and spits out JavaScript?

Looks pretty Pythonic to me:

let rec hanoi n a b c =
  if n > 0
  then
    (hanoi (n - 1) a c b;
     Js.log {j|Move disk from pole $a to pole $b|j};
     hanoi (n - 1) c b a)
let _ = hanoi 4 1 2 3
Collapse
 
johnpaulada profile image
John Paul Ada

Yeah plus all the types and all the goodness 😄

Collapse
 
aspittel profile image
Ali Spittel

woah that looks super Elm-ish to me

Thread Thread
 
nepeckman profile image
nepeckman

They actually share roots! OCaml and Elm are both in the ML family of programming languages.

Thread Thread
 
johnpaulada profile image
John Paul Ada

I had a better time learning Reason and BuckleScript than learning Elm though LOL but hey as long as it's functional I'm all for it