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
| interface ILocale { | |
| langCode: string; | |
| langName: string; | |
| groups: { | |
| groupName: string, | |
| translates: { | |
| source: string, | |
| translate: string | |
| }[] | |
| }[]; |
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
| function markov<T>(findFirst: () => T[][], findNext: (previous: T) => T[][]): T[][] { | |
| function chooseRandom<T>(xs: T[]): T { | |
| return xs[Math.floor(Math.random() * xs.length)]; | |
| } | |
| function last<T>(xs: T[]): T { | |
| return xs[xs.length - 1]; | |
| } | |
| var result: T[][] = []; |
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
| import Graphics.Element exposing (show) | |
| import String exposing (repeat) | |
| (*) : String -> Int -> String | |
| (*) = flip repeat | |
| main = show ("foo" * 4) |
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
| import Graphics.Element exposing (show) | |
| import List exposing (product) | |
| factorial n = product [1..n] | |
| main = show <| factorial 10 -- 3628800 |
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
| import Html exposing (..) | |
| import Html.Attributes exposing (..) | |
| main = div | |
| [style [("font-size", "64px")]] | |
| [text "Hello, world!"] |
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
| import Graphics.Element exposing (..) | |
| s f g x = f x (g x) | |
| k p q = p | |
| i a = a | |
| main : Element | |
| main = | |
| show (s k k "Hello, world!") |
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
| piyo = (f, x) --> | |
| | f x => 1 + piyo f, f x | |
| | _ => 0 | |
| /* piyo.js | |
| var piyo = function(f) { | |
| return function(x) { | |
| return f(x) ? 1 + piyo(f)(f(x)) : 0; | |
| }; | |
| }; |
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
| S = (f) -> (g) -> (x) -> (f x) (g x) | |
| K = (p) -> (q) -> p | |
| I = (a) -> a | |
| (((S K (S I)) K) 'Hello, world') console.log |
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
| Promise a | |
| Maybe a = (a | Undefined) | |
| Either a b = (a | b) | |
| Tuple a b = [a, b] |
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
| # (a -> b) -> Promise a -> Promise b | |
| map-promise = (f, promise) --> promise.then (x) -> new Promise (resolve) -> resolve f x | |
| # (a -> b) -> Maybe a -> Maybe b | |
| map-maybe = (f, maybe) --> | |
| | maybe? => f maybe | |
| | _ => null | |
| # (a -> b) -> [a] -> [b] | |
| map-list = (f, xs) --> [f x for x in xs] |