This file contains hidden or 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
(defsynth hansa [] | |
(let [sig (* (lf-noise0 (x-line:kr 100 1000 0.5)) | |
(env-gen:ar (env-perc 0.001 0.05 1 -4) :action FREE :gate (impulse:ar (/ 1 0.04)))) | |
delayed (comb-c:ar sig 1 (* 0.005 (+ (* (sin-osc 20 0) 0.5 ) 1)) 1) | |
env (env-gen:ar (env-perc 0.4 1.5 0.6 -4) :action FREE) | |
sig (free-verb (+ sig delayed) (x-line:kr 0.01 0.6 1) 0.1 0.1)] | |
(out [0 1] (* sig env)))) | |
(hansa) |
This file contains hidden or 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
(defn sum-dur-ext | |
[ls] | |
(letfn [(rec-sum [tl, ls] | |
(cond (empty? tl) ls | |
(empty? ls) (rec-sum (rest tl) (conj ls (first tl))) | |
:else (rec-sum (rest tl) | |
(conj ls (+ (first ls) (first tl))))))] | |
(reverse (rec-sum ls '())))) |
This file contains hidden or 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
(defn flat-lists | |
[ls] | |
(letfn [(rec-flat [rec-list ls] | |
(cond (empty? rec-list) ls | |
(seq? (first rec-list)) (rec-flat (rest rec-list) | |
(rec-flat (first rec-list) ls)) | |
(not (seq? (first rec-list))) (rec-flat (rest rec-list) | |
(cons (first rec-list) ls))))] | |
(cond (seq? ls) (reverse (rec-flat ls '())) | |
:else (list ls)))) |
This file contains hidden or 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
( | |
{ | |
var source1, source2, buf1, buf2, tempo, rate = 44100, beatDur; | |
tempo = 170 / 60; | |
beatDur = (44100 / tempo).ceil; | |
buf1 = Buffer.read(s, "sounds/break_1_170.wav", startFrame: beatDur * 0); | |
buf2 = Buffer.read(s, "sounds/break_2_170.wav", startFrame: beatDur * 0); | |
source1 = PlayBuf.ar(2, buf1, BufRateScale.kr(buf1), startPos: beatDur * 0.5, rate: 1, trigger: Impulse.kr(tempo/16)); | |
source2 = PlayBuf.ar(1, buf2, BufRateScale.kr(buf2), rate: 0.75, trigger: Impulse.kr(tempo/4)) * 0.5; |
This file contains hidden or 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
initTake xs = take (length xs - 1) xs | |
initRev = reverse . tail . reverse | |
initRec = reverse . initAux [] | |
where | |
initAux acc (x:[]) = acc | |
initAux acc xs = initAux (head xs : acc) (tail xs) | |
initRec2 (x:[]) = [] |
This file contains hidden or 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
( | |
var a, b; | |
a = Routine.new({ | |
inf.do{ |idx = 1| | |
idx.yield; | |
} | |
}); | |
b = a.collect({|item| item * 2;}); | |
b.nextN(10).postln; // -> [ 0, 2, 4, 6, 8, 10, 12, 14, 16, 18 ] |
This file contains hidden or 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
github.fetch().fork() | |
.then(@chicoxyzzy) | |
.then(@blia) | |
.then(@ekozhura) | |
.then(@RReverser) | |
.then(@terrysahaidak) | |
.then(@ALF-er); |
This file contains hidden or 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
module Codewars.Kata.FancyReplace where | |
import Data.Functor | |
import Data.List | |
getNumber :: Integer -> Either Integer String | |
getNumber n | n `mod` 15 == 0 = Right "BOTH" | |
| n `mod` 3 == 0 = Right "THREE" | |
| n `mod` 5 == 0 = Right "FIVE" | |
| otherwise = Left n |
This file contains hidden or 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
{-# LANGUAGE ConstraintKinds, DataKinds, DeriveDataTypeable, | |
GADTs, TypeFamilies, TypeOperators, UndecidableInstances #-} | |
module Codewars.Kata.HelloWorld where | |
import Control.Arrow(first, second) | |
import Data.Char(toLower) | |
import Data.Typeable | |
import GHC.Exts(Constraint) | |
type family All (c :: * -> Constraint) (ts :: [*]) :: Constraint |
OlderNewer