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
Set Implicit Arguments. | |
Unset Strict Implicit. | |
Require Import Arith. | |
(* Base "から" 始まる "自然数" *) | |
Inductive number := | |
| Base: number | |
| Next: number -> number. |
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
calling function <SNR>12_info(' | |
') | |
line 1: if empty(a:char) | |
line 2: return 'NUL' | |
line 3: endif | |
line 4: let charseq = a:char | |
line 5: let outs = [] | |
line 6: while !empty(charseq) | |
line 7: let nr = charseq ==# "\n" ? 0 : char2nr(charseq) | |
line 8: let char = nr < 32 ? '^'.nr2char(64 + nr) : nr2char(nr) |
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
#!/usr/bin/env python3 | |
# coding:utf-8 | |
from textwrap import dedent | |
import PIL.Image as img | |
import numpy as np | |
import sys | |
from rgbtoansi import colorize_bg | |
def get_termsize(): |
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
float GM = 2500; | |
Mass sun = new Mass(0,0,0,0,0); | |
Mass earth; | |
int wid = 800; | |
int hei = 800; | |
void setup(){ | |
size(wid,hei); | |
ellipseMode(CENTER); | |
earth = new Mass(92,0,0,5.2,100); |
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
// fractal : 3x3. | |
class Grid { | |
int level; | |
int len; | |
int[][] grid; | |
int[][] basePattern; | |
Grid() { | |
this.level = 1; | |
this.len = 3; |
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
#!/usr/bin/python | |
import Image | |
import numpy as np | |
class CellularAutomaton(object): | |
def __init__(self, elements, rulecode): | |
self.cells = list(elements) | |
self.rule = CARule(rulecode) | |
self.length = len(elements) |
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
#!/usr/bin/python | |
class CellularAutomaton(object): | |
def __init__(self, elements, rulecode): | |
self.cells = list(elements) | |
self.rule = CARule(rulecode) | |
self.length = len(elements) | |
def __str__(self): |
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
#!/usr/bin/python | |
# coding:utf-8 | |
# from : http://urasunday.com/u-2_09/comic/002_001.html | |
class B(object): | |
def __init__(self, m, n, f=lambda n: n+1): | |
self.m = m | |
self.n = n | |
self.f = f |
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
#!/usr/bin/python | |
''' | |
heapsort | |
from : https://en.wikipedia.org/wiki/Heapsort#Pseudocode | |
''' | |
def heapsort(a): | |
''' input : an unordered array a''' | |
count = len(a) | |
# first place a in max-heap order |
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
b :: Integral a => a -> a -> a --なんか数が2個入ったら中で色々やって数が1個出て来るような b っていうものがあるとするわね | |
b m n | |
| m == 0 = f n -- b の頭に 0, 尻になんか入ったらこうなる | |
| n == 0 = b (m-1) 1 -- b の頭に 0 より大きい数,尻に 0 が入った場合こうなる | |
| otherwise = b m $ b (m+1) n -- b の頭にも尻にも 0 でない数が入った場合こうなる | |
f :: Integral a => a -> a -- f っていうのは数が1個入ったら中で色々やって数が1個出てくるようなもの | |
f n = n + 1 -- この f は入った数に 1 を加えて出すというルールってことにしましょうか |
NewerOlder