Hacker News new | ask | show | jobs
by Willamin 976 days ago
A bit of a nitpick on the language on the homepage:

The description of the Fibonacci example seems incorrect, but I might be misunderstanding something about the language.

> A fib evaluation function was defined using recursion.

> The result of the function call was assigned to a variable named "result" and format the output using fmt.printf

    import fmt 

    fn fib(int n):int {
        if n <= 1 {
            return n
        }
        return fib(n - 1) + fib(n - 2)
    }

    fmt.printf('fib result is %d', fib(30))
No variable named "result" is ever defined, right? Maybe the description is outdated from a time when an intermediate variable was present.
3 comments

Thank you for pointing out the bug in the website description; I have now updated it.
You are absolutely correct, while reading through it I was becoming increasingly concerned that whomever wrote the description was the language writer themselves. I expect a level of attention to detail from someone who is writing their own language.
Thank you for the heads-up! I'll be more careful with the details in the future. I am sorry about that, because all the current English documentation has been translated by GPT-4. It seems I wasn't fully prepared, but I'm still thrilled that someone shared the Nature project on Hacker News.
This will also never do anything if you pass it 0.
Look at the if statement again.
It'll return 0.