4 ms·
Mainstream languages are not expression orientated like true FP languages are. Most people working in mainstream languages aren’t aware of the significance of t
by fire_lake 2y ago
Mainstream languages are not expression orientated like true FP languages are. Most people working in mainstream languages aren’t aware of the significance of this and wonder why FP seems awkward in their language, despite it having closures, some immutable types, etc.
- __MatrixMan__ 2y agoOne thing that struck me while learning nushell is that instead of: $ echo "hello world" hello world I can do: $ "hello world" hello world Is this an indication that it is expression oriented? (just checking that I've understood the phrase).
- ryandv 2y agoThis is the statement/expression distinction; `echo "hello world"` is a statement that, when evaluated, has the side effect of printing "hello world" to stdout (or wherever), and has no value (for the purposes of this example). `"hello world"` is an expression with the literal string value "hello world"; your REPL probably prints out that expression's value once it is evaluated for convenience. FWIW I'm not actually familiar with nushell and am speaking fairly generally about statements vs. expressions.
- acchow 2y agoYes. Essentially, statements have no value (or return no value). Expressions have a value.
- peterbecich 2y agoI will add to that the other big difference is how much the compiler enforces the style.