Skip to content

Instantly share code, notes, and snippets.

@TheKK
TheKK / bench.hs
Last active September 19, 2023 16:04
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE OverloadedStrings #-}
module Main (main) where
import Criterion.Main
import Data.Function ((&))
import Data.Word (Word8)
@TheKK
TheKK / Main.hs
Last active February 26, 2021 07:13
Haskell compares to V language (concurrentlyExample & runExampleWith are the main reference functions with V)
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
module Main where
import Control.Concurrent.Async
import Control.Concurrent.Chan
import Control.Exception
import Control.Monad
@TheKK
TheKK / Main.hs
Created November 10, 2020 10:34
reproducible
{-# LANGUAGE TemplateHaskell #-}
module Main where
import Options.Applicative.Simple (simpleVersion)
import Paths_issue914
main :: IO ()
main = print $(simpleVersion Paths_issue914.version)
#include <exception>
enum class Error {
A, B, C, None,
};
namespace Exception {
struct A : std::exception {};
struct B : std::exception {};
-- This exercise covers the first 6 chapters of "Learn You a Haskell for Great Good!"
-- Chapter 1 - http://learnyouahaskell.com/introduction
-- Chapter 2 - http://learnyouahaskell.com/starting-out
-- Chapter 3 - http://learnyouahaskell.com/types-and-typeclasses
-- Chapter 4 - http://learnyouahaskell.com/syntax-in-functions
-- Chapter 5 - http://learnyouahaskell.com/recursion
-- Chapter 6 - http://learnyouahaskell.com/higher-order-functions
-- Download this file and then type ":l Chapter-1-6.hs" in GHCi to load this exercise
原文 GG 了請參考 archive
https://web.archive.org/web/20090221093708/http://d.hatena.ne.jp/yuki_neko_nyan/20090217/1234850409
以下備份
2009-02-17
■ループが書けなくなる(或いは再帰依存症)レベル10 15:00 ループが書けなくなる(或いは再帰依存症)レベル10 - 猫的怠惰Days
level 0
原文 GG 了請參考 archive
https://web.archive.org/web/20090221093708/http://d.hatena.ne.jp/yuki_neko_nyan/20090217/1234850409
以下備份
2009-02-17
■ループが書けなくなる(或いは再帰依存症)レベル10 15:00 ループが書けなくなる(或いは再帰依存症)レベル10 - 猫的怠惰Days
level 0
@TheKK
TheKK / main.cpp
Last active August 29, 2015 14:20
Prototype of game object script, sort of
/*
* Copyright (C) 2014 TheKK <thumbd03803@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@TheKK
TheKK / lrc_circuit.m
Created April 30, 2015 01:03
LRC Circuit filter in Octave code
function lrc_circuit(L, R, C, filename)
[s, frq, bps] = wavread(filename);
T = 1 / frq;
ss = filter([2*T*L 0 -2*T*L], [(4*L*R*C + 2*T*L + R*T^2) (-8*L*R*C + 2*R*T^2) (-4*L*R*C - 2*T*L + R*T^2)], s);
playaudio(ss, frq);
end
@TheKK
TheKK / mobileGameTheseDays.c
Last active August 29, 2015 14:13
mobile game these day, so fun that I can't help but keep play it!
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int
main(int argc, char* argv[])
{
srand(time(NULL));
printf("All you need is insert coins and press enter key\n");
while (getchar()) {