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

60%
+1 −0
Challenges Create an Alphabet Diamond

Uiua, 38 bytes (SBCS) Full program, prints diamond to STDOUT. Some nifty tricks turned out to be longer than some straightforward ways. Uses one leading whitespace even on the longest line to make...

posted 6mo ago by ojdo‭

Answer
#1: Initial revision by user avatar ojdo‭ · 2026-03-25T16:52:30Z (6 months ago)
# [Uiua], 38 bytes (SBCS)

Full program, prints diamond to STDOUT. Some nifty tricks turned out to be longer than some straightforward ways. Uses one leading whitespace even on the longest line to make "`⍥@ `" work smoothly even then (it chokes on 0 input).

```uiua 
F ← &p⊂⟜(↘₁⇌)+@A&pf⍥@ ˜-26⟜⇡+1
≡F⊂⇡26⇌⇡25
```

[Uiua pad this online](https://uiua.org/pad?src=0_19_0-dev_2__RiDihpAgJnDiioLin5wo4oaY4oKB4oeMKStAQSZwZuKNpUAgy5wtMjbin5zih6ErMQriiaFG4oqC4oehMjbih4zih6EyNQo=)



_Scoring remark: I count "`F ← `" as 2 bytes, as it will be auto-formatted even when entering `F=`._

### Explanation

```
F ← &p⊂⟜(↘₁⇌)+@A&pf⍥@ ˜-26⟜⇡+1   # helper function F: print diamond line
≡F⊂⇡26⇌⇡25                        # apply F to range [0 ... 25 ... 0]
```
#### Helper function

```
&p⊂⟜(↘₁⇌)+@A&pf⍥@ ˜-26⟜⇡+1  # argument: diamond line number (0-based)
                             # example input: 4
                         +1  # 5   increment
                       ⟜⇡    # 5 [0 .. 4]  range, but keep on top
                   ˜-26      # 21 [0 .. 4] subtract from 26
               ⍥@           # " [...] " [0 .. 4] repeat " " that many times
            &pf              # [0 .. 4]  print string w/o trailing newline
         +@A                 # "ABCDE"  convert to character range
   ⟜(↘₁⇌)                    # "ABCDE" "DCBA" push reversed shortened character range, but keep original on top
&p⊂                          # join both and print them (with newline)
```

#### Main

```
      ⇌⇡25   # push [24 .. 0]
   ⇡26       # push [0 .. 25]
  ⊂          # join both [0 .. 24 25 24 .. 0]
≡F           # call F for each element
```

[uiua]: https://uiua.org/