3 ms·
Half of what you call functions in that comment, are not actually functions and in the FP world many would not call them functions. Rather they are procedures.
by zelphirkalt 2y ago
Half of what you call functions in that comment, are not actually functions and in the FP world many would not call them functions. Rather they are procedures. Functions are procedures, but not all procedures are functions.
- SilasX 2y agoWhich is also a problem with thinking this is a helpful abstraction: apparently, not everything you need to do can be captured by functions (in that sense)!
- magicalhippo 2y agoI'm just used to the words from Pascal. What's the definition of a procedure in the FP world?
- zelphirkalt 2y agoAfaik, the definition is just "a sequence of steps/instructions". That is of course much broader than a (simple) function, which among other things for one input gives you one output, and for the same input always the same output. A procedure can do that too, but it can also give you different outputs for the same input, due to side effects.
- magicalhippo 2y agoSo from that perspective functions are pure and procedures are impure? One of the thinga I miss from my C++ days was the ability to mark functions as const, which made them fairly pure. Being able to clearly mark which is which, but also to combine them easily, was very productive.
- zelphirkalt 2y agoYes, that is my understanding of the terminology, and how I try to use the terms (not always succeeding).