Currently I have this snippet of code:
Blocks: ["F4369RO771" "282273" "5" "146" "126" "6-Nov-2009" "8-Jan-2010" "7-Jun-2010" "8"
"M9881KI923" "399727" "2" "359" "443" "5-Aug-2010" "23-Feb-2010" "6-Nov-2009" "4"
]
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 instead
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 length? block [
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 :(