Instantly share code, notes, and snippets.

# Ryan Ivan D'Souza ryanivandsouza

Last active December 26, 2020 13:36
View why-fp-lazy-evaluation.hs
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
 next' n x = (x + n / x) / 2 -- [a0, f a0, f(f a0), f(f(f a0)), …] repeat' f a = a : repeat' f (f a) -- get approximations for square root of n by repeat' (next' n) a0 within' (eps a1:a2:rest) | abs(a1 – a2) < eps = a2 | otherwise = within' eps (a2:rest)
Last active December 24, 2020 11:47
View why-fp-foldtree-substitution-labelstree.hs
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
 labelsTree' numberNodes ----------------------------------------------------------------- labelsTree' (Node 1 [Node 2 [Node 4 []], Node 5 []]) ----------------------------------------------------------------- foldtree' (:) (++) [] (Node 1 [Node 2 [Node 4 []], Node 5 []]) ----------------------------------------------------------------- foldnode' (:) (++) [] (Node 1 [Node 2 [Node 4 []], Node 5 []]) ----------------------------------------------------------------- (+) 1 (foldnodes' (:) (++) [] [Node 2 [Node 4 []], Node 5 []]) -----------------------------------------------------------------
Last active December 25, 2020 05:16
Why FP Matters - Part 2 🎈 - Higher-order Functions
View whyfp-higher-order.clj
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
 ;; Clojure ;; fold' f a [] = a ;; fold' f a (x:xs) = f x (fold' f a xs) (defn fold' [f a xs] (if (empty? xs) a (f (first xs) (fold' f a (rest xs))))) ;; sum'' = fold' (+) 0
Created December 2, 2020 12:25
View phil.go
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
 func (host *Host) acceptRequest(philosopher *Philosopher, requestID int, wg *sync.WaitGroup) { go func() { <-host.servingAvailable philosopher.eat() }() go func() { <-philosopher.eatingEnded host.servingAvailable <- "serving available" wg.Done()
Last active June 9, 2018 07:11
Visual Studio Code Settings Sync Gist
View cloudSettings
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
Last active October 7, 2017 06:38
View WindowsDevBoxStarter
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
 choco install -y googlechrome choco install -y firefox choco install -y 7zip.install choco install -y notepadplusplus.install choco install -y vlc choco install -y autohotkey.portable choco install -y nodejs.install choco install -y git.install choco install -y skype choco install -y jdk8
Created July 19, 2017 07:24
JS Bin // source http://jsbin.com/bolape
View index.html
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
 JS Bin
Created July 14, 2017 06:15
JS Bin // source http://jsbin.com/nopabe
View index.html
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
 JS Bin
Created July 14, 2017 06:07
JS Bin // source http://jsbin.com/xinuvus
View index.html
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
 JS Bin
Created July 14, 2017 05:47
JS Bin // source http://jsbin.com/fidudom
View index.html
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
 JS Bin