簡単な計測用の関数が作りたかった
const loop = _=> loop(); // stack-overflow
const one = _ => 1;
one(loop()); // -> "too much recursion"
one(_=> loop()); // -> 1
#!/usr/bin/env python | |
# available: https://github.com/ShigekiKarita/practice/blob/master/PH_6-2.py | |
B = [0.6961663, 0.4079426, 0.8974794] | |
wavelength = [0.0684043, 0.1162414, 9.896161] # micro-meter | |
c = 29.9792458 * 10 ** 8 * 10 ** 6 # micro-meter | |
pi = 3.141592653589793 | |
def n(x): | |
sigma = 0. |
/* HOW TO USE | |
iverilog -o circuit circuit.v | |
vvp circuit | |
gtkwave circuit.vcd | |
*/ | |
module CIRCUIT (x, clk, z) ; |
function isNumber(value) | |
{ | |
return typeof value == 'number'; | |
} | |
function tensorAdd(lhs, rhs) | |
{ | |
return lhs.map | |
( | |
function(value, index) |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*-* | |
import matplotlib.pyplot as plt | |
import scipy.interpolate as intp | |
import numpy as np | |
# <σν> データセット | |
x = [1, 10, 10**2, 10**3] | |
y = [10**-26.5, 10**-22, 10**-21.2, 10**-21.8] |
;; recur | |
(defun fib (i &optional (a 1) (b 0)) | |
(if (= i 1) | |
a | |
(fib (1- i) (+ a b) a))) | |
(fib 10) | |
;; do macro | |
(do ((i 1 (1+ i)) | |
(a 0 b) |
// for Firefox 31 | |
const time = (process, n=1) => | |
{ | |
let total = 0.0; | |
for (let i = 0; i < n; ++i) | |
{ | |
const start = window.performance.now(); | |
process(); | |
const elapsed = window.performance.now() - start; |
簡単な計測用の関数が作りたかった
const loop = _=> loop(); // stack-overflow
const one = _ => 1;
one(loop()); // -> "too much recursion"
one(_=> loop()); // -> 1
// for firefox31 | |
const memoize = func => | |
{ | |
let memo = {}; | |
return _ => | |
{ | |
if (!(arguments in memo)) | |
{ | |
memo[arguments] = func.apply(this, arguments); | |
} |
// for firefox31 | |
const quicksort = (array) => | |
{ | |
if (array.length == 0) return []; | |
const head = array[0]; | |
const rest = array.slice(1); | |
const small = [i for each (i in rest) if (head >= i)]; //rest.filter(a => head >= a); | |
const large = [i for each (i in rest) if (head < i)]; //rest.filter(a => head < a); | |
#include <iostream> | |
// kaki sute module | |
namespace ksm | |
{ | |
enum class colors : std::uint8_t | |
{ | |
black, red, green, yellow, blue, magenta, cyan, white, none | |
}; |