What does new Array(x)
do? Trick question. It does different things depending on whether x
is an integer or something else.
I wanted to replicate this elegant functionality in Haskell: behold.
main = average [im0, im1] ++ mask; | |
[im0, im1] = map (\p extract_bands 0 3 (Image_file p)) | |
[ "5.0 Knights of the Eternal Throne.jpg" | |
, "5.10 Jedi Under Siege.jpg" | |
]; | |
mask = 255 - min_pair 255 (20 * average diff_bands); | |
diff_bands = bands (on my_diff (colour_transform_to Image_type.sRGB) im0 im1) |
shellquote() { | |
local space= | |
for arg; do | |
printf '%s' "$space" | |
printf '%s' "$arg" | sed -e "s/'/'\\\\''/g; s/^/'/; s/\$/'/;" | |
space=' ' | |
done | |
printf '\n' | |
} |
// ==UserScript== | |
// @name SPJ Discord | |
// @namespace https://example.net/ | |
// @version 0.1 | |
// @description SPJ Discord | |
// @author ion | |
// @match *://discordapp.com/* | |
// @grant none | |
// ==/UserScript== |
SWTOR Resource Gathering Nodes | |
Archaeology / Artifact Fragment: | |
? Prehistoric Archaeological Find | |
1 Lost Artifact Fragment Lost Archaeological Find | |
2 Sacred Artifact Fragment Sacred Archaeological Find | |
3 Ancient Artifact Fragment Ancient Archaeological Find | |
4 Galactic Artifact Fragment Galactic Archaeological Find | |
5 Hypertech Artifact Fragment Alien Archaeological Find, Hypertech Archaeological Find | |
6 Primeval Artifact Fragment Primeval Archaeological Find |
> :set -XGADTs -XDataKinds | |
> data Nat = Z | S Nat | |
> data Vect n a where { Nil :: Vect 'Z a; (:-) :: a -> Vect n a -> Vect ('S n) a } | |
> :t () :- Nil | |
() :- Nil :: Vect ('S 'Z) () | |
> :t \(a :- Nil) -> a | |
<interactive>:1:16: | |
Couldn't match expected type `r' with actual type `t1' | |
`r' is untouchable |
{-# LANGUAGE FlexibleContexts #-} | |
import Control.Monad.State | |
import Test.QuickCheck | |
main = do | |
print $ runBiquad' 1 0 0 (-1) (-1) [1,0,0,0,0,0,0,0,0,0,0,0] | |
quickCheck $ \xs -> (dif . int) xs == xs | |
&& (int . dif) xs == xs |
import Data.Functor.Contravariant | |
data Foo a = Foo (a -> Integer) | |
data Bar a = Bar ((a -> Integer) -> Integer) | |
data Baz a = Baz (((a -> Integer) -> Integer) -> Integer) | |
foo :: (b -> a) -> (a -> Integer) -> (b -> Integer) | |
foo f g = _ |
A shameless plug of my SWTOR referral code: http://www.swtor.com/r/Hyrstd