(+,8 16{(⎕D,⎕A)[⍺⊥⍣¯1⊢⍵]}¨⊢)⊃1
(+,8 16{(⎕D,⎕A)[⍺⊥⍣¯1⊢⍵]}¨⊢) # The ambivalent function:
+ # monadic: identity (*); dyadic: left + right
, # concatenated with
8 16{(⎕D,⎕A)[⍺⊥⍣¯1⊢⍵]}¨⊢ # octal and hexadecimal versions:
{(⎕D,⎕A)[⍺⊥⍣¯1⊢⍵]} # dyadic function to convert int to base-n string:
(⎕D,⎕A) # digits concatenated to alphabet
[ ] # indexed by
⍵ # right argument
⊥⍣¯1 # in base (returns digit vector, e.g. 42 in base-16 is [2, 10])
⍺ # left argument
¨ # applied to:
8 ⊢ # 8 and right argument,
16 ⊢ # 16 and right argument,
# To Summarize:
# monadic version returns: [arg, oct(arg), hex(arg)]
# dyadic version returns: [left + right, oct(right), hex(right)]
# since left argument is always 1 when snippet is repeated, we can simplify it to
# [1 + right, oct(right), hex(right)]
⊃ # pick first (extracts the current count)
# when snippet is repeated this would be in front of all the dyadic calls
# but not in front of the final monadic call
1 # The initial count
💎