Hacker News new | ask | show | jobs
by jampekka 948 days ago
One thing I had to hunt for was what the backslash means in the first examples. Especially as it seems to be used for both string interpolation and function definition.

But other than that great to have a quite good idea of the language in just a few seconds.

1 comments

It's both string interpolation and (anonymous) function definition.

    # Function Definition:
    addAndStringify = \num1, num2 ->
        Num.toStr (num1 + num2)

    # String Interpolation:
    "\(greeting) there, \(audience)!"
    # desugars to
    Str.concat greeting (Str.concat " there, " (Str.concat audience "!"))
https://www.roc-lang.org/tutorial