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
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>snake</title> | |
<style type="text/css"> | |
* { margin: 0; padding: 0; } | |
html, body { height: 100%; overflow: hidden; background: #002f38; } | |
canvas { |
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 <stdarg.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
void die(const char* msg) { | |
puts(msg); | |
exit(1); | |
} | |
void cp(FILE* a, FILE* b) { |
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 | |
from fugashi import Tagger | |
import re | |
import sys | |
# Japanese card creation process | |
# - Word list on Google Keep | |
# - Find phrase and add to a temporary file | |
# - Create cards and add it to `Stage 0` deck |
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 <limits.h> | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#define WIDTH 150 | |
#define HEIGHT 150 | |
#define POINTS 60 | |
struct point { |
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
-- Ninety-Nine Haskell Problems | |
-- Problem 1 | |
myLast :: [a] -> Maybe a | |
myLast [] = Nothing | |
myLast [x] = Just x | |
myLast (_:xs) = myLast xs | |
-- Problem 2 | |
myButLast :: [a] -> Maybe a |
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
#lang plai-typed | |
; Problem 1 | |
(define (my-last list) | |
(if (<= (length list) 1) | |
list | |
(my-last (rest list)))) | |
;(test (my-last empty) empty) | |
;(test (my-last (list 1)) (list 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
-- Haskell doodle made while reading about Twelf. | |
-- http://twelf.org/wiki/Proving_metatheorems_with_Twelf | |
module Twelf where | |
data Nat | |
= Zero | |
| Succ Nat | |
deriving (Eq, Show) |
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 FAlgebra where | |
-- https://www.schoolofhaskell.com/user/bartosz/understanding-algebras | |
{- | |
class Functor f where | |
fmap :: (a -> b) -> f a -> f b | |
(<$) :: a -> f b -> f a | |
(<$) = fmap . const | |
{-# MINIMAL fmap #-} |
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 DeriveFunctor #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
{-# LANGUAGE LambdaCase #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
-- https://www.schoolofhaskell.com/user/bartosz/understanding-algebras | |
-- https://www.michaelpj.com/blog/2018/04/08/catamorphic-lc-interpreter.html |
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 Typed where | |
-- https://stackoverflow.com/questions/27831223/simply-typed-lambda-calculus-with-failure-in-haskell | |
import Safe (atMay) | |
data Type | |
= LamT Type Type | |
| NumT | |
deriving (Eq, Show) |