4 ms·
Firstly, I think that some problems just do not map well to the concatenative space. E.g., complex mathematical expressions are a total bitch to try to do enti
by gecko 12y ago
Firstly, I think that some problems just do not map well to the concatenative space. E.g., complex mathematical expressions are a total bitch to try to do entirely with stack shuffling and whatnot. Thankfully, the Factor team agrees, so Factor has a full lexical variable vocabulary that performs just as well as the concatenative variety, and which is used even in the stdlib to do exactly this kind of thing.
Second, there's a mental hurdle to overcome to fight the Yoda speak, which is making sure that all of your words (i.e., functions) are tiny and well-factored. In most languages, having functions that run ten lines isn't a big deal. In Factor, that's a major problem I'd reject in code review. My best functions only run one line. Two is tolerable. In very specific circumstances, if it really makes sense, I'll bust out lexical variables and allow an extra line or two. Anything longer than that means I seriously messed up.
This makes a huge difference, because the thing about having such short functions is that the Yoda speak isn't any worse than when you're doing a builder pattern in Java or the like. There isn't really that big a difference between
foo.Where(x => x > 0).Select(x -> Math.pow(x, 2));
and
(->> foo (filter positive?) (map #(^ _ 2)))
and
foo [ > 0 ] filter [ 2 pow ] map
These two things combine to make Factor downright pleasant to work in for me.