Post History
APL(Dyalog Unicode), 34 29 bytes SBCS Saved 5 bytes thanks to Razetime! {2>s←⌈2÷⍨≢⍵:⍵⋄,⍉↑∇¨s(↑,⍥⊂↓)⍵} Try it on APLgolf! {2>s←⌈2÷⍨≢⍵:⍵⋄,⍉↑∇¨s(↑,⍥⊂↓)⍵} { } ...
Answer
#5: Post edited
# [APL(Dyalog Unicode)][1], <sup><s>34</s></sup>29 bytes <sup>[SBCS][2]</sup>- Saved 5 bytes thanks to Razetime!
- ```
- {2>s←⌈2÷⍨≢⍵:⍵⋄,⍉↑∇¨s(↑,⍥⊂↓)⍵}
- ```
- [Try it on APLgolf!](https://razetime.github.io/APLgolf/?h=AwA&c=qzayK37UNuFRT4fR4e2Pelc86lz0qHerFRA/6m7RedTb@aht4qOO9kMrijWALKDA0kddTY/aJmsCVdQCAA&f=S1NQdw6JDPIPUOdKU1B39Y90DvHzCwjyBHODQv1d/dyCXR3dfINcPELUAQ&i=S1NQdw6JDPIPUOdKU1B39Y90DvHzCwjyBHODQv1d/dyCXR3dfINcPELUAQ&r=tryAPL&l=apl-dyalog-extended&m=dfn&n=f)
- [1]: https://dyalog.com
- [2]: https://github.com/abrudz/SBCS
- ```
- {2>s←⌈2÷⍨≢⍵:⍵⋄,⍉↑∇¨s(↑,⍥⊂↓)⍵}
- { } ⍝ Define a dfn taking argument ⍵
- s→ ⍝ s will be the size of one half of ⍵
- ≢⍵ ⍝ Length of ⍵
- 2÷⍨ ⍝ Divided by two
- ⌈ ⍝ Rounded up
- 2> ⍝ If s is 1 (⍵ has 1 or 2 elements):
- :⍵ ⍝ Just return ⍵
- ⋄ ⍝ Otherwise
- s(↑ ↓)⍵ ⍝ Train with first s elements of ⍵ on left
- ⍝ And second half of ⍵ on right
- ⍥ ⍝ For both halves
- ⊂ ⍝ Box them
- , ⍝ Join into vector
- ∇¨ ⍝ Run this function again on each half
- ↑ ⍝ Turn into a character matrix
- ⍉ ⍝ Transpose
- , ⍝ Concatenate to interleave them together
- ```
- # [APL(Dyalog Unicode)][1], <sup><s>34</s></sup> 29 bytes <sup>[SBCS][2]</sup>
- Saved 5 bytes thanks to Razetime!
- ```
- {2>s←⌈2÷⍨≢⍵:⍵⋄,⍉↑∇¨s(↑,⍥⊂↓)⍵}
- ```
- [Try it on APLgolf!](https://razetime.github.io/APLgolf/?h=AwA&c=qzayK37UNuFRT4fR4e2Pelc86lz0qHerFRA/6m7RedTb@aht4qOO9kMrijWALKDA0kddTY/aJmsCVdQCAA&f=S1NQdw6JDPIPUOdKU1B39Y90DvHzCwjyBHODQv1d/dyCXR3dfINcPELUAQ&i=S1NQdw6JDPIPUOdKU1B39Y90DvHzCwjyBHODQv1d/dyCXR3dfINcPELUAQ&r=tryAPL&l=apl-dyalog-extended&m=dfn&n=f)
- [1]: https://dyalog.com
- [2]: https://github.com/abrudz/SBCS
- ```
- {2>s←⌈2÷⍨≢⍵:⍵⋄,⍉↑∇¨s(↑,⍥⊂↓)⍵}
- { } ⍝ Define a dfn taking argument ⍵
- s→ ⍝ s will be the size of one half of ⍵
- ≢⍵ ⍝ Length of ⍵
- 2÷⍨ ⍝ Divided by two
- ⌈ ⍝ Rounded up
- 2> ⍝ If s is 1 (⍵ has 1 or 2 elements):
- :⍵ ⍝ Just return ⍵
- ⋄ ⍝ Otherwise
- s(↑ ↓)⍵ ⍝ Train with first s elements of ⍵ on left
- ⍝ And second half of ⍵ on right
- ⍥ ⍝ For both halves
- ⊂ ⍝ Box them
- , ⍝ Join into vector
- ∇¨ ⍝ Run this function again on each half
- ↑ ⍝ Turn into a character matrix
- ⍉ ⍝ Transpose
- , ⍝ Concatenate to interleave them together
- ```
#4: Post edited
# [APL(Dyalog Unicode)][1], <sup><s></s></sup>34 bytes <sup>[SBCS][2]</sup>- ```
≢↑{2>s←⌈2÷⍨≢⍵:⍵⋄s(↑(∊,¨)⍥(s↑∇)↓)⍵}- ```
[Try it on APLgolf!](https://razetime.github.io/APLgolf/?h=AwA&c=e9S56FHbxGoju@JHbRMe9XQYHd7@qHfFI6Bo71YrIH7U3VKsAVSh8aijS@fQCs1HvUs1gEonPupo13zUNhnI31oLAA&f=S1NQdw6JDPIPUOdKU1B39Y90DvHzCwjyBHODQv1d/dyCXR3dfINcPELUAQ&i=AwA&r=tryAPL&l=apl-dyalog&m=dfn&n=f)- [1]: https://dyalog.com
- [2]: https://github.com/abrudz/SBCS
- ```
{2>s←⌈2÷⍨≢⍵:⍵⋄s(↑(∊,¨)⍥(s↑∇)↓)⍵}{ } ⍝ Define a dfn taking argument ⍵s→ ⍝ s will be the size of one half of ⍵≢⍵ ⍝ Length of ⍵2÷⍨ ⍝ Divided by two⌈ ⍝ Rounded up2> ⍝ If s is 1 (⍵ has 1 or 2 elements)::⍵ ⍝ Just return ⍵s(↑ ↓)⍵ ⍝ Train with first s elements of ⍵ on left⍝ And second half of ⍵ on right⍥ ⍝ For both halves∇ ⍝ Run this function on them agains↑ ⍝ Then take the first s elements (pad a space if needed),¨ ⍝ Pairs of corresponding elements in each half∊ ⍝ Flatten, interleaving the two halves- ```
- # [APL(Dyalog Unicode)][1], <sup><s>34</s></sup>29 bytes <sup>[SBCS][2]</sup>
- Saved 5 bytes thanks to Razetime!
- ```
- {2>s←⌈2÷⍨≢⍵:⍵⋄,⍉↑∇¨s(↑,⍥⊂↓)⍵}
- ```
- [Try it on APLgolf!](https://razetime.github.io/APLgolf/?h=AwA&c=qzayK37UNuFRT4fR4e2Pelc86lz0qHerFRA/6m7RedTb@aht4qOO9kMrijWALKDA0kddTY/aJmsCVdQCAA&f=S1NQdw6JDPIPUOdKU1B39Y90DvHzCwjyBHODQv1d/dyCXR3dfINcPELUAQ&i=S1NQdw6JDPIPUOdKU1B39Y90DvHzCwjyBHODQv1d/dyCXR3dfINcPELUAQ&r=tryAPL&l=apl-dyalog-extended&m=dfn&n=f)
- [1]: https://dyalog.com
- [2]: https://github.com/abrudz/SBCS
- ```
- {2>s←⌈2÷⍨≢⍵:⍵⋄,⍉↑∇¨s(↑,⍥⊂↓)⍵}
- { } ⍝ Define a dfn taking argument ⍵
- s→ ⍝ s will be the size of one half of ⍵
- ≢⍵ ⍝ Length of ⍵
- 2÷⍨ ⍝ Divided by two
- ⌈ ⍝ Rounded up
- 2> ⍝ If s is 1 (⍵ has 1 or 2 elements):
- :⍵ ⍝ Just return ⍵
- ⋄ ⍝ Otherwise
- s(↑ ↓)⍵ ⍝ Train with first s elements of ⍵ on left
- ⍝ And second half of ⍵ on right
- ⍥ ⍝ For both halves
- ⊂ ⍝ Box them
- , ⍝ Join into vector
- ∇¨ ⍝ Run this function again on each half
- ↑ ⍝ Turn into a character matrix
- ⍉ ⍝ Transpose
- , ⍝ Concatenate to interleave them together
- ```
#3: Post edited
# [APL(Dyalog Unicode)][1], <sup><s></s></sup>32 bytes <sup>[SBCS][2]</sup>- ```
{2>s←⌈2÷⍨≢⍵:⍵⋄s(↑(∊,¨)⍥(s↑∇)↓)⍵}- ```
[Try it on APLgolf!](https://razetime.github.io/APLgolf/?h=AwA&c=qzayK37UNuFRT4fR4e2Pelc86lz0qHerFRA/6m4p1njUNlHjUUeXzqEVmo96l2oAlU581NGu@ahtMpC/tRYA&f=S1NQdw6JDPIPUOdKU1B39Y90DvHzCwjyBHODQv1d/dyCXR3dfINcPELUAQ&i=AwA&r=tryAPL&l=apl-dyalog&m=dfn&n=f)- [1]: https://dyalog.com
- [2]: https://github.com/abrudz/SBCS
- ```
- {2>s←⌈2÷⍨≢⍵:⍵⋄s(↑(∊,¨)⍥(s↑∇)↓)⍵}
- { } ⍝ Define a dfn taking argument ⍵
- s→ ⍝ s will be the size of one half of ⍵
- ≢⍵ ⍝ Length of ⍵
- 2÷⍨ ⍝ Divided by two
- ⌈ ⍝ Rounded up
- 2> ⍝ If s is 1 (⍵ has 1 or 2 elements):
- :⍵ ⍝ Just return ⍵
- s(↑ ↓)⍵ ⍝ Train with first s elements of ⍵ on left
- ⍝ And second half of ⍵ on right
- ⍥ ⍝ For both halves
- ∇ ⍝ Run this function on them again
- s↑ ⍝ Then take the first s elements (pad a space if needed)
- ,¨ ⍝ Pairs of corresponding elements in each half
- ∊ ⍝ Flatten, interleaving the two halves
- ```
- # [APL(Dyalog Unicode)][1], <sup><s></s></sup>34 bytes <sup>[SBCS][2]</sup>
- ```
- ≢↑{2>s←⌈2÷⍨≢⍵:⍵⋄s(↑(∊,¨)⍥(s↑∇)↓)⍵}
- ```
- [Try it on APLgolf!](https://razetime.github.io/APLgolf/?h=AwA&c=e9S56FHbxGoju@JHbRMe9XQYHd7@qHfFI6Bo71YrIH7U3VKsAVSh8aijS@fQCs1HvUs1gEonPupo13zUNhnI31oLAA&f=S1NQdw6JDPIPUOdKU1B39Y90DvHzCwjyBHODQv1d/dyCXR3dfINcPELUAQ&i=AwA&r=tryAPL&l=apl-dyalog&m=dfn&n=f)
- [1]: https://dyalog.com
- [2]: https://github.com/abrudz/SBCS
- ```
- {2>s←⌈2÷⍨≢⍵:⍵⋄s(↑(∊,¨)⍥(s↑∇)↓)⍵}
- { } ⍝ Define a dfn taking argument ⍵
- s→ ⍝ s will be the size of one half of ⍵
- ≢⍵ ⍝ Length of ⍵
- 2÷⍨ ⍝ Divided by two
- ⌈ ⍝ Rounded up
- 2> ⍝ If s is 1 (⍵ has 1 or 2 elements):
- :⍵ ⍝ Just return ⍵
- s(↑ ↓)⍵ ⍝ Train with first s elements of ⍵ on left
- ⍝ And second half of ⍵ on right
- ⍥ ⍝ For both halves
- ∇ ⍝ Run this function on them again
- s↑ ⍝ Then take the first s elements (pad a space if needed)
- ,¨ ⍝ Pairs of corresponding elements in each half
- ∊ ⍝ Flatten, interleaving the two halves
- ```
#2: Post edited
# [APL(Dyalog Unicode)][1], <sup><s></s></sup>33 bytes <sup>[SBCS][2]</sup>- ```
{2>s←⌈2÷⍨≢⍵:⍵⋄s(↑(,,⍤0)⍥(s↑∇)↓)⍵}- ```
[Try it on APLgolf!](https://razetime.github.io/APLgolf/?h=AwA&c=qzayK37UNuFRT4fR4e2Pelc86lz0qHerFRA/6m4p1njUNlFDR@dR7xIDzUe9SzWASic@6mjXfNQ2GcjfWgsA&f=S1NQdw6JDPIPUOdKU1B39Y90DvHzCwjyBHODQv1d/dyCXR3dfINcPELUAQ&i=AwA&r=tryAPL&l=apl-dyalog&m=dfn&n=f)- [1]: https://dyalog.com
- [2]: https://github.com/abrudz/SBCS
Explanation coming soon.
- # [APL(Dyalog Unicode)][1], <sup><s></s></sup>32 bytes <sup>[SBCS][2]</sup>
- ```
- {2>s←⌈2÷⍨≢⍵:⍵⋄s(↑(∊,¨)⍥(s↑∇)↓)⍵}
- ```
- [Try it on APLgolf!](https://razetime.github.io/APLgolf/?h=AwA&c=qzayK37UNuFRT4fR4e2Pelc86lz0qHerFRA/6m4p1njUNlHjUUeXzqEVmo96l2oAlU581NGu@ahtMpC/tRYA&f=S1NQdw6JDPIPUOdKU1B39Y90DvHzCwjyBHODQv1d/dyCXR3dfINcPELUAQ&i=AwA&r=tryAPL&l=apl-dyalog&m=dfn&n=f)
- [1]: https://dyalog.com
- [2]: https://github.com/abrudz/SBCS
- ```
- {2>s←⌈2÷⍨≢⍵:⍵⋄s(↑(∊,¨)⍥(s↑∇)↓)⍵}
- { } ⍝ Define a dfn taking argument ⍵
- s→ ⍝ s will be the size of one half of ⍵
- ≢⍵ ⍝ Length of ⍵
- 2÷⍨ ⍝ Divided by two
- ⌈ ⍝ Rounded up
- 2> ⍝ If s is 1 (⍵ has 1 or 2 elements):
- :⍵ ⍝ Just return ⍵
- s(↑ ↓)⍵ ⍝ Train with first s elements of ⍵ on left
- ⍝ And second half of ⍵ on right
- ⍥ ⍝ For both halves
- ∇ ⍝ Run this function on them again
- s↑ ⍝ Then take the first s elements (pad a space if needed)
- ,¨ ⍝ Pairs of corresponding elements in each half
- ∊ ⍝ Flatten, interleaving the two halves
- ```
#1: Initial revision
# [APL(Dyalog Unicode)][1], <sup><s></s></sup>33 bytes <sup>[SBCS][2]</sup> ``` {2>s←⌈2÷⍨≢⍵:⍵⋄s(↑(,,⍤0)⍥(s↑∇)↓)⍵} ``` [Try it on APLgolf!](https://razetime.github.io/APLgolf/?h=AwA&c=qzayK37UNuFRT4fR4e2Pelc86lz0qHerFRA/6m4p1njUNlFDR@dR7xIDzUe9SzWASic@6mjXfNQ2GcjfWgsA&f=S1NQdw6JDPIPUOdKU1B39Y90DvHzCwjyBHODQv1d/dyCXR3dfINcPELUAQ&i=AwA&r=tryAPL&l=apl-dyalog&m=dfn&n=f) [1]: https://dyalog.com [2]: https://github.com/abrudz/SBCS Explanation coming soon.