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
{-# LANGUAGE LambdaCase #-} | |
module Partition (main) where | |
-- original implementation | |
partitionMaybe' :: (a -> Maybe b) -> [a] -> ([(a, b)], [a]) | |
partitionMaybe' f = go | |
where | |
go = \case | |
[] -> ([], []) | |
(head : tail) -> |
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
javascript:(function(){function tryOrder(){window.setTimeout(function(){var btn=document.getElementsByClassName('Button Button--cartContainer')[0],evnt=document.createEvent('Events');evnt.initEvent('click', true, false);btn.dispatchEvent(evnt);tryOrder();},3000)}})() |
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
module ContextView exposing (ContextItem, container, item) | |
import Html exposing (Html, Attribute) | |
import Html.Attributes as Attrs | |
type ContextItem = ContextItem | |
container : List (Attribute msg) -> (ContextItem -> List (Html msg)) -> Html msg | |
container attrs inner = | |
Html.div (Attrs.class "some-required-context-thing" :: attrs) <| |
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
module Main exposing (main) | |
import Html | |
sumFromZero : Int -> Int | |
sumFromZero n = | |
sumFromZeroTail 0 n | |
sumFromZeroTail : Int -> Int -> Int | |
sumFromZeroTail acc n = |
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
// This program will read test.txt file and print it line by line | |
// implemented in 3 different ways | |
use std::io::BufReader; | |
use std::io::BufRead; | |
use std::fs::File; | |
fn main() { | |
// Procedural |
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
Verifying that "turbo_mack.id" is my Blockstack ID. https://onename.com/turbo_mack |
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
#!/bin/bash | |
# Reinstall all brew packages and dependencies in the correct order | |
# - list all installed packages | |
# - print the package followed by its dependencies | |
# - print the package and a single depenency on each line | |
# - perform a topographical sort | |
# - print out each package in the correct order on a single line | |
# - pass to brew reinstall | |
brew list \ |
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
/** | |
Example is using Heron's formula for calculating area of triangle | |
more info: https://en.wikipedia.org/wiki/Heron%27s_formula | |
*/ | |
// Given a function of type f: (X x Y x Z) -> N, | |
// currying produces f: X -> (Y -> (Z -> N)) | |
// Num -> (Num -> (Num -> Num)) |
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
-module(func). | |
-export([fac/1, ft/1, len/1, lt/1, fib/1, tail_fib/1]). | |
%% basic recursive implementation of factorial | |
fac(N) when N == 0 -> 1; | |
fac(N) when N > 0 -> | |
N*fac(N-1). | |
%% Tail recursion implementation of factorial |
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
-module(func). | |
-export([fac/1, ft/1, len/1, lt/1, fib/1, tail_fib/1]). | |
%% basic recursive implementation of factorial | |
fac(N) when N == 0 -> 1; | |
fac(N) when N > 0 -> | |
N*fac(N-1). | |
%% Tal recursion implementation |
NewerOlder