Skip to content

Instantly share code, notes, and snippets.

View risgk's full-sized avatar

Ryo Ishigaki risgk

View GitHub Profile
@risgk
risgk / arith_big.rb
Last active March 6, 2021 07:40
TAPL 演習3.5.17 Rubyでの実装例
# TYPES AND PROGRAMMING LANGUAGES by Benjamin C. Pierce Copyright (c)2002 Benjamin C. Pierce
# Excercise 3.5.17
class Array
def isnumericval
t = self
case
when t[0] == :zero
true
when t[0] == :succ
@risgk
risgk / untyped.rb
Last active December 20, 2015 00:19
TAPL 第7章より / 型無しラムダ計算のRuby実装 / 小ステップスタイル
# Modifying http://www.cis.upenn.edu/~bcpierce/tapl/checkers/untyped/ for learning TAPL.
# TYPES AND PROGRAMMING LANGUAGES by Benjamin C. Pierce Copyright (c)2002 Benjamin C. Pierce
def isnamebound(ctx, x)
if ctx[0].nil?
false
else
y = ctx[0][0]; rest = ctx.drop(1)
if y == x
true
@risgk
risgk / simplebool.rb
Created August 18, 2013 04:45
TAPL 第10章より / 単純型のRuby実装 (ブール値を伴った単純型付きラムダ計算のRuby実装)
# Modifying http://www.cis.upenn.edu/~bcpierce/tapl/checkers/simplebool/ for learning TAPL.
# TYPES AND PROGRAMMING LANGUAGES by Benjamin C. Pierce Copyright (c)2002 Benjamin C. Pierce
# ------------------------ SYNTAX ------------------------
# Context management
def addbinding(ctx, x, bind)
[[x, bind]] + ctx
end
@risgk
risgk / Nagoya_de_Ruby_Part_I.txt
Last active December 22, 2015 23:49
名古屋でRuby, パートI (Hamamatsu.rb #31 LT - メモ帳プレゼン用スライド)
名古屋でRuby, パートI
September 11, 2013
@risgk
@risgk
risgk / simplebool_with_case_class.rb
Created September 17, 2013 13:20
TAPL 第10章より / 単純型のRuby別実装 (ブール値を伴った単純型付きラムダ計算のRuby別実装)
# Modifying http://www.cis.upenn.edu/~bcpierce/tapl/checkers/simplebool/ for learning TAPL.
# TYPES AND PROGRAMMING LANGUAGES by Benjamin C. Pierce Copyright (c)2002 Benjamin C. Pierce
# $ gem install case_class
# ref: http://github.com/mame/case_class
require "case_class"
# CAUTION: Monkey patching!
module CaseClass
class Case < Struct
def ==(obj)
@risgk
risgk / ruby-arduino-synth.md
Last active May 30, 2019 16:34
Ruby x Arduinoでシンセサイザーを作ってみた #hmrk01

Ruby x Arduinoでシンセサイザーを作ってみた

  • 2015/03/28 浜松Ruby会議01

  • Hamamatsu.rb 石垣 良

@risgk
risgk / 2016-11-26_hamait.txt
Created November 27, 2016 00:49
ISGK Instrumentsの活動紹介
# ISGK Instrumentsの活動紹介
* 浜松IT合同勉強会 LT大会
* 2016/11/26(土) @risgk
* <http://risgk.github.io/>
@risgk
risgk / generate-osc-table-vra8-n-psaw-16.rb
Last active May 2, 2020 06:52
Digital Synth VRA8-N pSAW-16: VRA8-N v2.4 Special Edition with 16-step Pseudo-SAW Wave (LICENSE: CC0 1.0 Universal) https://risgk.github.io/
require_relative 'constants'
PSEUDO_SAW_STEPS = 16
REDUCE_OSC_TABLE_SIZE_1 = false
$file = File.open("osc-table.h", "w")
$file.printf("#pragma once\n\n")
def freq_from_note_number(note_number)