You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following script illustrates a scenario in which list transparency
becomes an issue.
{{{
@redefine a twice1:
a a both >> .
@redefine a twice2:
(a a) each >> .
42 :twice1 >> .
42 :twice2 >> .
}}}
The first program, :twice1, does what it appears to do: it produces the
argument 'a' in two stacks -- {(a), (a)}. The second program, :twice2,
appears to do the same thing, however, it produces a strange result {(a),
(dup)}. This is because the stream:each primitive treats the list (a a) as
opaque, merely iterating through the items in the list without first
applying the reduction algorithm, whereas the transformation rule which
turns :twice2 into a point-free program depends on all lists being
transparent: they're equivalent to the lists they represent, without being
identical to them. (a dup >>) is equivalent to (a a), but contains
different elements when iterated through by stream:each. Either
stream:each and other list primitives will need to be made to treat lists
transparently, or a different transformation strategy for programs with
named parameters will need to be thought out.
Original link: http://code.google.com/p/ripple/issues/detail?id=18
The text was updated successfully, but these errors were encountered:
Original link: http://code.google.com/p/ripple/issues/detail?id=18
The text was updated successfully, but these errors were encountered: