How to bind to foreach context ?
- by Rebol Tutorial
Currently I have this snippet of code:
save-blocks: func[file /local f out][
foreach [field1 field2 field3 field4 field5 field6 field7 field8 field9] blocks [
out: copy ""
repeat n 9 [
part: get bind to-word rejoin ["field" n] 'field1
out: rejoin [out part ";"]
]
remove back tail out
write/lines/append f out
]
It's not generic enough, I'd like to pass this
block: [field1 field2 field3 field4 field5 field6 field7 field8 field9]
as parameter and write something like this:
save-blocks: func[block file /local f out][
foreach block blocks [
out: copy ""
repeat n 9 [
part: get bind to-word rejoin ["field" n] 'field1
out: rejoin [out part ";"]
]
remove back tail out
write/lines/append f out
]
But I don't know how to bind in this case too hard for me :(