> Is that it's only use? Then why? dip can easily be formulated using
> non-retain stack using primitives:
>
> For example: "a" "b" "c" [ append ] dip -> "a" "b" "c" -rot append swap
>

That implementation assumes the quotation takes two operands and
produces one result, which is not always the case. More generally, the
functional argument of “dip” is not really supposed to be able to
touch the argument it’s operating under. If you don’t have types or a
stack checker enforcing this, the formulations with a retain stack or
dynamically composing quotations are safe by construction, but the
“-rot” version is not. Consider “[ 3drop ] dip” or “[ append dup ]
dip”.

You can easily describe the constraint with a type dependent on the
arity of the argument type, though. In the current state of Kitten:

dip :: ∀R S a. (R a (R → S) → S a)

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to