Why is common practice to use anonymous funtions where a normal function could be used instead? I’m specilly thinking when using it as an argument of another function. For example:
plot(0:0.1:2π, x -> sin(x))
I’ve seen code like that a lot but I don’t know why since
Yeah, there’s no particular reason to do that, and it’s certainly not necessary. I’d guess that you might occasionally see it in a context where someone is trying to show more generally how an anonymous function /could/ be used, and they’ve just unintentionally chosen an example that could also be written without one.
Thank you all for your replies. In the example I gave, there is no need to use an anonymous function but it is necessary to reduce the number of arguments of a function.