ときどきの雑記帖 RE* (新南口)
五番目の季節
バウアー
ふと気になったのだけど、よく国際大会やらメジャーやらで MLB公式球は(NPBのそれと比べて)「滑る」とか 慣れるのに時間がかかるとか言った記事を見るような覚えがあるのだけど、 逆はそんな苦労はないんですかね。
「いずれベイスターズでプレーすると思っていた」バウアー獲得の立役者が明かす“電撃加入までの舞台裏”「天丼や海鮮丼を箸で食べる姿に…」 - プロ野球 - Number Web - ナンバー
egyptian brackets
これを貼れという天啓(謎)を受けた
この中ではEgyptian Brackets
がお気に入り。
GW
あまり遠出はしなかったのだけど (ぴー)とか(ぴー)とか(ぴー)で外国人観光客らしい人を多く見かけたのは こういう事情もあったのかしらん?
GW中、GWみたいな大型連休がないはずの外国人観光客が増えてしまうのはなぜ?→飛行機などの輸送業界のとある事情が絡んでいるっぽい - Togetter
中国は労働節(メーデー)の大型連休ですよ。 なのでGWに中国行くと、中国人国内観光客で溢れかえっていてえらい目に…
へー、春節しか頭になかった>労働節(メーデー)の大型連休
9時台の中央線 下りが数分おきに来るアレだ!
😄
生産的
というツイートを見かけ
第二に、私たちは学生に生産的に愚かになる方法を十分に教えていません。つまり、馬鹿にされる感覚がなければ、本当に努力していないということです。
生産的な愚かさとは、選択によって無知であることを意味します。
という部分に以下略だったので原文に当たってみた。
Second, we don’t do a good enough job of teaching our students how to be productively stupid – that is, if we don’t feel stupid it means we’re not really trying.
Productive stupidity means being ignorant by choice.
ふむ。
quora
以下の問題の解き方が分かる方がいたら教えてもらいたいです 入力した実数を配列に挿入して最大値の添え字と最小値の添え字を出力するプログラムを… - コード - Quora
ピロシキ
単位
ミリリットル 日本の日常生活では1000分の1リットルであるミリリットル (mL) がよく使われ、これは、立方センチメートル (cm3) に等しい。 この二者は混用されることもあるが、製品の種別や場合によっては片方のみがもっぱら使われる。液状の医薬品や化粧品, 調理のレシピではミリリットルが用いられ、内燃機関の容積を細かく記述する際は立方センチメートルが用いられる (大まかに記述する際はリットルを用いる)。なお、立方センチメートル (cm3) のことを cc(立方センチメートル:フランス語: centimètre cubeの略)とも表記することがあるが、SIでは使用を認めておらず、 いくつかの理由から、使わないほうがよい(「立方センチメートル#cc」を参照)。
あまり気にしたことがなかったのだけど、ccってそういう意味だったのか>centimetre cubeの略 意外なところでフランス語って出てくるよねえ。
そういや、「リットル」も今は筆記体のlを使わんのですよね。
数学セミナー
もうすぐ次の号が出てしまうけど
数学を伝える 第2回 青木薫 翻訳書で数学を伝える 翻訳者が見たポピュラーサイエンスの現場の努力
この記事が興味深かった(情報量ゼロ)
新刊近刊
例のマイクロカーネル本
マイクロカーネルの本を書きました (5月18日販売) - seiya.me
書いたのは この個人サイトは自作OSで動いています - seiya.me の人だったのか!
/dev/null
Microsoft is rewriting core Windows libraries in Rust : r/programming
Maybe they could replace the backslash in file paths with a slash as well.
The Free Software Foundation is dying
- The Free Software Foundation is dying | Hacker News
- The Free Software Foundation is dying : programming
- Long Live the Free Software Foundation - a response : programming
- Long Live the Free Software Foundation – Concerned Netizen
The future of programming
- The future of programming: Research at CHI 2023 | Hacker News
- The future of programming: Research at CHI 2023 - Austin Z. Henley
APL
switch
つづき。
BCPLに関してもう少し追いかけてみた。
ENDCASE
がまだない時代のBCPLでは
http://www.bitsavers.org/pdf/mit/tx-2/TX-2_BCPL_Reference_Manual_May69.pdf
6.17 SwitchonCommands
Syntactic form:
Semantics:SWITCHON E INTO <block>
where the block contains labels of th e form:CASE <constant> ..- or DEFAULT"-
The expression is first evaluated and if a case exists which has a constant with the same arithmetic value then execution is resumed at that label; otherwise, if there is a default label then execution is continued from there, and if there is not, execution is resumed just after the end of the switch on command.
(「ラベル」なので)fallthroughするように思えるのだけど はっきりそうとは書かれていないすね。
ところで
The switch is implemented as direct switch, a sequential search or a tree search depending on the number and range of the case constants.
一応そういう考えもあったのか>direct switch
http://www.bitsavers.org/pdf/xerox/alto/bcpl/BCPL_Reference_Manual_Sep79.pdf
5-7 ……. Switches:
switchon EXP into CASEBLOCK
CASEBLOCK is a DCPL block which contains labcls of the form “case CONSTi:”, where the CONSTi are constant expressions. CASEBLOCK may also contain a label of the form “default:”. The effect of a “switchon” statement is as follows: If the CASEBLOCK contains a “casc"label whose constant CONSTi is equal to the value of EXP, a jump is done to that label. If no CONSTi matches the value of EXP, a jump is done to the “default” label if there isone, or to the statement immediately following the CASEBLOCK if there is no default label.The appearance of a “case” label does not terminate the preceding case. That is, in
こっちにははっきり書かれていた>does not terminate the preceding case
switchon Char 'into [ case $A:x = 1 case $ll:x = 2 default:x = 0 }
“x” will be 0 no matter what “Char” contains. The statements “x = 1” and “x = 2” should be followed by a jump to the end of the CASEllLOCK. The single-word BCPL statement “endcase” would accomplish this.
このサンプルコードとその説明を読むともっとはっきりする。
Case labels are legal only in CASEBLOCKs, and not in any sub-blocks of a CASEllI DCK. In connection with this, recall that a declaration implicitly begins a new block. Therefore the sequence
switchon x into [ case 0: let temp = 0 ... case 1: ... }
will cause the compiler to complain that “case 1:” does not appear in a CASEBLOCK. The code which uses “temp” must be enclosed in a block of its own which does not span other case labels.
Switches are implemented by grouping the case values into one or more value ranges in which listed values are fairly dense, and doing an indexed branch on each of these ranges. Case values which do not fall into these clusters are checked individually if all of the indexed branches fail.endcase
This single-word statement is legal only within the scope of a “switchon” statement. It causesa transfer to the end of the smallest enclosing “switchon” statement.
doing an indexed branch on each of these ranges.
とあるので、テーブルを使った分岐が考えにあったのは間違いなさそう。
https://www.cpcwiki.eu/imgs/3/3a/ArnorBCPL.pdf
SWTICHON
SWITCHON <expression> INTO <compound command>
The compound command consists of a sequence of commands with case labels attached to commands. A case label takes the form ‘CASE <constant>:’, and causes execution to start at the following instruction if
has the value <constant>. Execution will continue until an ENDCASE command, or to the end of the SWITCHON compound command. The label ‘DEFAULT:’ marks the place where execution is to start if <expression> does not evaluate to any of the constants specified by case labels. For an example of the use of SWITCHON see the ‘writef’ routine in CLIBHDR or ALIBHDR.
table
そのテーブルを使った分岐に関して 古いC(のx64移植)を見てみると
c72/c02.c at e151588a40fba563e1c82d865183bd2721a65363 · vegesm/c72
/* case */
case 16:
if ((o=symbol())!=21) /* constant */
goto syntax;
if ((o=symbol())!=8) /* : */
goto syntax;
if (swp==0) {
error("Case not in switch");
goto stmt;
}
if(swp>=swtab+swsiz) {
error("Switch table overflow");
} else {
*swp++ = isn; /* add value and label to switch table */
*swp++ = cval;
label(isn++);
}
goto stmt;
/* switch */
case 15:
o1 = brklab;
brklab = isn++;
np = pexpr();
if (np[1]>1 & np[1]<16)
error("Integer required");
rcexpr(np, regtab);
pswitch();
brklab = o1;
return;
/* default */
case 20:
if (swp==0)
error("Default not in switch");
if ((o=symbol())!=8) /* : */
goto syntax;
deflab = isn++;
label(deflab);
goto stmt;
}
と、値と飛び先のペアのテーブルを作って
c72/c02.c at e151588a40fba563e1c82d865183bd2721a65363 · vegesm/c72
/* Parses the contents of a switch block. */
void pswitch() {
int *sswp, dl, cv, swlab; /* holder for the previous switch table, label of previous default label, iterator, switch table label */
sswp = swp; /* save swp */
if (swp==0)
swp = swtab;
swlab = isn++;
printf("mov\t$l%d, %ebx\njmp bswitch\n", swlab);
dl = deflab; /* save deflab */
deflab = 0;
statement(0);
if (!deflab) {
deflab = isn++;
label(deflab);
}
/* generate switch table */
printf("l%d:.data;l%d:", brklab, swlab);
while(swp>sswp & swp>swtab) {
cv = *--swp;
printf(".int %d, l%d\n", cv, *--swp); /* prints condition, label to code */
}
printf(".int l%d, 0\n.text\n", deflab);
deflab = dl;
swp = sswp;
}
c72/pdp11_mov.s at e151588a40fba563e1c82d865183bd2721a65363 · vegesm/c72
/*
Code to look up entries in a switch table.
%eax contains the value we want to switch on, %ebx has the switch table address
*/
1:
addl $8, %ebx
bswitch:
2: cmp (%ebx),%eax /* if first column matches, check second col */
je 1f
testl $-1, 4(%ebx)
jnz 1b
2:
jmp *(%ebx)
1:
testl $-1, 4(%ebx)
jz 2b
jmp *4(%ebx)
で分岐するようなコードを出力していた。 defaultの取り扱いが面白いっちゃ面白い。
テーブルジャンプというと
addr1 |
addr2 |
addr3 |
のようなものしか頭になかったのだけど
val1 | addr1 |
val2 | addr2 |
val3 | addr3 |
というのもあるということで。
Cのswitchがfall throughするのはなぜ? という元々の質問に対しては、 直接にはBやBCPLがそうだったから。 ということになるのだろうけど、 BCPLは…なんでだろうね?🤔
ずっと遡っていくと、 ひょっとしたらFORTRANの計算型GOTOあたりにたどりつくのだろうか。
- C / C++ 言語のswitch文を最適化 (テーブルジャンプが使われるようにする) - 人生に疲れた男のblog
- 索引 : GOTO - 計算形
- 多分岐処理 - 計算型GOTOとswitch|kzn|note
- 【テスト文書】計算型goto文・複雑な条件判断と分岐をたった1行にまとめられる超効率構文!! 【▲→川俣晶の縁側→PCホビイズム】
Mojo
メモ。
正直 Python もさっさと滅びてほしい言語のひとつではあるので、Mojo みたいな延命アプローチは勘弁してほしいんだよなあ
— AoiMoe a.k.aしお兄P (@AoiMoe) May 5, 2023
AI/機械学習に特化した新プログラミング言語「Mojo」が誕生し,かなり注目されてますhttps://t.co/viJpJHGeu4
— 今井翔太 / Shota Imai@えるエル (@ImAI_Eruel) May 4, 2023
・Pythonの3500倍早い
・文法はPython意識. 互換性を一定程度保つ予定
・開発者がSwift(Apple/iPhoneでお馴染み)と同じ
・かつてのObjective-C→Swift移行を意識
ということで期待が大きい pic.twitter.com/AcnVbKROvz
CPython比35000倍(ツイートにある3500倍は間違いらしい) というのに「どういうこっちゃ?」と思ったが、 それはメニーコアなどを(思う存分?)活用できるコードでの比較結果で、 軒並みそんだけ早くなるという話ではないらしい。 まあそうだよねえ(それでもびっくりだけど)。
Swift の型システムが複雑すぎてコンパイルが遅い問題は設計者 Chris Lattner も悔いているようで、今作っている Mojo 言語では同じ過ちは繰り返さないと言っている https://t.co/cCNX0HCODd
— ともくんのママ (@uasi) May 4, 2023
Modular Docs - Mojo🔥 https://t.co/YoLKMGoWOo 見てるけど戦略が面白いな。Python への完全互換性を持ちつつ Mojo への移行を促していくという戦略なのか。
— V (@voluntas) May 3, 2023
"このアプローチは、Appleが行ったObjective-CからSwiftへの移行で使われ、証明されました" Swift の作者が言うと説得力がすごい。
Mojo🔥 の Programming manual を一通り読んだのでまとめてみた✍
— lotz (@lotz84_) May 5, 2023
メモリ管理はGCではなくRustに触発された Ownership + Borrow Checker
パラメータというメタプログラミングの仕組みを導入してるのも面白いhttps://t.co/lLaK1Y5KLC pic.twitter.com/AKkV0ZbfJu
- Mojo – a new programming language for AI developers | Hacker News
- Mojo 🔥: Programming language for all of AI
- Modular Docs - Mojo🔥
- Mojo 🔥
- Mojoは「C言語のように速いPython」なのか - k0kubun’s blog
Carbon
- Will Carbon Replace C++? | Hacker News
- Will Carbon Replace C++? - Semaphore
- プログラミング言語「Carbon」はC++の“あの問題”を解決するのか、しないのか:「C++」の後を継ぐ「Carbon」【後編】 - TechTargetジャパン システム開発
- C++の後継言語「Carbon」がRustと“決定的に違う点”はこれだ:「C++」の後を継ぐ「Carbon」【前編】 - TechTargetジャパン システム開発
- プログラミング言語「C++」が嫌われる理由と、それでも使われ続ける理由:「Carbon」は「C++」の後継になり得るか【第1回】 - TechTargetジャパン システム開発
- Googleのプログラミング言語「Carbon」がC++の後継になれない“残念な理由”:「Carbon」は「C++」の後継になり得るか【第4回】 - TechTargetジャパン システム開発
急行渋谷行き
ちょっと気になったので、東横線の渋谷行き(特に急行)がどのくらいあるのか調べてみた。 特に深い理由もなく自由が丘駅のの時刻表から。
自由が丘駅(東京)(東急東横線 渋谷方面)の時刻表 - 駅探
05時
05:50 | 急行 渋谷行き |
05:54 | 各駅停車 和光市行き |
05:58 | 急行 渋谷行き |
05:59 | 各駅停車 渋谷行き 当駅始発 |
06時
06:15 | 各駅停車 渋谷行き |
06:27 | 急行 渋谷行き |
06:32 | 各駅停車 渋谷行き |
06:41 | 特急 渋谷行き |
06:49 | 各駅停車 渋谷行き |
07時
07:11 | 各駅停車 渋谷行き |
07:16 | 各駅停車 渋谷行き |
07:21 | 各駅停車 渋谷行き |
07:32 | 各駅停車 渋谷行き |
07:37 | 各駅停車 渋谷行き |
08時
08:49 | 急行 渋谷行き |
08:51 | 各駅停車 渋谷行き |
09時
09:15 | 各駅停車 渋谷行き |
09:27 | 各駅停車 渋谷行き |
09:32 | 各駅停車 渋谷行き |
09:46 | 各駅停車 渋谷行き |
09:57 | 急行 渋谷行き |
10時
10:03 | 各駅停車 渋谷行き |
10:05 | 急行 渋谷行き |
10:20 | 急行 渋谷行き |
10:26 | 各駅停車 渋谷行き |
10:41 | 各駅停車 渋谷行き |
10:55 | 急行 渋谷行き |
11時
11:11 | 各駅停車 渋谷行き |
11:25 | 急行 渋谷行き |
11:41 | 各駅停車 渋谷行き |
11:55 | 急行 渋谷行き |
12時
12:11 | 各駅停車 渋谷行き |
12:25 | 急行 渋谷行き |
12:41 | 各駅停車 渋谷行き |
12:55 | 急行 渋谷行き |
13時
13:11 | 各駅停車 渋谷行き |
13:25 | 急行 渋谷行き |
13:41 | 各駅停車 渋谷行き |
13:55 | 急行 渋谷行き |
14時
14:11 | 各駅停車 渋谷行き |
14:25 | 急行 渋谷行き |
14:41 | 各駅停車 渋谷行き |
14:55 | 急行 渋谷行き |
15時
15:11 | 各駅停車 渋谷行き |
15:25 | 急行 渋谷行き |
15:33 | 各駅停車 渋谷行き |
15:47 | 各駅停車 渋谷行き |
15:55 | 急行 渋谷行き |
15:56 | 各駅停車 渋谷行き |
16時
16:25 | 急行 渋谷行き |
16:41 | 各駅停車 渋谷行き |
16:56 | 各駅停車 渋谷行き |
17時
17:12 | 各駅停車 渋谷行き |
17:38 | 各駅停車 渋谷行き |
17:51 | 急行 渋谷行き |
18時
18:01 | 各駅停車 渋谷行き |
18:21 | 急行 渋谷行き |
18:38 | 各駅停車 渋谷行き |
18:51 | 急行 渋谷行き |
18:58 | 各駅停車 渋谷行き |
19時
19:08 | 各駅停車 渋谷行き |
19:21 | 急行 渋谷行き |
19:28 | 各駅停車 渋谷行き |
19:38 | 各駅停車 渋谷行き |
19:51 | 急行 渋谷行き |
20時
20:08 | 各駅停車 渋谷行き |
20:21 | 急行 渋谷行き |
20:28 | 各駅停車 渋谷行き |
20:38 | 各駅停車 渋谷行き |
20:51 | 急行 渋谷行き |
20:58 | 各駅停車 渋谷行き |
21時
21:21 | 急行 渋谷行き |
21:23 | 各駅停車 渋谷行き |
21:28 | 各駅停車 渋谷行き |
21:42 | 通勤特急 渋谷行き |
21:51 | 急行 渋谷行き |
21:59 | 各駅停車 渋谷行き |
22時
22:06 | 急行 渋谷行き |
22:08 | 各駅停車 渋谷行き |
22:14 | 各駅停車 渋谷行き |
22:22 | 急行 渋谷行き |
22:27 | 通勤特急 渋谷行き |
22:32 | 急行 渋谷行き |
22:38 | 各駅停車 渋谷行き |
22:57 | 通勤特急 渋谷行き |
22:59 | 各駅停車 渋谷行き |
23時
23:02 | 急行 渋谷行き |
23:18 | 各駅停車 渋谷行き |
23:21 | 急行 渋谷行き |
23:28 | 各駅停車 渋谷行き |
23:42 | 通勤特急 渋谷行き |
23:56 | 通勤特急 渋谷行き |
00時
00:19 | 各駅停車 渋谷行き |
思ったより渋谷止まりの本数があったので驚いた。 細かく見ると、
15:41 | 各駅停車 石神井公園行き |
15:46 | Fライナー 所沢行き |
15:47 | 各駅停車 渋谷行き |
15:51 | 急行 池袋行き |
15:55 | 急行 渋谷行き |
15:56 | 各駅停車 渋谷行き |
16:01 | Fライナー 森林公園行き |
16:02 | 各駅停車 和光市行き |
この辺で 急行渋谷行きに続いての各停渋谷行きがあったり (しかもその急行の前の各停も渋谷止まり)して これもちょっとびっくり。
MID$
HP-BASIC
FORTRAN Compiler on IBM 704
立てば炸薬、座れば地雷。
— 大山 格🇺🇦 (@itaru_ohyama) May 3, 2023
進む姿は匍匐前進。 https://t.co/bTgB9yuM4a
2001年以降の地銀破綻。 pic.twitter.com/cLcSvw6ax9
— Shen (@shenmacro) May 3, 2023
ふむ。こんな可視化(グラフ)のやり方もあるのか。
May the forks be with you. Always. pic.twitter.com/h7pjy4Lx7G
— GitHub (@github) May 4, 2023
5/4(May 4th)にひっかけたアレ。