top | item 37871898

(no title)

Willamin | 2 years 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.

discuss

order

weiwenhao|2 years ago

Thank you for pointing out the bug in the website description; I have now updated it.

ozfive|2 years ago

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.

weiwenhao|2 years ago

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.