howto: join list of strings with "+" and avoid dropping chars

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #000000; background-color: #ffffff}p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #000000; background-color: #ffffff; min-height: 16.0px}span.s1 {font-variant-ligatures: no-common-ligatures}

q)\cat s.txt

“FLR”

“MLM”

“VMC”

“MTX”

“JEC”

q)a:read0 `:s.txt

q)a

“FLR”

“MLM”

“VMC”

“MTX”

“JEC”


// first try … couldn’t join the strings in the way I wanted…

q)“+” ,/:a

“+FLR”

“+MLM”

“+VMC”

“+MTX”

“+JEC”

q)“S”$“+” ,/:a

+FLR+MLM+VMC+MTX`+JEC


// second try, this is closer, but it appends an extra “+”

q)a

“FLR”

“MLM”

“VMC”

“MTX”

“JEC”

q)

q)b:a ,:“+”

q)b

“FLR+”

“MLM+”

“VMC+”

“MTX+”

“JEC+”

q)

q)c:“” ,/b

q)c

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #000000; background-color: #ffffff}span.s1 {font-variant-ligatures: no-common-ligatures}

“FLR+MLM+VMC+MTX+JEC+”

q)-1 _ c

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #000000; background-color: #ffffff}span.s1 {font-variant-ligatures: no-common-ligatures}

“FLR+MLM+VMC+MTX+JEC”


// third try … still have to drop the first char … grr

// is it possible to append “+” between each string and join in one step without dropping a char?

q)1_“”,/“+”,/:a

“FLR+MLM+VMC+MTX+JEC”

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #000000; background-color: #ffffff}span.s1 {font-variant-ligatures: no-common-ligatures} p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #000000; background-color: #ffffff}span.s1 {font-variant-ligatures: no-common-ligatures} p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #000000; background-color: #ffffff}span.s1 {font-variant-ligatures: no-common-ligatures}

q)“+” sv (“ABC”;“DEF”;“GHI”)

“ABC+DEF+GHI”