Well, that was not exactly what I was seeking (condense), but, that "toronto toolkit" looks like a very interesting piece of code/functions ...
deciphering/decoding/understanding each one should enlighten me on apl operators/data and usage. I will look at it. thanks, Xtian. On 2016-06-21 14:49, Fred Weigel wrote:
Christian Robert For this, try the "toronto toolkit" in our bits&pieces. There is a function "condense" ' ' condense ' a b c d ' a b c d Which is what you want (I think). Uses ∆db (delete blanks). Preferable to get from the toolkit -- functions reproduced below. ∇y←d condense v;b ⍝remove redundant blanks and blanks around characters specified in <d> ⍝.d 1985.6.20.10.10.10 ⍝.e 'apple,betty,cat,,dog' = ',' condense ' apple, betty, cat, , dog' ⍝.k delete-characters ⍝.t 1992.3.10.20.19.23 ⍝.v 1.1 ⍝v is character vector (rank 1) only ⍝remove leading, trailing, and multiple internal blanks y←∆db,v ⍝remove blanks around characters specified in <d> ⍝e.g. if <d> =<,>, blanks are removed around commas in 'a , b , d' b←y∈d y←(∼(y=' ')∧(1⌽b)∨¯1⌽b)/y ∇ ∇y←∆db v;b ⍝delete blanks (leading, trailing and multiple) from v (rank 0 - 2) ⍝.e 'apple betty cat' = ∆db ' apple betty cat ' ⍝.k delete-characters ⍝.v 1.1 →((0 1 2=⍴⍴v),1)/l1,l1,l2,err1 l1: b←' '≠v←' ',v y←1↓(b∨1⌽b)/v →0 l2: b←∨⌿' '≠v←' ',v y←0 1↓(b∨1⌽b)/v →0 err1:⎕←'∆db rank error' ∇