This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
(define modifiers | |
(hash 'inc + | |
'dec -)) | |
(define operations | |
(hash '> > | |
'< < | |
'!= (negate =) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
(define (part1 ls) | |
(for/sum ([n (map (curry argmax identity) ls)] | |
[m (map (curry argmin identity) ls)]) | |
(- n m))) | |
(define (part2 ls) | |
(for/sum ([line ls]) | |
(for/first ([n line] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'("KC_W" | |
"KC_ENTER" | |
"KC_K" | |
"KC_ENTER" | |
"KC_F" | |
"KC_ENTER" | |
"KC_B" | |
"KC_ENTER" | |
"KC_3" | |
"KC_QUOTE" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
(require db/base | |
db/postgresql | |
db/util/datetime | |
db/util/geometry) | |
(struct planet (id location conqueror-id name mine-limit) | |
#:transparent) | |
(struct ship (id player-id fleet-id name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This code is in the public domain. | |
""" | |
import unittest | |
def fib_loop(n): | |
x, y = 1, 0 | |
for _ in range(n): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang typed/racket | |
(: fib (Exact-Nonnegative-Integer . -> . Exact-Nonnegative-Integer)) | |
(define (fib n) | |
(cond | |
[(< n 2) 1] | |
[else (+ (fib (sub1 n)) | |
(fib (- n 2)))])) | |
I hereby claim:
- I am winny- on github.
- I am winny (https://keybase.io/winny) on keybase.
- I have a public key ASCR9dFI1NIe-EhBhNXCG_9LqyCUAo2tQdPwjoQyt1AR3Ao
To claim this, I am signing this object:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket/gui | |
(define f% | |
(class frame% | |
(super-new) | |
(define/override (on-subwindow-char recv ch) | |
(match (send ch get-key-code) | |
[#\q (send this show #f) #t] | |
[_ (super on-subwindow-char recv ch)])))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
(define (is ls) | |
(let loop ([ls ls] [acc '()]) | |
(if (empty? ls) | |
acc | |
(loop (cdr ls) (ins acc (car ls)))))) | |
(define (ins ls elem) | |
(if (or (empty? ls) (< elem (car ls))) |