I'm flopping around trying to flatten an array. I can't seem to get it...
input := '...
Optical Drive Type: CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-R, DVD-R DL, DVD-RW, DVD+R, DVD+R DL, DVD+RW
Optical Media Type:...'
lineBreak := #cr asParser / #lf asParser.
driveTypeHeader := 'Optical Drive Type: ' asParser skipUntil.
driveType := (', ' asParser / lineBreak) negate plus flatten.
additionalDriveType := ', ' asParser, driveType ==> [ :nodes | nodes second ].
driveTypeList := (driveType, additionalDriveType star).
parser := driveTypeHeader, driveTypeList, lineBreak ==> [ :nodes | nodes second ].
parser parse: input.
Returns: "#('CD-ROM' #('CD-R' 'CD-RW' 'DVD-ROM' 'DVD-R' 'DVD-R DL' 'DVD-RW' 'DVD+R' 'DVD+R DL' 'DVD+RW'))"
Makes sense so far, but if I change the above to:
...
driveTypeList := (driveType, additionalDriveType star) flatten.
...
Returns: "'CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-R, DVD-R DL, DVD-RW, DVD+R, DVD+R DL, DVD+RW'"
Instead of combining the arrays, it made one big string!?
How do I do this?
Thanks.
Sean
Cheers,
Sean