Skip to content

Instantly share code, notes, and snippets.

@plasma-effect
plasma-effect / Memoization.fs
Last active September 23, 2015 12:11
ParserGenerator
module Memoization
module Detail =
type Optional<'a> = None | Value of 'a
let GetData<'T, 'U when 'T:equality> (target: 'T) (dic: System.Collections.Generic.List<('T*'U)>)=
let mutable ret = None
for (x, y) in dic do if x=target then ret<-Value(y) else ()
ret
type Memoization<'T,'U when 'T:equality>()=
@plasma-effect
plasma-effect / adt_rebirth.hpp
Last active October 8, 2015 14:18
plasma.ADT
#pragma once
// Copyright plasma-effect 2015
// Distributed under the Boost Software License, Version 1.0.
// (See http://www.boost.org/LICENSE_1_0.txt)
#include<tuple>
#include<utility>
#include<list>
#include<memory>
#include<vector>
@plasma-effect
plasma-effect / adt_willing.hpp
Last active December 9, 2015 15:58
plasma.ADT willing
#pragma once
// Copyright plasma-effect 2015
// Distributed under the Boost Software License, Version 1.0.
// (See http://www.boost.org/LICENSE_1_0.txt)
#include<tuple>
#include<utility>
#include<memory>
#include<type_traits>
@plasma-effect
plasma-effect / main.md
Created December 2, 2015 15:01
文字列プログラミングのススメ

皆さんおはようございます。この記事はポエムアドベントカレンダー3日目です。

この記事では全ての変数をchar*型で扱うことの利点、またchar*型で扱うデモンストレーションを行っていきます。

#変数がchar*型であるということの利点について考える C++において変数がchar*型であるということを否定的に捉える人もいるかと思います。 特にTMPなどの静的言語を使ってきた人にとっては、char*しかないということが不安材料として目に映ることが多いのではないかと思います。

けれども、char*しかないということは、本当に素晴らしいことです。 char*しかないことによって、たくさんの面倒から開放されるからです。

@plasma-effect
plasma-effect / a.md
Created December 3, 2015 18:23
constexpr多倍長整数

皆様おはようございます。@plasma_effector です。この記事はAizuアドベントカレンダー4日目です。 #自己紹介 数学系の3回生です。何も考えず登録した後Aizuとあんま関係ないと気付きましたが気にせずやります。
普段はC++とC#でなんか作ってます。たまにTypeScriptでゲームを作ります。 #やること C++のconstexprには様々な可能性が存在します。
多倍長整数をコンパイル時に使えたらいいなぁって思ったのでconstexprな多倍長整数を作ろうって思いました。 #補足 constexprとは ※この項は普段C++使ってる方は読み飛ばしてもらって構いません
C++11で追加された定数評価に関する指定子です。gccとclangとmsvcでは使えます。

@plasma-effect
plasma-effect / a.md
Last active April 4, 2019 12:25
plasma.ADTの紹介

おはようございます。@plasma_effector だよ。この記事はC++アドベントカレンダー8日目の記事です。

この記事ではC++で使える代数的データ型ライブラリplasma.ADT(の最新ver willing)の紹介をしていきます。

What is plasma.ADT

9月下旬に作り始めた代数的データ型のライブラリです。C++で簡単に「ML系言語のデータ型」っぽい型を作ることができ、さらにパターンマッチっぽいことをすることができます。

#include"adt_willing.hpp"
#include<iostream>

using namespace adt_willing;
@plasma-effect
plasma-effect / a.md
Last active April 4, 2019 12:14
進化したplasma.ADTとは

plasma.ADTがバージョンアップしました。plasma.ADTの基本についてはこちら

サンプル

#include<plasma_adt/algebraic_data_type.hpp>
#include<iostream>
#include<boost/optional/optional_io.hpp>

using namespace plasma_adt;
using namespace plasma_adt::place_holder;
using namespace plasma_adt::pattern_match;
@plasma-effect
plasma-effect / main.cpp
Created February 27, 2016 13:37
競プロで使ってたやつ
//ここからテンプレート
#if 1
#include<iostream>
#include<vector>
#include<list>
#include<algorithm>
#include<utility>
#include<type_traits>
#include<tuple>
#include<memory>
@plasma-effect
plasma-effect / coroutine.hpp
Last active September 28, 2016 12:52
plasma.Coroutine
#pragma once
// Copyright plasma-effect 2016.
// Distributed under the Boost Software License, Version 1.0.
// (See http://www.boost.org/LICENSE_1_0.txt)
#include<utility>
#include<tuple>
#include<iterator>
@plasma-effect
plasma-effect / Main.cpp
Created April 26, 2016 14:23
新入生に見せるため突貫で作った弾避けゲー
#include<Siv3D.hpp>
#include<chrono>
namespace sch = std::chrono;
void Main()
{
s3d::Window::Resize(360, 480);
std::pair<s3d::Circle, bool> enemy[25 * 8]{};
constexpr int s = 4;
s3d::Circle player(180, 240, s);