ときどきの雑記帖 RE* (新南口)
宇宙からのメッセージ
今週のしずえさん
イタリアの銀行ではある食品を担保に融資を受けることができるが その食品とは?
いいとこどり
協力させるだけさせといて、結局いいとこ取りですか
— K.Q.S@謝辞 (@skm58) July 18, 2021
この「いいとこどり」の使い方に疑問を感じたのだけど、 ひょっとして「おいしいところ(いいところ)を全部持っていって分け前をよこさない」 みたいな意味合いで使ってたりするのだろうか?
それを言うなら「やらずぶったくり」の方が近いような。
渋谷駅
今度は山手線のホームの移設準備と。
そういえば今現在外回りで使っているホームは将来なくなるんだった。 それにあわせて改札も動くと。
チーム・カブトムシの歌
この時期に流れるこれが結構好き (特に「エイッ」のあたりが)。
論理式の(整数としての)値
'教科書通りの方法
A$=INKEY$
IF A$="4" THEN X=X-1
IF A$="6" THEN X=X+1
IF A$="2" THEN Y=Y-1
IF A$="8" THEN Y=Y+1
'少しマニアックな方法
A$=INKEY$
X=X+(A$="4")-(A$="6")
Y=Y+(A$="2")-(A$="8")
ところで第二のテクニックはいつ身に付けたのだろう。あらためてWebMSXをさわってみたのだが、MSXではエラーになってしまった。 Excel VBAでもなかった。どうやら私とこの手法のファーストコンタクトはプチコンなようだ。
あれ、二番目の記述は当時のBASIC一般で使えた気がしたけど違ったのか>MSXでエラーになった
Regex Legends
Henry Spencer を 「Perl2用の正規表現エンジン作者」 と言っちゃうのはあんまりな気が。
正規表現を普及させた偉人たち:
— 新山祐介 (Yusuke Shinyama) (@mootastic) July 18, 2021
- Alfred Aho (ドラゴン本共著者)
- O'Reillyの正規表現本の著者
- PowerGREP作者
- PCRE開発者
- Stephen Kleene ("*" 記号の考案者)
- Perl2用の正規表現エンジン作者
- Ken Thompson (UNIX開発者の一人)
- Larry Wall (Perl作者)https://t.co/JVvC3YAs1D
Regex Legends: The People Behind the Magic
Henry Spencer
Spencer is a Canadian programmer and space enthusiast who created three widely used, adapted, and influential regular expression libraries. In 1986, he was the first to release a regex library which could be freely included in other programs. Perl 2’s regex package was based on and enhanced from Spencer’s library, but his technological tour de force was creating the regex package used by Tcl. This implementation, Jeffrey Friedl writes, “is a hybrid [NFA/DFA engine] with the best of both worlds”. [1]
おお、ここでもthe best of both worlds が。
それはさておき、
Perl 2's regex package was based on and enhanced from Spencer's library,
なので、「作者」ではないと思うのであります。
あと元記事ではtour de forceがイタリックになっていて、なんか特別な意味があるのかと思い調べてみると…
ところでLarry Wallについての記述をみると
Larry Wall
Wall created and continues to oversee development of Perl, which has done more than any other programming language to popularize and extend the power of regular expressions. Many programming languages including ColdFusion, Java, JavaScript, the .NET Framework, PHP, Python, and Ruby have since adopted regex syntax and features similar to Perl’s. The recently released Perl 5.10 continues to push the state of the art in regex power, and upcoming changes outlined by Wall for Perl 6 (called Perl 6 rules; described in Apocalypse, Synopsis, and Exegesis 5) fearlessly redesign Perl’s regular expression language.
Perl 5.10とかずいぶん前のバージョンでは。 いったいこの記事はいつ頃書かれたものなのよ という疑問を抱いた人は他にもいたようで、 Hacker Newsのこれによれば2008年1月らしい。
Regex Legends: The People Behind the Magic | Hacker News
No date on the post, but the mention of perl5.10 puts this between 2007-2010, per https://www.activestate.com/solutions/perl-version-support/
Understanding the history of how we got here is crucial.
The HTML of the comments section suggests it was posted Jan 14 2008.
なるほどと自分でも確かめてみると、それっぽい記述が確かにあった。
2.0 1988年6月05日 ヘンリー・スペンサー作の美しい正規表現ライブラリを Perl 風にアレンジし、導入した。
Battleship
しばらく更新がなかったけどなんかあったんだろうか。 まあそれはともかく
戦艦
アダム: リチャードは、バス鉄工所の契約社員として、DDG-79オスカー・オースチンのソフトウェアを担当していました。 これは戦艦で、徹底的に武装して艦隊を守るタイプのものです。
この文脈で「戦艦」はねーだろ。と思ったら原文(podcastの書き起こしだけど)でも 「Battleship」になってるのか。
The Untold Story of SQLite With Richard Hipp - CoRecursive Podcast
The Battleship
Adam:Richard was a contractor for Bath Iron Works working on software for the DDG-79 Oscar Austin. That is a battleship, the type that protects a fleet by being armed to the hilt.
でもなあ。DDG だしなあ。「軍艦」くらいにしたいよなあ。
オスカー・オースチン (ミサイル駆逐艦) - Wikipedia
オスカー・オースチン (英語: USS Oscar Austin, DDG-79) は、アメリカ海軍のミサイル駆逐艦。 アーレイ・バーク級ミサイル駆逐艦の29番艦。艦名は名誉勲章を受章したアメリカ海兵隊のオスカー・P・オースチン上等兵に因む。
じゃあ(Battleshipという単語は)英語の辞書的にはどうなん? とみてみると
Battleship | Definition of Battleship at Dictionary.com
noun
any of a class of warships that are the most heavily armored and are equipped with the most powerful armament.
うーむ。
glob zsh 6
ループから。
(コメントを信じるならば)qualifierの処理をしているものであって、 今回追いかけている目的にはあまり関係ない(と思われる)ものなので さらっと流すのが良いのだろうか。
/* Check for qualifiers */
while (!nobareglob ||
(isset(EXTENDEDGLOB) && !zpc_disables[ZPC_HASH])) {
struct qual *newquals;
char *s;
int sense, qualsfound;
off_t data;
char *sdata, *newcolonmod, *ptr;
int (*func) _((char *, Statptr, off_t, char *));
/*
* Initialise state variables for current file pattern.
* newquals is the root for the linked list of all qualifiers.
* qo is the root of the current list of alternatives.
* ql is the end of the current alternative where the `next' will go.
* qn is the current qualifier node to be added.
*
* Here is an attempt at a diagram. An `or' is added horizontally
* to the top line, a `next' at the bottom of the right hand line.
* `qn' is usually NULL unless a new `or' has just been added.
*
* quals -> x -> x -> qo
* | | |
* x x x
* | |
* x ql
*
* In fact, after each loop the complete set is in the file static
* `quals'. Then, if we have a second set of qualifiers, we merge
* the lists together. This is only tricky if one or both have an
* `or' in them; then we need to distribute over all alternatives.
*/
newquals = qo = qn = ql = NULL;
sl = strlen(str);
if (!(qualsfound = checkglobqual(str, sl, nobareglob, &s)))
break;
/* Real qualifiers found. */
nobareglob = 1;
sense = 0; /* bit 0 for match (0)/don't match (1) */
/* bit 1 for follow links (2), don't (0) */
data = 0; /* Any numerical argument required */
sdata = NULL; /* Any list argument required */
newcolonmod = NULL; /* Contains trailing colon modifiers */
str[sl-1] = 0;
*s++ = 0;
if (qualsfound == 2)
s += 2;
for (ptr = s; *ptr; ptr++)
if (*ptr == Dash)
*ptr = '-';
さらっと関数ポインターの宣言
int (*func) _((char *, Statptr, off_t, char *));
があったりするのが気になるけど何に使うものだろう?
内側にあるwhileループの先頭で初期化しているな。 このループのどこかで設定したり呼び出しているということか。
while (*s && !newcolonmod) {
func = (int (*) _((char *, Statptr, off_t, char *)))0;
if (*s == ',') {
/* A comma separates alternative sets of qualifiers */
s++;
sense = 0;
if (qualct) {
qn = (struct qual *)hcalloc(sizeof *qn);
qo->or = qn;
qo = qn;
qualorct++;
qualct = 0;
ql = NULL;
}
} else {
switch (*s++) {
case ':':
/* Remaining arguments are history-type *
* colon substitutions, handled separately. */
newcolonmod = s - 1;
untokenize(newcolonmod);
if (colonmod) {
/* remember we're searching backwards */
colonmod = dyncat(newcolonmod, colonmod);
} else
colonmod = newcolonmod;
break;
case Hat:
case '^':
/* Toggle sense: go from positive to *
* negative match and vice versa. */
sense ^= 1;
break;
**この辺省略**
default:
untokenize(--s);
zerr("unknown file attribute: %c", *s);
restore_globstate(saved);
return;
}
}
if (func) {
/* Requested test is performed by function func */
if (!qn)
qn = (struct qual *)hcalloc(sizeof *qn);
if (ql)
ql->next = qn;
ql = qn;
if (!newquals)
newquals = qo = qn;
qn->func = func;
qn->sense = sense;
qn->data = data;
qn->sdata = sdata;
qn->range = g_range;
qn->units = g_units;
qn->amc = g_amc;
qn = NULL;
qualct++;
}
if (errflag) {
restore_globstate(saved);
return;
}
}
ここまでで内側のwhileループ終わり。 switch 文につづくif文で funcに有効なポインタがあるかどうか判定してなにやらやっているので、 修飾子に絡む何かか。
qn->func = func;
というのがあるので、呼び出すのは全然別のところか? しかしこの件は脇に置いて先へ進む。
上記のループを抜けた直後のここは修飾子の処理結果をリスト(linked list)にまとめている。のかな。
if (quals && newquals) {
/* Merge previous group of qualifiers with new set. */
if (quals->or || newquals->or) {
/* The hard case. */
struct qual *qorhead = NULL, *qortail = NULL;
/*
* Distribute in the most trivial way, by creating
* all possible combinations of the two sets and chaining
* these into one long set of alternatives given
* by qorhead and qortail.
*/
for (qn = newquals; qn; qn = qn->or) {
for (qo = quals; qo; qo = qo->or) {
struct qual *qfirst, *qlast;
int islast = !qn->or && !qo->or;
/* Generate first set of qualifiers... */
if (islast) {
/* Last time round: don't bother copying. */
qfirst = qn;
for (qlast = qfirst; qlast->next;
qlast = qlast->next)
;
} else
qfirst = dup_qual_list(qn, &qlast);
/* ... link into new `or' chain ... */
if (!qorhead)
qorhead = qfirst;
if (qortail)
qortail->or = qfirst;
qortail = qfirst;
/* ... and concatenate second set. */
qlast->next = islast ? qo : dup_qual_list(qo, NULL);
}
}
quals = qorhead;
} else {
/*
* Easy: we can just chain the qualifiers together.
* This is an optimisation; the code above will work, too.
* We retain the original left to right ordering --- remember
* we are searching for sets of qualifiers from the right.
*/
qn = newquals;
for ( ; newquals->next; newquals = newquals->next)
;
newquals->next = quals;
quals = qn;
}
} else if (newquals)
quals = newquals;
}
かくしごと
Not only is the Internet dead, it’s starting to smell really bad.:2021年07月20日分
まぁ長くなるのでまたいずれ機会があれば。
こっちも長くなるしでまたいずれ。
わくわく😄 (実は公開初日に行った奴。ただし二週目には行っていないので「後半」がどんなものか知らない…)
銀河の歴史がまた一ページ
宇宙暦640年7月18日正午 自由惑星同盟軍本隊と銀河帝国軍本隊が正面から激突した。数に勝る帝国軍が有利な状況であったが、同盟軍の戦力を過大評価したため前進をやめた。一方の同盟軍総司令部も精彩を欠き、戦況は膠着した。#ダゴン星域会戦 #外伝5巻
— 今日は何の日@銀英伝bot (@logh_today) July 18, 2021
宇宙暦640年7月19日 リン・パオ司令官とトパロウル参謀長は同一の結論に達し、全兵力をあげて帝国軍本隊への攻撃を開始した。#ダゴン星域会戦 #外伝5巻
— 今日は何の日@銀英伝bot (@logh_today) July 18, 2021
宇宙暦640年7月20日22:40 リン・パオ司令官は全軍に対し、敵軍が残余の兵力を集中させた時点でそれを包囲攻撃せよと指令した。このとき、包囲網はすでに完成の直前にあり、総攻撃の指令を待つのみであった。#ダゴン星域会戦 #外伝5巻
— 今日は何の日@銀英伝bot (@logh_today) July 20, 2021