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
load 'viewmat' | |
gen_table =: 4 : '(0j1*(i: x)) +/ i: y' | |
fractal =: 1 : 0 | |
: | |
x u"0 (y +~ 30000 %~ 150 gen_table 150) NB. resolution and scale, not sure how to decouple them | |
) | |
collatz =: 4 %~ 2 + (7*]) - (2+5*])* 2 o. o. | |
is_bounded_c =: 4 : '((0: collatz^:x) :: 1:) y' NB. collatz |
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
import numpy as np | |
import matplotlib.cm as cm | |
import matplotlib.pyplot as plt | |
header, *lines = open("map2.txt").read().splitlines() | |
R = float(header.split()[2]) | |
H, W = len(lines), len(lines[0]) | |
crops = [] | |
for y, line in enumerate(lines): | |
for x, c in enumerate(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
1!:44 ;}:<;.1> (4!:4<'thisfile'){(4!:3) thisfile=.'' NB. boilerplate to set the working directory | |
input =: cutopen 0 : 0 | |
9 6 | |
A000055 1, 1, 1, 1, 2, 3, 6, 11, 23, 47 | |
A000045 0, 1, 1, 2, 3, 5, 8, 13, 21, 34 | |
A050278 1029, 1028, 1029, 1027, 1028, 1027, 1029, 1028, 1029, 1026 | |
A000010 1, 1, 2, 2, 4, 2, 6, 4, 6, 4 | |
A194508 _1, 1, 0, 2, 1, 0, 2, 1, 3, 2 | |
A000111 1, 1, 1, 2, 5, 16, 61, 272, 1385, 7936 |
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
6 1 1 | |
T H T L E D | |
P E N U R G | |
I G S D I S | |
Y G A W S I | |
W H L Y N T | |
I T A R G I |
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
main.o: file format elf64-x86-64 | |
Disassembly of section .text: | |
0000000000000000 <_Z16NormalizedVectorRKN2sf7Vector2IfEE>: | |
0: 48 83 ec 28 sub rsp,0x28 | |
4: f3 0f 10 0f movss xmm1,DWORD PTR [rdi] | |
8: f3 0f 10 47 04 movss xmm0,DWORD PTR [rdi+0x4] |
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
whence =: verb define | |
select. 4!:0 < y | |
case. _2 do. 'invalid name' | |
case. _1 do. 'name not defined' | |
case. 0;1;2;3 do. | |
index =. 4!:4 < y | |
select. * >: index | |
case. 0 do. 'name defined locally' | |
case. 1 do. > index { 4!:3'' | |
end. |
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
#include <utility> | |
namespace detail | |
{ | |
template <typename Fun> | |
struct function_params | |
: public function_params<decltype(&Fun::operator())> | |
{}; | |
template <typename Class, typename Ret, typename... Args> // for lambdas |
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
# [2015-06-01] Challenge #217 [Easy] Lumberjack Pile Problem | |
# http://www.reddit.com/r/dailyprogrammer/comments/3840rp/20150601_challenge_217_easy_lumberjack_pile/ | |
n, to_place, *piles = [int(n) for n in open("input.txt").read().split()] | |
print(len(piles)) | |
def get_smallest(piles): | |
smallest, second = piles[0], piles[0] | |
for i, pile in enumerate(piles): |
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
# [2015-06-05] Challenge #217 [Practical Exercise] TeXSCII | |
# http://www.reddit.com/r/dailyprogrammer/comments/38nhgx/20150605_challenge_217_practical_exercise_texscii/ | |
class Symbol: | |
def size(self): | |
raise Exception("should not be used") | |
def draw(self, canvas, x, y): | |
raise Exception("should not be used") | |
def __repr__(self): | |
if self.contents: |
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
#include <iostream> | |
using namespace std; | |
int left; | |
int main() { | |
left = 1; | |
} |