I hereby claim:
- I am mlms13 on github.
- I am mulmus (https://keybase.io/mulmus) on keybase.
- I have a public key ASC1pfTBJTZEjJ8xXbxWGMnKwv5AyUjTCKvxW90-0NN3sgo
To claim this, I am signing this object:
var flat = [ | |
{ id: "A", name: "A", parent: "" }, | |
{ id: "B", name: "B", parent: "" }, | |
{ id: "C", name: "C", parent: "D" }, | |
{ id: "D", name: "D", parent: "B" }, | |
{ id: "E", name: "E", parent: "A" } | |
]; | |
function unflatten(list) { | |
return; //... |
#! /usr/bin/env bash | |
color_black='\033[0;30m' | |
color_red='\033[0;31m' | |
color_green='\033[0;32m' | |
color_yellow='\033[0;33m' | |
color_blue='\033[0;34m' | |
color_purple='\033[0;35m' | |
color_cyan='\033[0;36m' | |
color_gray='\033[0;37m' |
function match(arr: Array<ParenToken>, leftCount = 0): Bool { | |
return switch arr.getOption(0) { | |
case None: leftCount == 0; | |
case Some(LeftParen): match(arr.tail(), leftCount + 1); | |
case Some(RightParen): leftCount <= 0 ? false : match(arr.tail(), leftCount - 1); | |
}; | |
} | |
function tokenize(str: String): Array<ParenToken> { |
-- data NamedColor = Red | Green | Blue | |
-- data CustomColor = CustomColor | |
-- { r :: Int | |
-- , g :: Int | |
-- , b :: Int | |
-- } | |
-- data Color = NamedColor | CustomColor | |
create type custom_color as (r int, g int, b int); |
static var coins = [4, 3, 1]; | |
var computed = new Map(); // cache already-solved target amounts | |
// return the minimum number of coins needed to make change for the | |
// given target amount, using the list of coins above. Returns `None` | |
// for requests that don't make sense (target < smallest coin) | |
// break it into all possible sub-problems, and cache the result from computing those | |
// did i do it? is this dynamic programming? | |
function makeChange(target: Int, count: Int): Option<Int> { | |
return switch computed.getOption(target) { |
I hereby claim:
To claim this, I am signing this object:
module BinaryTree where | |
import Prelude | |
import Data.Maybe (Maybe(..)) | |
import Data.Tuple (Tuple(..)) | |
data Tree a | |
= Empty | |
| Node (Tree a) a (Tree a) |
data ManaSymbol | |
= Generic | |
| Specific SpecificMana | |
| Split ManaColor ManaColor | |
data SpecificMana = Colorless | Colored ManaColor | |
data ManaColor = W | U | R | B | G | |
newtype Land = Land (List SpecificMana) |
-- http://www.mrpowell.net/progra/javascript/project4/project4.htm | |
-- A perfect number is a number where the sum of all the divisors is equal to two times the number. For example. | |
-- The divisors of the number 6 are 1, 2 , 3 and 6. 2 times 6 is 12. | |
-- 2 * 6 = 1 + 2 + 3 + 6 | |
-- Write a Java script program which will output the first nine perfect numbers. | |
import Data.Foldable (fold, sum) | |
import Data.List (List(..), (:), range, filter, reverse) | |
import Data.Int (toNumber) |
type t('a) = | |
| NonEmpty('a, list('a)); | |
let singleton = (x: 'a) => NonEmpty(x, []); | |
let fromList = (l: list('a)): option(t('a)) => switch l { | |
| [] => None | |
| [x, ...xs] => Some(NonEmpty(x, xs)) | |
}; | |
let toList = (NonEmpty(x, xs)) => [x, ...xs]; |