Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Post History

66%
+2 −0
Challenges Beaver Code Decryption

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(↑,⍥⊂↓)⍵} { } ...

posted 3y ago by user‭  ·  edited 2y ago by Shaggy‭

Answer
#5: Post edited by user avatar Shaggy‭ · 2021-08-16T17:35:41Z (over 2 years ago)
Fixed leaderboard
  • # [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 by user avatar user‭ · 2021-04-19T15:38:18Z (about 3 years ago)
  • # [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
  • ```
  • # [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 by user avatar user‭ · 2021-04-18T19:31:41Z (about 3 years ago)
  • # [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 by user avatar user‭ · 2021-04-18T19:25:56Z (about 3 years ago)
  • # [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 by user avatar user‭ · 2021-04-18T19:18:01Z (about 3 years ago)
# [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.