-
2015/03/28 浜松Ruby会議01
-
Hamamatsu.rb 石垣 良
This file contains 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
# 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 |
This file contains 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
# 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 |
This file contains 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
# 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 |
This file contains 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
名古屋でRuby, パートI | |
September 11, 2013 | |
@risgk | |
This file contains 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
# 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) |
This file contains 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
# ISGK Instrumentsの活動紹介 | |
* 浜松IT合同勉強会 LT大会 | |
* 2016/11/26(土) @risgk | |
* <http://risgk.github.io/> | |
This file contains 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
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) |