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

80%
+6 −0
Challenges Word Set Square

APL (Dyalog Unicode), 23 bytes Anonymous tacit prefix function. Reuires 0-based indexing (⎕IO←0) (⊢⍪⍨¯1↓⊢,∘↑-∘⍳∘≢↑¨⊢)⊢,⌽ Try it online! ⌽ reverse the argument ⊢, prepend the argument (…) ...

posted 4y ago by Adám‭

Answer
#1: Initial revision by user avatar Adám‭ · 2021-03-02T00:05:41Z (almost 4 years ago)
# [APL (Dyalog Unicode)], 23 bytes

<!-- language-all: lang-apl -->

Anonymous tacit prefix function. Reuires 0-based indexing (`⎕IO←0`)

    (⊢⍪⍨¯1↓⊢,∘↑-∘⍳∘≢↑¨⊢)⊢,⌽

[Try it online!][TIO-klr8th27]

`⌽` reverse the argument

`⊢,` prepend the argument

`(`…`)` apply the following tacit function to that:

&emsp;`⊢` on the characters of the argument

&emsp;…`↑¨` of each character, take this many characters:

&emsp; `-∘⍳∘≢` the negative indices \$0…\text{length}-1\$

&emsp;…`∘↑` mix list of strings into character matrix, then:

&emsp; `⊢,` prepend the argument (vertically)

&emsp;`¯1↓` drop the last row

&emsp;`⊢⍪⍨` append the argument below


[APL (Dyalog Unicode)]: https://www.dyalog.com/
[TIO-klr8th27]: https://tio.run/##SyzI0U2pTMzJT///qG@qp/@jtgkG/zUedS161LvqUe@KQ@sNH7VNBnJ1HnXMeNQ2URdE9W4GkZ2LgPxDK4BymmD5nr3/04C6H/X2PepqftS75lHvlkPrjYFqgOYGBzkDyRAPz@D/aQrqHqk5OfnqAA "APL (Dyalog Unicode) – Try It Online"