Skip to content

Latest commit

 

History

History

codewars

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

codewars solutions

Solutions to exercises from codewars.com.

I'll only list here non trivial solutions to exercices that I have not authored. Difficulty ranking ranges from 8kyu (easiest) to 1kyu (hardest). Most of the files will not compile on their own. A lot of the work has been done in-browser and the code isn't always well formatted/documented.

1 Kyu

Coroutines (Haskell)

Implementation of a coroutine library (pipeline of functions that can yield values repeteadly or request input).
details
code

Scott Encoding (Haskell)

Implementation of basic algebraic data structures using Scott Encoding.
details
code

Sure, but can you SKI (Haskell)

Basic operators of the SKI combinator calculus + implementation of several common combinators & boolean arithmetic in point free form.
details
code

One function, many arguments: Haskell style

(Clumsy) implementation of a few polyvariadic functions (functions that can take a variable number of arguments).
details
code

Peano and Church (Haskell)

Formulation of natural numbers using Church, Peano and Scott encoding, as well as representation as a list of units.
details
code

Lensmaker (Haskell)

A mini-library of van Laarhoven style lenses.
details
code

2 Kyu

Yoneda Lemma (Haskell)

Proof of the Yoneda Lemma in Hask, with some light application to counting instances of natural transformations.
details
code

Count them all! (Haskell)

Fun with the cardinality of types: count and enumerate all members of given types, including function and functor types.
details
code

Symbolic differentiation of prefix expression (Haskell)

I like this one. Parses a mathematical expression in prefix expression then computes its derivative and simplifies it.
details
code

Finally tagless interpreter (Haskell)

Interpreter for a finally tagless EDSL.
details
code

Odd + Even = Odd? Prove it! (Haskell)

(Ab)use of the Haskell type system to prove some properties of arithmetic on even and odd integers.
details
code

Algebraic Isomorphism (Haskell)

Using the isomorphism between algebraic data types to do some light proof work.
details
code

Regular expression parser (Haskell)

A simple regular expression parser. The implementation is a bit messy.
details
code

I love Lisp (Haskell)

A parser and interpreter for a simple Lisp-like language.
details
code

Writing applicative parsers from scratch (Haskell)

Everything is in the title.
details
code

Singletons (Haskell)

Implementation of a compile-time checked vector using features mimicking dependent types.
details
code

The most imperative functional language? (Haskell)

Imperative syntax in do notation using the State monad.
details
code

3 Kyu

Magic compare (C++)

A simple class that allow three way comparisons (a < b < c) in C++.
details
code

Constructing finite fields using binary polynoms (Haskell)

Definition of the binary polynom field and ring and their operations.
details
code

Battleship field validator (C++)

Checks that the positions of ships on a board of Battleship are legal.
details
code

Isomorphism (Haskell)

Definition of some isomorphisms using the Haskell type system.
details
code

4 Kyu

Five fundamentals monads (Haskell)

Implementation of Identity, Maybe, State, Reader and Writer.
details
code