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 OverloadedLists #-} | |
{-# LANGUAGE BangPatterns #-} | |
module Main where | |
import System.Environment (getArgs) | |
import Text.Read (readMaybe) | |
import Control.Monad (when,unless) | |
import Data.Maybe (isNothing,fromJust,fromMaybe) | |
import Data.Complex |
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 #-} | |
{-# LANGUAGE BangPatterns #-} | |
module Main where | |
import qualified System.Console.Terminal.Size as Term (size,width,height) | |
import Data.Maybe (fromMaybe) | |
import Data.Vector (Vector,(!)) | |
import qualified Data.Vector as V | |
import Data.Text (Text) |
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 Squiglies (squiglies) where | |
import Data.Map.Strict (Map, fromList) | |
import Data.Text (Text) | |
squiglies :: Map Char Text | |
squiglies = fromList | |
[ |
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 Control.Applicative | |
import qualified Data.Text as T | |
import qualified Data.Text.IO as T | |
import qualified Data.List as L (intersperse) | |
import Data.List (maximumBy) | |
import Data.Ord (comparing) |
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 FlexibleInstances #-} | |
{-# LANGUAGE OverlappingInstances #-} | |
module Main where | |
import Data.Map (fromListWith, toList) | |
main :: IO () | |
main = do | |
let log = "date time Zerock henlo\n\ |
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
#include <iostream> | |
#include <utility> | |
#include <string> | |
#include <algorithm> | |
#include <cctype> | |
#include <map> | |
#include <random> | |
#include <chrono> | |
#include <stdexcept> |
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
module Main where | |
import Data.List (genericTake) | |
{- | |
let p(i) be the i(th) prime number starting from 2 | |
[p1,p2,p3,p4,p5...] | |
[(p2-p1),(p3-p2),(p4-p3),(p5-p4)...] | |
[{(p3-p2)-(p2-p1)},{(p4-p3)-(p3-p2)},{(p5-p4)-(p4-p3)}...] | |
... etc. applied n times |
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
average :: Fractional a => [a] -> a | |
average xs = sum xs / fromIntegral (length xs) | |
range :: (Num a, Ord a) => [a] -> a | |
range xs = maximum xs - minimum xs | |
meanNormalize :: (Fractional a, Ord a) => [a] -> a -> a | |
meanNormalize xs = (/ range xs) . subtract (average xs) | |
-- GHCI |
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
f :: Num a => [a] -> [a] | |
f [] = [] | |
f [x] = [] | |
f [x1,x2] = [x2-x1] | |
f (x1:x2:xs) = x2-x1:f (x2:xs) |
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
#!/usr/bin/env python3 | |
import sys, requests | |
from bs4 import BeautifulSoup | |
from random import choice | |
def main(argv): | |
if len(argv) < 2: | |
sys.exit("Invalid argument(s)\nSyntax: [optional: -n [n definition/examples]] [search term]") | |
if len(argv) > 3: |
NewerOlder