On Oct 28, 2009, at 9:20 PM, Adam wrote:

Reading the older docs for [let and [let* I see that the [let* form
evaluates the bindings sequentially rather than in parallel.

What order are the :> bindings evaluated?

I'm just curious as I haven't used the :> form yet.

As Jon said, :> binds the value (or values) currently on the top of the stack at the point in the code where the :> appears. So you could get the former effect of [let ] (that is, binding all the variables in parallel) by calculating all the values and then binding the variables all at once like so:

1 2 +
3 4 *
5 6 - :> ( x y z )

In this case, the "1 2 +", "3 4 *", and "5 6 -" expressions all get evaluated first, and their results are bound to "x", "y", and "z" afterward at the site of the :>. This would be equivalent to the old [let ] form:

[let |
    x [ 1 2 + ]
    y [ 3 4 * ]
    z [ 5 6 - ]
| ]

To get the effect of [let* ], you bind each variable immediately after its value is evaluated:

1 2 + :> x
3 4 * :> y
5 6 - :> z

Thus, "1 2 +" is evaluated and the result bound to "x", then "3 4 *" is evaluated and the result bound to "y", and finally "5 6 -" is evaluated and the result bound to "z".

I hope that clarifies it for you, Adam. Let me know if it's still unclear.

-Joe
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to