w c l d _ _ u o y '
r s n t p k a e i h
_ f m g b j x , . _
w c l d _ _ y o u '
units: | |
# Parameters | |
# ========== | |
capx: 14.5 # Keycap dimensions | |
capy: 14.5 | |
kx: 15 # Key spacing dimensions | |
ky: 15 | |
# Constants | |
# ========= |
This was an exercise to take a peek at some different languages using a simple algorithm.
Average is an interesting algorithm to compare languanges. It is simple, but has enough complexity to demonstrate some differences between the languages.
Average requires calculating two different summary statistics (sum and count), then combining those two (division) into a single number. An efficient solution would only traverse the collection of numbers once.
Each of these are written as a function that would be given a collection of numbers. Whatever a collection means in that particular language. Some languages have multiple solutions that might have different tradeoffs.
library(tidyverse) | |
inventory <- read_csv( | |
"day01.txt", col_names = "calories", skip_empty_rows = FALSE | |
) | |
calories_by_elf <- | |
inventory |> | |
mutate(elf = cumsum(is.na(calories))) |> | |
drop_na() |> |
// Paste this into new blank query called Complete2 | |
(table as table, columnName1 as text, columnName2 as text) as table => | |
let | |
allColumnNames = Table.ColumnNames(table), | |
otherColumnNames = List.RemoveMatchingItems(allColumnNames, {columnName1, columnName2}), | |
crossed = Crossing2(table, columnName1, columnName2), | |
joined = Table.NestedJoin(crossed, {columnName1, columnName2}, table, {columnName1, columnName2}, "crossing", JoinKind.FullOuter), | |
expanded = Table.ExpandTableColumn(joined, "crossing", otherColumnNames), | |
reordered = Table.ReorderColumns(expanded, allColumnNames) |
import cadquery as cq, math | |
from typing import Optional | |
from dataclasses import dataclass | |
rot_axis_z = ((0, 0, 0), (0, 0, 1)) | |
@dataclass | |
class Config: | |
x: float = 18 # Width of key (not keycap) outline; length for thumbs | |
y: float = 17 # Length of key (not keycap) outline; width for thumbs |