Skip to content

Instantly share code, notes, and snippets.

View smoge's full-sized avatar

mago smoge

View GitHub Profile
@smoge
smoge / gist:2507fdf27837000349d51e3acf4497e9
Last active March 14, 2017 01:05
TestRational Output
PASS:a TestRational:test_Additive_Inverse_NonZeroIntInput - Additive Inverse test 3 with -57 %/ 64 passed.
Is:
57 %/ 64
Should be:
57 %/ 64
PASS:a TestRational:test_Additive_Inverse_NonZeroIntInput - Additive Inverse test 1 with -53 %/ 65 passed.
Is:
53 %/ 65
Should be:
@smoge
smoge / pseudo.py
Created April 29, 2023 05:27
solo_improvisation (pseudo code fun)
def solo_improvisation():
# Create arrays to store musical material and acoustic space
material = [] # store longer units of material here
current_phrase = [] # store current phrase being improvised
acoustic_space = [] # store all acoustic resonances
# Use additive procedures for building patterns
# Add four phrases to the material array
for i in range(4):
current_phrase.append(random.randint(0, 9)) # add random notes to the current phrase
@smoge
smoge / ratio.md
Last active September 23, 2023 23:28

. Complexity Factors: Let $C(p)$ represent the Complexity Factors of a rational number $p$, defined by the tuple:

$$C(p) = (N(p), A(p), R(p))$$

where:

@smoge
smoge / BenedettiHeight.hs
Last active September 24, 2023 18:24
Benedetti Height
module Math.BenedettiHeight where
import Data.List (foldl')
generatePrimes :: Int -> [Int]
generatePrimes n = take n $ sieve [2..]
where
sieve [] = []
sieve (p:xs) = p : sieve [x | x <- xs, x `mod` p /= 0]
@smoge
smoge / hs.cpp
Last active March 6, 2024 12:27
FP ideas in C++
#include <iostream>
#include <vector>
#include <iterator>
#include <algorithm>
using namespace std;
// In Haskell, a Functor is a type class that implements the fmap function. fmap applies a function to every element within a container (e.g., list, Maybe). The C++ code defines a Functor template struct that requires the implementation of fmap for different container types. The % operator is overloaded to use fmap in a more convenient way, mimicking the infix notation of Haskell.
@smoge
smoge / sc-apl.cpp
Created March 6, 2024 12:15
APL Array implementation
// style reminiscent of APL as pairs of one-=dimentional vectors representing values and shape
#include <cmath>
#include <iostream>
#include <thread>
#include <vector>
// Structure to represent an APL-style array
struct APLArray {
@smoge
smoge / haskell-interactive-ext.el
Created March 18, 2024 16:11
haskell-interactive-ext.el
(require 'haskell-interactive-mode)
;; add to .ghci
;; :set +m
(defun haskell-interactive-my-eval ()
"Evaluate the current line or region in the Haskell REPL."
(interactive)
@smoge
smoge / listen.md
Created March 22, 2024 22:17
Listen, you who’ve forgotten the sky's blue hue.

Listen, you who’ve forgotten the sky's blue hue.

Listen,
you who’ve forgotten the sky's blue hue.

In spaces where echoes unclasp their hands,
a dark narrative unfurls, voices entangled in raqs intricate,
chaos, not a singular entity but fragmented,
a hunger, a blend of countless existences.

@smoge
smoge / sketch-intervals.hs
Last active March 30, 2024 08:21
sketch-intervals.hs
import System.Random (StdGen, randomR, split)
type Interval = (Double, Double)
type Label = String
data Event = Event Label Interval deriving (Show)
data Relationship = Before | Meets | Overlaps | After
deriving (Show, Eq)
@smoge
smoge / faust_recursive_circuits.hs
Created May 10, 2024 07:52
faust_recursive_circuits
-- faust
-- import("stdfaust.lib");
-- lowpass(cf, x) = y
-- letrec {
-- 'y = b0 * x - a1 * y;
-- }
-- with {
-- b0 = 1 + a1;
-- a1 = exp(-w(cf)) * -1;
-- w(f) = 2 * ma.PI * f / ma.SR;