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 FizzBuzz | |
import Data.Vect | |
Rule : Type | |
Rule = (n: Int) -> (old: List String) -> (List String) | |
everyNthRule : (every: Int) -> (replacement: String) -> Rule | |
everyNthRule every replacement n old = | |
if (mod n every == 0) then old ++ [replacement] else old |
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
import java.util.*; | |
import java.util.function.*; | |
import java.util.stream.*; | |
public class ParallelStreamTest { | |
static class IntGenerator implements Supplier<Integer> { | |
private int current = 0; |
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
apply plugin:'groovy' | |
apply plugin:'idea' | |
repositories { mavenCentral() } | |
dependencies { | |
groovy 'org.codehaus.groovy:groovy-all:1.8.2' | |
} | |
task makeDirs(description:'make all dirs for project setup') << { |
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 Ants where | |
import STM | |
import Control.Concurrent (forkIO, forkOS) | |
import Data.List (!!, nub, sortBy) | |
import System.Random |
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
import * as React from "react"; | |
export interface HelloProps { compiler: string; framework: string; } | |
export interface HelloState { slices: number; table: number } | |
export class Hello extends React.Component<HelloProps, HelloState> { | |
constructor(props: HelloProps) { | |
super(props); | |
this.state = { slices:10, table:2 } |
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
import Html exposing (Html, button, div, text) | |
import Html.App as App | |
import Html.Events exposing (onClick) | |
import Svg exposing (svg, circle, line) | |
import Svg.Attributes exposing (..) | |
import List exposing (map, (::)) | |
main = | |
App.beginnerProgram { model = state, view = view, update = update } |
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 App.Counter where | |
import Prelude (($), (+), (-), (*), (/), (>), const, show) | |
import Data.Array ((..), (:), mapWithIndex) | |
import Data.Int (toNumber, floor) | |
import Math (sin, cos, pi ) | |
import Pux.Html (Html, div, span, button, text, canvas, svg, circle, line ) | |
import Pux.Html.Attributes (width, height, viewBox, cx, cy, r, fill, x1, y1, x2, y2, stroke, strokeWidth) | |
import Pux.Html.Events (onClick) |
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 where | |
import Control.Monad.Eff.Console (log) | |
import Data.List.Lazy (take, zipWith, fromFoldable, cycle, iterate, foldr) | |
import Data.Monoid (mempty, (<>)) | |
import Data.Maybe (Maybe(..), fromMaybe) | |
import Prelude ( show, map, ($), (+)) | |
main = do |
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
// Haskell-style iterate function in Groovy | |
Closure iterate(def value, Closure nextValue) { | |
return { value = nextValue value } | |
} | |
// use for iteration | |
def iter = iterate(0) { it + 1} |