Skip to content

Instantly share code, notes, and snippets.

View workflow's full-sized avatar
⚔️
Compiling!

Florian Peter workflow

⚔️
Compiling!
View GitHub Profile
@workflow
workflow / main.hs
Created April 9, 2020 11:45
Vowel Align in one line of Haskell
import Control.Applicative (liftA2)
import Data.List (maximumBy)
import Data.Ord (comparing)
vowAlign = let as = (map concat) . sequenceA . map ((\c -> [c, c ++ "#", "#" ++ c]) . pure) in (maximumBy ((comparing (\(_,_,x) -> x)) <> flip (comparing $ length . (\(_,x,_) -> x)) <> flip (comparing $ length . (\(x,_,_) -> x))).) . (map (\(s, s') -> (s, s', ((.) (foldr (\(c, c') acc -> if all ((flip elem) "AEIOU") $ [c] ++ [c'] then (acc + 1) else acc) 0) . zip) s s')).) . (.as) . liftA2 (,) . as
-- Acceptance tests
main :: IO ()
main =
let x = "LAUFEN"

Keybase proof

I hereby claim:

  • I am workflow on github.
  • I am farlion (https://keybase.io/farlion) on keybase.
  • I have a public key ASAJ24w_QnzayyTfk74tyFI2gT1bYn30J-JlFQGffJU6bgo

To claim this, I am signing this object:

@workflow
workflow / MatrixMultiplication.idr
Last active February 6, 2023 00:47
Matrix Multiplication, Idris Style
module Main
import Data.Vect
Matrix: Nat -> Nat -> Type -> Type
Matrix n m a = Vect n (Vect m a)
total createEmpties : Matrix n Z a
createEmpties {n = Z} = []
createEmpties {n = (S k)} = [] :: createEmpties