I hereby claim:
- I am gigamonkey on github.
- I am peterseibel (https://keybase.io/peterseibel) on keybase.
- I have a public key whose fingerprint is 54F4 4A67 9127 A7FB 5398 B1E1 B4A6 DD7D 735E 60D3
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| #!/usr/bin/env python3 | |
| # Reader -- parses text to something, some structure. | |
| # Python lists for lists. | |
| # Instances of Symbol for symbols. | |
| # Numbers for numbers. | |
| # Strings for strings. | |
| # ??? for functions |
| import java.text.SimpleDateFormat; | |
| import java.util.Calendar; | |
| import java.util.Date; | |
| import java.util.TimeZone; | |
| import java.util.GregorianCalendar; | |
| public class Foo { | |
| public static void main(String[] argv) { | |
| TimeZone utc = TimeZone.getTimeZone("UTC"); |
| import Data.Array | |
| import Data.Maybe | |
| import Data.List.Split | |
| import System.Environment | |
| import System.IO | |
| direction "n" = \(r, c) -> (r - 1, c) | |
| direction "s" = \(r, c) -> (r + 1, c) | |
| direction "e" = \(r, c) -> (r, c + 1) | |
| direction "w" = \(r, c) -> (r, c - 1) |
| -- Problem statement: | |
| -- Write a program that outputs all possibilities to put + or - or nothing between the | |
| -- numbers 1, 2, ..., 9 (in this order) such that the result is always 100. | |
| -- For example: 1 + 2 + 34 – 5 + 67 – 8 + 9 = 100. | |
| data Item = Plus | Minus | Num Int deriving (Show) | |
| hundreds = filter ((100 ==) . eval) $ map combineAdjacent $ combos [1..9] | |
| -- Generate all combos of digits 1-9 with +, -, or nothing in between. |
“[A] good problem description had to satisfy everyone. If two people saw a problem from a different point of view, both people’s points of view were merged into the problem description, making the problem more complicated, and making solutions sometimes harder to achieve. But this was essential to addressing porting problems, for example. One couldn’t just solve how a file system operation would work on one operating system unless the solution was going to work on other operating systems, too. On the other hand, the “proposal” field was very different. If two people disagreed on a proposal, they each wrote their own proposal so that proposals could be internally consistent and coherent. This meant that a single problem often had several proposed solutions with different costs and benefits, and the committee had to decide which was the stronger proposal.”
From http://www.nhplace.com/kent/Papers/cl-untold-story.html
| . 5 . | . . 1 | 4 7 9 | |
| . . 2 | 7 . . | . . 8 | |
| . . . | . 4 6 | 2 . . | |
| ------+-------+------ | |
| . 4 6 | . . 9 | 5 3 7 | |
| . . . | . 6 . | . . . | |
| 8 9 3 | 5 . . | 6 4 . | |
| ------+-------+------ | |
| . . 9 | 6 1 . | . . . | |
| 1 . . | . . 2 | 3 . . |
| #!/usr/bin/env python3 | |
| # Two solutions to http://www.bittorrent.com/company/about/developer_challenge | |
| from itertools import combinations | |
| bowls = 40 | |
| oranges = 9 | |
| def brute_force(): |
| // #notes is DIV with overflow: scroll and currentParagraph is an element within that DIV. | |
| // I'm trying to arrange things so that currentParagraph appears at the top of the DIV. | |
| // The trick seems to be to set position: absolute on #notes so it will be the | |
| // offsetParent of its elements and then to scroll like this: | |
| $('#notes').scrollTop($('#notes').scrollTop() + $(currentParagraph).position().top); |
| (defun random-population (size p) | |
| (loop repeat size collect (< (random 1d0) p))) | |
| (defun population (size p) | |
| (let ((pop (make-array size :initial-element nil))) | |
| (loop for i below (round (* size p)) | |
| do (setf (aref pop i) t)) | |
| pop)) | |
| (defun p (population) |