Skip to content

Instantly share code, notes, and snippets.

View zr-tex8r's full-sized avatar
💭
🍣🦆⛄

Takayuki YATO zr-tex8r

💭
🍣🦆⛄
View GitHub Profile
@zr-tex8r
zr-tex8r / 00readme.txt
Created June 29, 2012 14:00
Interpreter of the programming language 'og' (originally by Google, different from 'Go')
This is an implementation of the 'Google machine' (*1), where its fancy
graphics is replaced by dull text strings.
*1 Alan Turing's 100th Birthday (in Google Doodles)
http://www.google.com/doodles/alan-turings-100th-birthday
The syntax of the language is probably easily understood by viewing the
article (*2) of the author's blog. Although it is written in Japanese
all you have to see is the graphics and the corresponding text source.
(The rule of the 'Google machine' can surely be learned by playing with
the Doodle.)
@zr-tex8r
zr-tex8r / pdfm-wjipex0.map
Created June 29, 2012 18:21
pTeX map file choosing the better out of the IPA Fonts and IPAex FOnts
%%
%% pdfm-wjipx.map
%%
%%%%%%%%------------
%%%%%%%% ASCII pTeX
%%%%%%%%------------
%%%% Standard Fonts
@zr-tex8r
zr-tex8r / isqrt.scm
Created July 6, 2012 18:46
Something else about “LISP on TeX”
;
; isqrt.scm
;
(load "./sanierer")
; Input expressions to string-lot can contain
; the following special forms:
; (lambda (<var>) <body>)
; NB. The arity must be one.
; (^ (<var>) <expr>) ; short form of the above
@zr-tex8r
zr-tex8r / ifmethod.rb
Created July 15, 2012 04:00
To reinvent the if expression as method call
module IfMethod
Done = Object.new
NotYet = Object.new
Noop = Proc.new {}
DoneWith = Object.new
def self.proc_if(cond, tblk)
if cond then
tblk.call
Done
@zr-tex8r
zr-tex8r / fizzbuzz.rb
Created July 20, 2012 07:58
“If function” implemented without using existing if-expression
# FizzBuzz program.
require 'iffunction'
1.upto(20) do |n|
_if(n % 15 == 0) {
puts "FizzBuzz"
}.elsif(n % 3 == 0) {
puts "Fizz"
}.elsif(n % 5 == 0) {
puts "Buzz"
}.else {
@zr-tex8r
zr-tex8r / bxnoautolink.sty
Created July 22, 2012 22:55
自動リンク無効(implicit=false)なhyperrefでしおりを出す件について(イマイチ)
@zr-tex8r
zr-tex8r / wix.rb
Created July 29, 2012 03:03
Ruby: Weird if-expression
load 'wix.rb'
# FizzBuzz
1.upto(20) do |n|
Wix.if { n % 3 == 0 }.then {
print "Fizz"
}.if { n % 5 == 0 }.then {
print "Buzz"
}.else {
print n
@zr-tex8r
zr-tex8r / fibbar.tex
Created August 2, 2012 15:34
やっぱり作らないと気が済まなかったらしい
\documentclass{article}
\usepackage{lisp}
\makeatletter%!!!!!!!!!!!!!!!!!!!!!!!!!!
\addassoc\@globalenv\texprint{\Func{\@tex@texprint}}
\def\@tex@texprint#1#2#3{%
\gdef#1{\Nil}\@@tex@texprint#2{#3}}
\def\@@tex@texprint#1#2{%
\ifx#1\Value
\@add@to@write@buffer\@temp@write@buffer{#2}%
\else\ifx#1\Int
@zr-tex8r
zr-tex8r / defqverb.sty
Created August 15, 2012 09:57
An example of \ifnum`{=0\fi trick
% defqverb.sty
%%<*> \begin{defqverb}\CS<content>\end{defqverb}
% Makes \CS a macro that expands to the token list that is obtaned
% by full-expanding <content> in verbatim except \, {, and }.
% Here a newline character is converted to \par.
\def\defqverb#1{%
\xx@obeylines
\let\do\@makeother \xx@specials
\gdef\xx@finale{\let#1\xx@g@tempa}%
\xdef\xx@g@tempa{\ifnum`}=\z@\fi
@zr-tex8r
zr-tex8r / bxcountxac.sty
Created August 19, 2012 13:57
To count the maximum length of \expandafter-chains
%
% bxcountxac.sty
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{bxcountxac}
%% variables
\newread\xx@file
\newcount\xx@count
\newcount\xx@maxcount