Skip to content

Instantly share code, notes, and snippets.

View t-sin's full-sized avatar
🆑

Shinichi Tanaka t-sin

🆑
View GitHub Profile
@t-sin
t-sin / multiple-dispatching-gengo.md
Last active February 18, 2023 15:33
multiple dispatchingなOOP言語ってなんだろう……という妄想。

複数レシーバOOP言語てきなもの

Common Lispの総称関数みたいな複数レシーバ (multiple dispatching) のOOP言語(Lispでない)を考えるとなにかならないかなあ…。

動機

CLOSのmultiple dispatchはこう

;; メソッド定義
@t-sin
t-sin / lispteatime-3d-cubes.lisp
Last active March 8, 2022 10:22
live coding result in Shibuya.lisp lispteatime #05: https://lisp.connpass.com/event/238911/
;; (ql:quickload '(:alexandria :split-sequence :cl-opengl :cl-glfw3))
(defpackage :lispteatime-3d-cubes
(:use :cl
:alexandria)
(:export :model
:model-vertices
:model-uv-mappings
:model-texture
:parse-obj
@t-sin
t-sin / dentaku.go
Last active September 4, 2021 14:02
Goで電卓レッツ&ゴー!
package main
import (
"fmt"
"os"
"unicode"
)
type TokenType int
@t-sin
t-sin / maiyama-12-continuations.md
Last active August 23, 2021 16:08
maiyamaさんのc-lessonの12_continuationsで気付いたこと

maiyamaさんのc-lessonの12_continuationsのコードを読んでいて気付いたこと

テスト実行毎にスタックがクリアされていない問題

スタックまわりの挙動によって、テストで積まれたスタックの要素が次に残っているようでした。

各ユニットテストの実行前にスタックの初期化(stack.cstatic int top-1に設定しなおすこと)をしていないので、前のテスト実行後の状態が残っています。だいたいのテストはスタックが空になって終了するので問題ないですが、一部(発見したのはtest_eval_num_pop())のテストではスタックに値が残るので、以降はテスト開始時常にその値が入った状態でテストが始まっているようです。ただ、テストではスタックトップの状態をexpects分だけポップして比較しているので問題は起こっていなさそうでした。

@t-sin
t-sin / cps-modoki.lisp
Last active July 30, 2021 14:05
継続渡しスタイルの勉強と実験。
(defun -& (ak bk k)
"引き算 (継続版)。
値を得る継続 (ak, bk) から得た値で引き算して、それを次の継続に渡す"
(funcall (funcall (lambda (a)
(lambda (b)
(funcall k (- a b))))
(funcall ak (lambda (v) v)))
(funcall bk (lambda (v) v))))
(defun +& (ak bk k)
@t-sin
t-sin / parser.py
Last active July 17, 2021 01:08
入力が不完全なとき停止して、新たな入力から再開できるパーサーの実験
EMPTY = 0
class Stack():
def __init__(self):
self.stack = []
def push(self, x):
self.stack.append(x)
def pop(self):
@t-sin
t-sin / test.mmm
Created August 21, 2020 15:18
My first code with mimium
// test code for mimium: https://github.com/mimium-org/mimium
// wav file should be:
// - 48kHz sampling rate
// - monoraul (1ch)
sample_rate = 48000
pi = 3.141592
// kick
kick_path = "./kick.wav"
@t-sin
t-sin / displaying-concepts-of-lem-english.md
Last active July 27, 2020 06:14
Lemのマルチフレーム対応とmux(tmux的な機能)までの道のり

プログラム中にコメントで残すようの英語版。

Lem's displaying concepts

Lem has some concept for displaying. This is a resuly of survey about them.

Display

Physical displaying area dealed by frontends; like ncurses, electron and so on.

@t-sin
t-sin / README.md
Last active February 27, 2022 13:02
my first (ARMv6) assembly program

ARMv6 assembly language study

to run

on Raspberry PI (Raspbian)

as -o test.o test.s && ld -o test test.o && ./test

on x86 Ubuntu

#!/bin/sh
#|-*- mode:lisp -*-|#
#|
exec ros -Q -- $0 "$@"
|#
(progn ;;init forms
(ros:ensure-asdf)
#+quicklisp(ql:quickload '(:jonathan :dexador) :silent t)
)