Skip to content

Instantly share code, notes, and snippets.

@dylannrees
Last active May 30, 2018 01:08
Show Gist options
  • Save dylannrees/ca51c12245f5e6c08d9c2f0e505713b7 to your computer and use it in GitHub Desktop.
Save dylannrees/ca51c12245f5e6c08d9c2f0e505713b7 to your computer and use it in GitHub Desktop.
Original list by Lynn
Columns: inspiring n-gram, frequency, suggested name, explanation
Œ!Q 13 Œ¡ Permutations without duplicates
Alternatively, make Ẓ an alias for Œ!, it's the 2nd most common 2-byte atom after ÆP
;ŒD 11 Œ* All rows/cols/diags/antidiags + reverse (→↘↓↙←↑↖↗) (UZ$3С;ŒD$€;/)
Œ# All rows and columns + reverse (→↓←↑) (UZ$3С;/)
Ð# Apply monad to all 90° rotations of z (UZ$3С<monad>€)
(example: ḢÐ# gets the “borders” of z)
Ṣ€Q 10 Œ$ Unique sortings
ṣ”. 10 ŒÑ Extract numerals
ØAḣ 9 ŒẠ Alphas. 4ŒẠ → “ABCD”
Œạ alphas. 4Œạ → “abcd”
ịØA 8 ŒA Alpha. 4ŒA → “D” (Maybe 28ŒA is “AB” à la Excel?)
Œa alpha. 4Œa → “d”
z⁶Z 9 Œ⁶ Pad to rectangle with spaces (œ⁶: width y)
Œ⁷ Same, but paddding to the left (œ⁷: width y)
Œ⁸ Same, but center
z0Z 8 Œ0 Pad to rectangle with zeros (œ0: width y)
Œ⁴ Same, but padding to the left (œ⁴: width y)
Œ⁵ Same, but center
ÐṀḢ 9 Ðṁ First argmax
Ðṃ First argmin
ṢŒr 9 Œf Frequencies
⁶ẋż 8 œ{ Prefix x with y spaces
œ} Suffix x with y spaces
æl/ 8 ÆL LCM of list. auto-ranges to LCM of [1..n]
ĠL€ 8 ŒĠ Index group lengths
ØAṙ 7 ŒÆ z-times rotated uppercase alphabet
ξ z-times rotated lowercase alphabet
‘ịØ 7 ŒH Mod 16 → to uppercase hex digit
Œh Mod 16 → to lowercase hex digit
ŒƁ Mod 64 → to uppercase b64 digit
Œɓ Mod 64 → to lowercase b64 digit
ÆfQ 7 Æṗ Primes dividing z
Ḋm2 6 Œ2 z[1::2]
LÐṂ 6 ŒS First shortest element
ŒṢ All shortest elements
ŒL First longest element
ŒḶ All longest elements
DS$ 6 Æ+ Digit sum
ŒcS 6 Œ¢ Sum pairs without replacement (ŒcS€)
[x+y for (i,x) in z for (j,y) in z if i!=j]
BUz0 7 Œb Binary matrix: B€Uz0ZU
œb Same, but y bits wide instead of “as wide as needed”
ŒPS€ 6 Œ+ Subset sums
ÐĿL’ 5 ÐI Count iterations
пL’ 5 ÐW Count while-loop iterations
ÐA Alternate. (pops two links, short for 2ƭ€)
0,0j 4 Œ: Surround with zeroes.
œ: Prepend and append y.
0;+\ 4 ŒỊ Cumulate from 0 (a right inverse function for I)
ŒṖÇ€ 4 ÐṖ Apply to each partition
***********************************
Implemented
Ðf 147 Ƈ comb
Ѐ 103 Ɱ map
ÐĿ 53 Ƭ 'till
ÆP 72 Ẓ isprime?
œṗ 40 k cut
æ. 22 ḋ dot product
S€ 77 § depth-1 sum
+\ 70 Ä cumulate
œs2 15 ŒH Split in two equal halves
s2Z 10 Œœ Odd-even: “abcdefg”Œœ → “aceg”,“bdf”
JḤ$¦ 5 Ðe Apply to even indices
Ðo Apply to odd indices
Œe Get elements at even indices.
Œo Get elements at odd indices.
ŒgL 10 Œɠ Group lengths (ŒgL€)
UŒD 7 Œd Antidiagonals (↙)
ŒḌU Œḍ From antidiagonals
Ṭœṗ 11 œṖ Split y after indices x (‘Ṭœṗ)
œP Split y at indices x, removing those indices (Ṭœp)
0; Ż Prepend with 0. For integers, 0..n.
0,0 7 Ø0 Nilad 0,0
Ø1 Nilad 1,1
Ø2 Nilad 2,2
Ø. Nilad 0,1
ؽ Nilad 1,2
Ø+ Nilad 1,-
Ø- Nilad -,1
Ø[ Nilad “[]”
Ø{ Nilad “{}”
Ø< Nilad “<>”
Ø( Nilad “()”
Ø^ Nilad “/\”
Ø⁷ Nilad 128
Ø° Nilad 360
Ø⁵ 250
ØẠ 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
ØḄ 'bcdfghjklmnpqrstvwxyz'
ØḂ 'BCDFGHJKLMNPQRSTVWXYZ'
ØỴ 'bcdfghjklmnpqrstvwxz'
ØẎ 'BCDFGHJKLMNPQRSTVWXZ'
Øẹ 'aeiou'
Øė 'AEIOU'
Øỵ 'aeiouy'
Øẏ 'AEIOUY'
®‘© 5 ‘ɼ Nilad that counts up every time it is evaluated (starting from 1)
<link>ɼ in general is ®<link>©
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment