by waleedka · 9y ago · 0 comments
f(x) = x^2 + 1
But most of the other ideas are less intuitive than their native counterparts. For example, I think that the native form: 3 in [1,2,3,4,5]
is clearer than: [1,2,3,4,5] /contains/ 3Also, declaring types for the function and arguments (which is optional but has been strongly recommended since the Fortran '77 era) had to be done outside of the function, which again is unlike the usual syntax.
The only code I've ever seen statement functions used in dated from the 1970s.
It looks a lot people who had some confusion with the scope of x in something like ...
f(x) = x^2 + 1
would also have problems quickly seeing the scope of x in lambdas that are present in a bunch of modern programing languages like python. f = lambda x: x^2 + 1
It seems python lambdas also don't support type hinting like you mention was a problem in Fortran, too.