Skip to content

Instantly share code, notes, and snippets.

@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 / main.md
Created December 2, 2015 15:01
文字列プログラミングのススメ

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

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

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

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

@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 / 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 / algebraic_data_type.hpp
Last active October 7, 2015 17:11
algebraic_data_type
#pragma once
#ifndef PLASMA_ALGEBRAIC_DATA_TYPE
#define PLASMA_ALGEBRAIC_DATA_TYPE
// 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<memory>
#pragma once
#ifndef PLASMA_MEMOIZATION
#define PLASMA_MEMOIZATION
// Copyright plasma-effect 2015
// Distributed under the Boost Software License, Version 1.0.
// (See http://www.boost.org/LICENSE_1_0.txt)
#include<vector>
#include<tuple>
@plasma-effect
plasma-effect / Parser.fs
Last active September 19, 2015 03:28
Parsing Expression Grammar
module Parser
//Copyright (c) 2015 plasma-effect
//
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
@plasma-effect
plasma-effect / system_lp.hpp
Last active September 1, 2015 13:42
compile time proof
#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<type_traits>
namespace plasma
{
namespace proof_system
#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<type_traits>
#include<tuple>
namespace plasma