Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

18 - program/list ambiguity with stream:each (0.5-dev) #18

Open
joshsh opened this issue Apr 8, 2011 · 0 comments
Open

18 - program/list ambiguity with stream:each (0.5-dev) #18

joshsh opened this issue Apr 8, 2011 · 0 comments

Comments

@joshsh
Copy link
Owner

joshsh commented Apr 8, 2011

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant