4 ms·
I'm glad you picked out "everything is an expression" as the characteristic feature. I think that's completely correct -- everything else in the language is car
by jashkenas 16y ago
I'm glad you picked out "everything is an expression" as the characteristic feature. I think that's completely correct -- everything else in the language is carefully compiled to make its use as part of a larger expression possible.
I don't, however, think that it's about functional programming. It's about flexibility: if everything is an expression, you can use any bit of code in relation to any other, and not worry about what parts of the languages are merely statements ... a JavaScript example being "var a = b", which cannot be used as part of a larger computation.
Having every function return a value is something that seems extraneous at first look, but ends up encouraging good API design. From the point of the caller of the function, returning a meaningful value is always appreciated -- even if it's as simple as returning "true" to acknowledge that the operation was completed successfully.