def fib(n):
a, b = 0, 1
for _ in range(n):
a, b = b, a + b
(* brouwer *) | |
program = | |
[ module declaration ], { import }, { line } ; | |
module declaration = | |
"module", identifier, [ ( "exposing" | "hiding" ), identifier, { ",", identifier }, [ "," ] ], newline ; | |
import = | |
"import", identifier, [ "as", identifier | ( "exposing" | "hiding" ), identifier, { ",", identifier }, [ "," ] ], newline ; |
#![feature(inclusive_range_syntax)] | |
extern crate fnv; | |
use fnv::FnvHashMap; | |
use std::cmp::min; | |
type Item = (usize, usize, usize); | |
type Opt = (usize, usize); |
A "cache" is, in general, any structure that keeps the results of processes/computations for easy access later on. The idea is that any time a given result is required in the future, a quick and efficient lookup from the cache serves as a replacement for doing the whole (potentially expensive) process/computation over again, just to get the same result. A simple example of this is the memorization of times tables. Knowing that 12 times 12 is 144 virtually instantly is useful and worth the memorization effort, compared to requiring someone to recalculate every time, even for (commonly used) small
This set of instructions will aid in writing two-voice polyphonic music from scratch using a simplified and modernized version of Fux's classic early-18th-century rules for species counterpoint. The only requirements are that the reader be competent enough with sheet music to read it and write it (even if slowly), and that the reader know basic musical terminology such as the names for intervals (major third, perfect fifth, etc.).
Writing species counterpoint serves as a technical exercise that helps to