Skip to content

Instantly share code, notes, and snippets.

@plus7
plus7 / aaa.rs
Created January 20, 2024 22:15
テキストファイル処理のテンプレ
use std::fs::File;
use std::io::{BufRead, BufReader};
fn main() {
let file = match File::open("test.txt") {
Err(why) => panic!("couldn't open {}: {}", "test.txt", why),
Ok(file) => file,
};
for result in BufReader::new(file).lines() {
let l = result.unwrap();
/* http://qiita.com/tag1216/items/25ff0f957340c54ae73c */
/*
usage: ./a.out|sed -e "s/ //g"
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
ハンドルされていない例外: System.MissingMethodException: メソッドが見つかりませ
ん: 'System.Linq.ParallelQuery`1<!!0> Microsoft.FSharp.Collections.PSeqModule.fi
lter(Microsoft.FSharp.Core.FSharpFunc`2<!!0,Boolean>, System.Collections.Generic
.IEnumerable`1<!!0>)'
場所 <StartupCode$Lesson42_3>.$Program.main@()
東京大学心青会 ホームカミングデイ企画
日時:2012 年 10 月 20 日(土)17:00 ~ 19:00
会場:東京大学 理学部 7 号館 地階 007 講義室
次第
17:00~ぐらい(それとなくスタート)
懇談会
※お飲物,おつまみを準備します
答え 項目
ジャバ Schemeは1.5からオートボクシングの機能をサポートした
Python等 Schemeはインデントによってブロックを表現する
概ねP言語とRubyであろう Schemeは多くのレンタルサーバに標準でインストールされている
Schemeでは関数がファーストクラスのオブジェクトである
Cなど多数 Schemeの文の終わりはセミコロンである
Haskell Schemeは純粋関数型言語であり、副作用はモナドでくるむ必要がある
OCaml Schemeは型に厳格なため整数の加算と浮動小数点数の加算の演算子が異なる
Ruby Schemeは関数の呼び出し時に括弧を省略することが出来る
@plus7
plus7 / gist:3187614
Created July 27, 2012 12:10
Amberのビルド
as main.s -o main.o --32
as lib.s -o lib.o --32
as lex.s -o lex.o --32
as compile.s -o compile.o --32
as codegen.s -o codegen.o --32
ld main.o lib.o lex.o compile.o codegen.o -o rlc --nostdlib -m elf_i386 --entry=_main
make[1]: ディレクトリ `/home/ahya/amber/rowl0' から出ます
cd rowl1; make
make[1]: ディレクトリ `/home/ahya/amber/rowl1' に入ります
../rowl0/rlc < startup.rl > startup.s
@plus7
plus7 / gist:2006055
Created March 9, 2012 10:49
コブラ
http://g.tnose.net/data/6796a993906e94527c3ae16ea5efe356.png
http://g.tnose.net/data/946e8b0424ad2f18d00c51cb1eb7825e.png
http://g.tnose.net/data/0e4b5c73db9bbcc1f21ad71e9fa57f03.png
http://g.tnose.net/data/7f0fa7ecc631e3528ad46d3ef55f7b0b.png
http://g.tnose.net/data/f23de0784a4571c65175f6a4e6e33001.png
http://g.tnose.net/data/47fd7476f1136519c42a9dc6b8297e76.png
http://g.tnose.net/data/869c3b632cd3739fc5627a57000ad78c.png
http://g.tnose.net/data/261bb4dfe3b09072f2285125bd2b0baa.png
http://g.tnose.net/data/6c0845bbe8ecf327d233b560eb8a1bcb.png
http://g.tnose.net/data/5bb790fabdd70354c06f9dca7c5fb34d.png
@plus7
plus7 / Rationale.md
Created October 15, 2011 03:52 — forked from leegao/Rationale.md
JIT for dummies: JIT compiling RPN in python

If you don't care about the explanation, scroll down to find the code, it's 50 some odd lines and written by someone who doesn't know any better. You have been warned.

What it does

This is a very simple proof of concept jitting RPN calculator implemented in python. Basically, it takes the source code, tokenizes it via whitespace, and asks itself one simple question: am I looking at a number or not?

First, let's talk about the underlying program flow. Pretend that you are a shoe connoisseur with a tiny desk. You may only have two individual shoes on that desk at any one time, but should you ever purchase a new one or get harassed by an unruly shoe salesman without realizing that you have the power to say no (or even maybe?), you can always sweep aside one of the two shoes on the desk (the one on the right, because you're a lefty and you feel that the left side is always superior) onto the messy floor, put the other shoe on the right hand side, and then place your newly acquired shoe in

@plus7
plus7 / Rationale.md
Created October 15, 2011 03:52 — forked from leegao/Rationale.md
JIT for dummies: JIT compiling RPN in python

If you don't care about the explanation, scroll down to find the code, it's 50 some odd lines and written by someone who doesn't know any better. You have been warned.

What it does

This is a very simple proof of concept jitting RPN calculator implemented in python. Basically, it takes the source code, tokenizes it via whitespace, and asks itself one simple question: am I looking at a number or not?

First, let's talk about the underlying program flow. Pretend that you are a shoe connoisseur with a tiny desk. You may only have two individual shoes on that desk at any one time, but should you ever purchase a new one or get harassed by an unruly shoe salesman without realizing that you have the power to say no (or even maybe?), you can always sweep aside one of the two shoes on the desk (the one on the right, because you're a lefty and you feel that the left side is always superior) onto the messy floor, put the other shoe on the right hand side, and then place your newly acquired shoe in

for(var i=0;i<20;i++){var elem = document.querySelectorAll(".langbtn")[2]; var evt = document.createEvent( "MouseEvents" );evt.initEvent( "mouseup", false, true ); elem.dispatchEvent( evt ); }