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
{-# LANGUAGE OverloadedStrings #-} | |
module Main where | |
import Web.Scotty | |
import Network.Wai.Middleware.RequestLogger(logStdoutDev) | |
import Data.Aeson ( (.:),(.:?),decode,FromJSON(..),Value(..)) | |
import Data.Text.Lazy (pack) | |
import Control.Applicative ((<$>), (<*>)) | |
import qualified Data.ByteString.Lazy.Char8 as BS |
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
Stream.repeatedly(&:random.uniform/0) | |
|> Enum.take(10000) | |
|> Stats.all | |
|> IO.inspect |
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
using Microsoft.VisualStudio.TestTools.UnitTesting; | |
using System; | |
using System.Collections.Generic; | |
using System.Collections.Immutable; | |
using System.Linq; | |
namespace TDDCoverage | |
{ | |
public class Order | |
{ |
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
using System; | |
using Microsoft.VisualStudio.TestTools.UnitTesting; | |
namespace TDDCoverage | |
{ | |
public enum Gender { Unknown, Male, Female } | |
public class Customer | |
{ | |
public Gender Gender = Gender.Unknown; |
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
defmodule Threes do | |
def right(board) do | |
board | |
|> Enum.map(&pack/1) | |
end | |
def left(board) do | |
board | |
|> Enum.map(&reverse_pack/1) |
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
namespace Arealities.Models | |
type Size = Size of decimal * decimal * decimal | |
type Position = Position of decimal * decimal * decimal | |
type Rotation = Rotation of decimal * decimal * decimal | |
type Direction = Direction of decimal * decimal * decimal | |
type LightIntensity = float | |
type Material = Ground | Floor | ShinyStuff | Wall | |
type Geometry = CubeGeometry of Size |
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
Error 1 This expression was expected to have type | |
unit | |
but here has type | |
Mesh C:\dev\.Net\arealities\Arealities.Models\Veranda.fs 17 11 Arealities.Models |
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
namespace Arealities.Models | |
type [<Measure>] mm; // milimeter | |
type [<Measure>] degrees; // degrees | |
type [<Measure>] intensity; // unit = 1 | |
type Vector3D<'a> = {x: 'a; y: 'a; z: 'a} | |
type Placement = Placement of position: decimal<mm> Vector3D * | |
rotation: decimal<degrees> Vector3D |
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
let povify model = | |
match model with | |
| (v:Vector3D<decimal>) -> sprintf "<%M,%M,%M>" (v.x/1M) (v.y/1M) (v.z/1M) | |
| CubeGeometry c -> | |
let half = c.size/2M | |
sprintf "box {%s %s} " (povify half) (povify vec3D0-half) |
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
type Range(min: decimal,max: decimal) = | |
member this.min = min | |
member this.max = max | |
static member (*) (r: Range, d: decimal) = Range(r.min * d,r.max * d) | |
static member (*) (d: decimal, r: Range) = r*d | |
static member (/) (r: Range, d: decimal) = Range(r.min / d,r.max / d) | |
static member (/) (d: decimal, r: Range) = r/d | |
static member (+) (r: Range, d: decimal) = Range(r.min + d,r.max + d) | |
static member (+) (d: decimal, r: Range) = r+d | |
static member (-) (r: Range, d: decimal) = Range(r.min - d,r.max - d) |