abrudz / aplcart

A novel approach to finding your way in APL
https://aplcart.info/
Other
133 stars 18 forks source link

"interpose" "intersperse" #105

Closed justin2004 closed 2 years ago

justin2004 commented 2 years ago

Suggested additional code entry

      interpose←{(⊣,⍺,⊢)/⍵}
      ',' interpose 'hithere'
┌─────────────┐
│h,i,t,h,e,r,e│
└─────────────┘

Clojure has an interpose function. Haskell calls it intersperse.

justin2004 commented 2 years ago

oh i just noticed that "Join elements of vector Yv with separator Xs" exists with same result.

maybe it just needs to be tagged with these terms? i kind of like the reduction implementation as well though because it "looks" like the result.

abrudz commented 2 years ago

I've added those two keywords.

While the reduction is elegant, it is also hugely inefficient.