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

AI~ (Array/Initial) doesn't work with functions #3

Open
rgchris opened this issue Apr 5, 2014 · 2 comments
Open

AI~ (Array/Initial) doesn't work with functions #3

rgchris opened this issue Apr 5, 2014 · 2 comments

Comments

@rgchris
Copy link
Contributor

rgchris commented Apr 5, 2014

Supplying ARRAY/INITIAL in Rebol with a function value initiates each element of the array with the product of a fresh invocation of the function. This doesn't happen in Rebmu. Rebol 3:

>> n: 1 array/initial 4 does [++ n]
== [1 2 3 4]

And in Rebmu:

>> rebmu/debug [I&[a+Jn]Aai~4 i] 
Executing: [i: & [a+ j n] a: ai~ 4 i]
== [1 1 1 1]
@hostilefork
Copy link
Owner

Note that your example requires a get-word even in regular Rebol.

>> rebmu/debug [I&[a+Jn]Aai~4 :i]  
Executing: [i: & [a+ j n] a: ai~ 4 :i]
== [1 2 3 4]

...however, it wasn't working even when passing in the result of the function generator. (which was presumably what you tried first). So yep, there was a bug.

Fixed with the assistance of a helpful person on StackOverflow :-)

http://stackoverflow.com/questions/22892499/

@hostilefork
Copy link
Owner

Ah, while it did fix the specific case of function values it changes the evaluation rules...so now you can't pass ordinary variables or expressions because of the quoting. It effectively makes AI~ have a different prototype which isn't what's needed... see comment on SO.

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

2 participants