Skip to content

Instantly share code, notes, and snippets.

@ingydotnet
Created August 2, 2024 19:43
Show Gist options
  • Save ingydotnet/00efd1c6b1ee419e56dc360b867d4f7e to your computer and use it in GitHub Desktop.
Save ingydotnet/00efd1c6b1ee419e56dc360b867d4f7e to your computer and use it in GitHub Desktop.
#!/usr/bin/env ys-0
langs =: slurp('languages.txt').str/split-lines()
data =:
reduce:
fn [data lang]:
maps =: lang.str('/config.json').slurp()
.json/load().exercises.practice
config =:
reduce:
fn [acc map]:
assoc acc: map.slug map
+{} |: maps
assoc data: lang config
+{} |: langs
defn slug(m): m.slug
exercises =:
data.vals().map(vals).flatten()
.map(slug).distinct().sort()
defn main():
each [exercise exercises]:
+[count difficulty] =: difficulty(exercise)
printf "%2d - %2.1f - %s\n":
count difficulty exercise
defn difficulty(exercise):
nums =:
reduce:
fn [acc data]:
conf =: data.vals().filter(\(%1.slug = exercise))
if seq(conf):
conj acc: conf.0.difficulty
=>: acc
+[] |: data.vals()
count =: nums.count()
avg =: nums.apply(+) / count / 1.0
=>: +[count avg]
37 - 2.1 - accumulate
66 - 2.4 - acronym
29 - 4.3 - affine-cipher
59 - 3.9 - all-your-base
65 - 3.3 - allergies
20 - 6.6 - alphametics
65 - 3.2 - anagram
63 - 2.1 - armstrong-numbers
58 - 3.5 - atbash-cipher
1 - 4.0 - automated-readability-index
29 - 4.5 - bank-account
1 - 4.0 - basics-monitor-rush
1 - 4.0 - basics-transformation-csv
1 - 4.0 - basics-transformation-json
1 - 4.0 - basics-transformation-xml
39 - 3.6 - beer-song
33 - 1.7 - binary
62 - 3.1 - binary-search
32 - 4.8 - binary-search-tree
64 - 2.5 - bob
26 - 5.9 - book-store
17 - 3.1 - bottle-song
31 - 5.8 - bowling
1 - 2.0 - calculator-service
29 - 5.7 - change
1 - 1.0 - cheryls-birthday
45 - 5.0 - circular-buffer
45 - 3.4 - clock
66 - 2.1 - collatz-conjecture
26 - 4.6 - complex-numbers
20 - 6.9 - connect
1 - 1.0 - counter
42 - 4.3 - crypto-square
28 - 5.0 - custom-set
1 - 1.0 - custom-signs
59 - 2.0 - darts
1 - 4.0 - database-employee-onboarding
1 - 4.0 - database-large-expenses
1 - 4.0 - database-payment-audit
1 - 4.0 - database-payment-batches
1 - 7.0 - decimal
45 - 3.8 - diamond
1 - 1.0 - die
68 - 1.8 - difference-of-squares
14 - 4.6 - diffie-hellman
42 - 2.7 - dnd-character
22 - 6.3 - dominoes
7 - 5.6 - dot-dsl
1 - 10.0 - doubly-linked-list
1 - 1.0 - echo-service
46 - 2.4 - eliuds-eggs
1 - 1.0 - elyses-enchantments
10 - 3.0 - error-handling
55 - 2.7 - etl
1 - 1.0 - fizz-buzz
1 - 7.0 - fizzy
33 - 3.2 - flatten-array
1 - 1.0 - floored
30 - 4.3 - food-chain
25 - 7.8 - forth
1 - 4.0 - freelancer-rates
12 - 5.2 - game-of-life
1 - 1.0 - garden-party
51 - 1.9 - gigasecond
1 - 8.0 - gilded-rose
10 - 7.7 - go-counting
43 - 3.6 - grade-school
64 - 2.2 - grains
1 - 1.0 - greeting-service
16 - 5.1 - grep
67 - 1.9 - hamming
7 - 7.3 - hangman
71 - 1.1 - hello-world
1 - 1.0 - hello-world-service
19 - 1.7 - hexadecimal
38 - 2.4 - high-scores
24 - 3.1 - house
1 - 4.0 - http-billion-dollar-question
1 - 4.0 - http-cake-is-a-lie
1 - 4.0 - http-salary-converter
43 - 3.1 - isbn-verifier
65 - 2.3 - isogram
1 - 1.0 - itab-aggregation
1 - 1.0 - itab-basics
1 - 1.0 - itab-combination
1 - 1.0 - itab-nesting
13 - 3.8 - killer-sudoku-helper
41 - 3.4 - kindergarten-garden
37 - 5.8 - knapsack
53 - 3.8 - largest-series-product
71 - 1.3 - leap
9 - 5.0 - ledger
1 - 2.0 - legacy-service-client
4 - 8.5 - lens-person
33 - 5.0 - linked-list
46 - 4.0 - list-ops
1 - 2.0 - lucians-luscious-lasagna
60 - 3.8 - luhn
1 - 4.0 - luhn-from
1 - 4.0 - luhn-trait
1 - 10.0 - macros
1 - 4.0 - majority-element
13 - 5.0 - markdown
1 - 3.0 - mask-credit-card
59 - 4.0 - matching-brackets
37 - 3.2 - matrix
2 - 8.0 - mazy-mice
42 - 4.5 - meetup
7 - 2.0 - micro-blog
1 - 2.0 - microwave
42 - 5.3 - minesweeper
45 - 3.6 - nth-prime
1 - 1.0 - nucleotide-codons
59 - 2.6 - nucleotide-count
25 - 5.0 - ocr-numbers
14 - 1.9 - octal
1 - 3.0 - order-management
1 - 2.0 - ordinal-number
3 - 5.0 - paasio
28 - 5.4 - palindrome-products
65 - 2.1 - pangram
23 - 5.4 - parallel-letter-frequency
49 - 3.7 - pascals-triangle
51 - 2.7 - perfect-numbers
55 - 3.1 - phone-number
45 - 4.3 - pig-latin
4 - 1.5 - point-mutations
20 - 6.7 - poker
13 - 8.8 - pov
46 - 3.1 - prime-factors
1 - 6.0 - promises
58 - 3.0 - protein-translation
35 - 2.7 - proverb
36 - 4.6 - pythagorean-triplet
1 - 5.0 - pythagorean-triplets
51 - 3.2 - queen-attack
26 - 5.2 - rail-fence-cipher
70 - 1.9 - raindrops
22 - 4.7 - rational-numbers
17 - 8.4 - react
20 - 6.2 - rectangles
48 - 1.5 - resistor-color
45 - 1.9 - resistor-color-duo
3 - 1.7 - resistor-color-expert
30 - 2.5 - resistor-color-trio
10 - 6.0 - rest-api
63 - 1.6 - reverse-string
69 - 1.8 - rna-transcription
36 - 3.8 - robot-name
51 - 3.9 - robot-simulator
67 - 3.5 - roman-numerals
54 - 3.2 - rotational-cipher
50 - 3.8 - run-length-encoding
33 - 3.5 - saddle-points
13 - 5.8 - satellite
37 - 5.2 - say
17 - 4.0 - scale-generator
63 - 2.5 - scrabble-score
59 - 2.7 - secret-handshake
1 - 2.0 - semi-structured-logs
44 - 2.8 - series
1 - 7.0 - service-composition
1 - 1.0 - service-invocation
11 - 7.5 - sgf-parsing
61 - 3.4 - sieve
27 - 4.5 - simple-cipher
25 - 4.4 - simple-linked-list
64 - 1.9 - space-age
42 - 4.5 - spiral-matrix
33 - 2.6 - square-root
11 - 4.6 - state-of-tic-tac-toe
40 - 2.4 - strain
1 - 5.0 - stream-ops
40 - 3.7 - sublist
55 - 2.2 - sum-of-multiples
23 - 4.7 - tournament
28 - 4.3 - transpose
7 - 4.9 - tree-building
64 - 2.3 - triangle
23 - 1.8 - trinary
26 - 3.1 - twelve-days
32 - 6.2 - two-bucket
65 - 1.2 - two-fer
23 - 5.5 - variable-length-quantity
1 - 1.0 - vehicle-purchase
55 - 3.3 - word-count
14 - 6.3 - word-search
33 - 5.2 - wordy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment