Unexpected result with arrayfilter(


i found myself having to replace a lot of change statements in what used to be pan6 procedures so i wrote this:

 local ary
 ary = clipboard()
 ary = replace(ary, {change '}, {formulafill replace(ary, '})
 ary = replace(ary, {' '}, {', '})
 ary = arrayfilter(ary, ¶, {import() + ')'})
 clipboard() = ary

simple enough.

however, say you put this on the clipboard:

 change 'x' 'y'
 change 'a' 'b'

the arrayfilter( line results in this:

 formulafill replace(ary, 'x', 'y'
 formulafill replace(ary, 'a', 'b')

note the missing close parenthesis in the first line.

i checked my work by running the code on pan6, and it yields the correct results.


Those statements are probably separated by line feeds, rather than carriage returns. Try changing it to

ary = arrayfilter(ary, lf(), {import() + ')'})


you are correct!

thanks much.