Skip to content

Instantly share code, notes, and snippets.

@kramano
kramano / parser.ts
Last active February 8, 2025 10:33
type SuccessResult = {
success: true;
parsed: string;
rest: string;
captures: Record<string, string>;
};
type FailureResult = {
success: false;
};

Take-home functional programming interview

This document is licensed CC0.

These are some questions to give a sense of what you know about FP. This is more of a gauge of what you know, it's not necessarily expected that a single person will breeze through all questions. For each question, give your answer if you know it, say how long it took you, and say whether it was 'trivial', 'easy', 'medium', 'hard', or 'I don't know'. Give your answers in Haskell for the questions that involve code.

Please be honest, as the interviewer may do some spot checking with similar questions. It's not going to look good if you report a question as being 'trivial' but a similar question completely stumps you.

Here's a bit more guidance on how to use these labels:

Tuning Storm+Trident

Tuning a dataflow system is easy:

The First Rule of Dataflow Tuning:
* Ensure each stage is always ready to accept records, and
* Deliver each processed record promptly to its destination
<?xml version="1.0" encoding="UTF-8"?>
<keymap version="1" name="Mac OS X 10.5+ Cursive" parent="Mac OS X 10.5+">
<action id=":plugin.actions.paredit/backward">
<keyboard-shortcut first-keystroke="shift meta H" />
</action>
<action id=":plugin.actions.paredit/backward-down">
<keyboard-shortcut first-keystroke="control meta U" />
</action>
<action id=":plugin.actions.paredit/backward-up">
<keyboard-shortcut first-keystroke="shift meta U" />
@kramano
kramano / latency.markdown
Created December 11, 2012 10:56 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@kramano
kramano / maximum_battery_life.md
Created March 20, 2012 11:51 — forked from mrflip/maximum_battery_life.md
maximum battery life checklist -- use before a long plane flight

Max Battery Life Checklist

Here is a checklist to follow if you want maximum battery life -- for instance if you're about to get on a long plane flight.

10 hour battery life on a non-SSD Macbook Pro 17"

Low power use checklist

With power connected: