Remix.run Logo
desumeku 5 hours ago

Functional programming is not "newer", it is as old as Lisp, which dates back to the 60s. The people who made Go simply decided that the language did not need those features.

RadiozRadioz 4 hours ago | parent [-]

So instead we have 10 different libraries and 100 different custom implementations to do those things in Go. Compared to almost every other major language where you can do functional stuff (and everything else the Go developers decided we didn't need) natively:

    Java: Arrays.stream(nums).map(n -> n * n).toArray();
    Kotlin: nums.map { it * it }
    Python: list(map(lambda x: x*2, nums))
    C#: nums.Select(n => n * n).ToArray();
    Ruby: nums.map { |n| n*2 }
    Rust: nums.iter().map(|&n| n * n).collect();
    Perl: map { $_ * $_ } @nums;