ときどきの雑記帖 RE* (新南口)
不可思議のカルテ
あのころの自分が知っていたらと思う103のアドバイス
ケヴィン・ケリーが人生のアドバイスをまとめた本を出していた - YAMDAS現更新履歴
なんとなくどこかで聞いたような話だよなと思って 以前書いた新山さんのツイートからのネタ
今年70歳になった著者による「あのころの自分が知っていたらと思う103のアドバイス」
— 新山祐介 (Yusuke Shinyama) (@mootastic) April 30, 2022
- ほとんどの場合、適切なタイミングは今である。
- 自分の所有物を立派だと思っているのは自分だけ。
- 決して自分がなりたくない人物のために働いてはならない。
...https://t.co/0b0BiyVEkI
を見返してみると…
あれって、ケヴィン・ケリーが書いてたんだ。気がつかなかった😓 ところで元記事に対するリンク先の内容が大きく変わっているような?
- 70歳になった「WIRED」共同創業者の思う「若いころ知っておけばよかった103のこと」 - GIGAZINE
- The Technium: 103 Bits of Advice I Wish I Had Known
そしてもう一つ見覚えのある本の紹介が
ダグラス・ラシュコフの新刊『デジタル生存競争』が来月出るぞ! - YAMDAS現更新履歴
億万長者の危険な生き残り思想を論じる本の邦訳は、イーロン・マスクの危険性が露になった2023年に求められているものだと、 ゴールデンウィーク中に以下の文章を読んだときも切実に思いましたね。
ふむ。
電子版と紙版が6月末に同時発売されるが、両者で値段に差があるのにご注意ください。
とあるのだけど、Amazonで見つかるのは紙版だけのようなので はて?と 調べてみると ダグラス・ラシュコフ:デジタル生存競争 – 理想書店 | 個人作家を応援する電子本販売ストア であつかっているものらしい。
電子版: 990円(税込) 印刷版:2,200円(税込)
この電子版はここのユーザー登録をしないといけないようで、さてどうしよう。
RubyKaigi2023
行きたかったでござる
RubyKaigi 2024
— RubyKaigi (@rubykaigi) May 13, 2023
Naha, Okinawa
May 15th..17th, 2024#rubykaigi
school gang leader
(2ページ目)日本人投手にはマネできない…DeNA「バウアー」の独特過ぎる練習法に若手は羨望の眼差し | デイリー新潮
「米メディアは三浦大輔監督(49)にも興味津々です。現役時代のニックネームが番長(school gang leader)でしょ? バウアーが感情をコントロールできなくなったときや、イニング途中での交代を告げる際、どうやって抑えるのかって」
gawk 5.2.2
ふと gawk.git - gawk を見ていたら数日前に5.2.2がリリースされているようなのだけど、 メーリングリスト等でのアナウンスは見当たらない(2023年5月13日現在)。
どういうこと?
まあそれはさておき、変更内容などを確認。
2023-05-07 Arnold D. Robbins <arnold@skeeve.com>
* 5.2.2: Release tar ball made.
Changes from 5.2.1 to 5.2.2
Infrastructure upgrades: makeinfo 7.0.1 must be used to format the manual. As a result, the manual can also now be formatted with LaTeX by running it through `makeinfo –latex'.
Gawk no longer builds an x86_64 executable on M1 macOS systems. This means that PMA is unavailable on those systems.
Gawk will now diagnose if a heap file was created with a different setting of -M/–bignum than in the current invocation and exit with a fatal message if so.
Gawk no longer “leaks” its free list of NODEs in the heap file, resulting in much more efficient usage of persistent storage.
PROCINFO[“pma”] exists if the PMA allocator is compiled into gawk. Its value is the PMA version.
The time extension is no longer deprecated. The strptime() function from gawkextlib’s timex extension has been added to it.
Better information is passed to input parsers for when they want to decide whether or not to take control of a file. In particular, the readdir extension is simplified for Windows because of this.
The various PNG files are now installed for Info and HTML. The images files now have gawk_ prefixed names to avoid any conflicts with other installed PNG file names.
As usual, there have been several minor code cleanups and bug fixes. See the ChangeLog for details.
CSVファイル対応の話題がない? まだexperimentalってことなのだろうか。
ChatGPT
「ChatGPT」のプログラミング能力–「Fortran」「COBOL」などのマイナー言語で試す - ZDNET Japan という記事でChatGPTに書かせた(書いてもらった) プログラミング言語は以下の通り。
- FORTARN
- COBOL
- RPG
- Lisp
- ALGOL
- Simula
- BAL
- APL
- Prolog
- Smalltalk
「BAL」というのは
(IBM「System/360」「System/370」のアセンブリー言語)
とのこと。
記事中
ラベルは間違っているが、コードはFortranだ。
というのがFOTRAN以外にもなんどか出てきていて どういうことかと悩んだのだけど、 コードの置かれているbox(という表現で伝わる?)の 左上に置かれている 言語名のぶぶんのことか。
翻訳記事と違って元記事は1ページで読めるのな😄
I used ChatGPT to write the same routine in these ten obscure programming languages | ZDNET
あるたとえ話
前回
この話を聞いて、 プログラマーが「歓喜する」のはわかる。 純粋な数学者が 「なにが面白いのか理解できないようでした」 というのもまあなんとなく推測できる(ような気がする)。 でも経営者が 「目に見えて不機嫌になりました」 という理由がピンとこない😓
と書いた
私は異なる人々にこの話をしてきましたが、プログラマは一様にこの話を聞くと 歓喜するのに対して、 経営者は目に見えて不機嫌になりました。 いっぽう純粋な数学者は、なにが面白いのか理解できないようでした。
この部分だけど、原文を読んで納得した。
E. W. Dijkstra Archive: A parable. (EWD 594)
I have told the above story to different audiences. Programmers, as a rule, are delighted by it, and managers, invariably, get more and more annoyed as the story progresses; true mathematicians, however, fail to see the point.
なるほど、経営者(managers)は基本、(おそらくは利益につながるようなこと以外)何を聞いても不機嫌なのね。たぶん。
operator precedemce
他の探し物をしていて見つけた。
DAX 演算子 - DAX | Microsoft Learn
++演算子の優先順位**
1 つの数式で複数の演算子を組み合わせる場合、次の表に基づき、演算の順序が決定されます。 演算子の優先順位値が同じ場合、左から右にという順序になります。 たとえば、式に乗算演算子と除算演算子の両方が含まれている場合、 式に出現する順序で左から右に評価されます。
演算子 説明 ^ 累乗 – 符号 (-1 など) * と / 乗算と除算 + と – 加算と減算 & 2 つのテキスト文字列を接続します (連結) =、==、<、>、<=、>=、<>、IN 比較 NOT NOT (単項演算子)
これも単項のマイナスよりもべき乗演算子の方が優先順位が高いですね。
switch
MID$の件と言い、なんとなく昔やっていた(やらされていた)特許調査を思い出した。 今どきは、 わざわざ特許庁まで行って冊子をめくるようなことをしないでもいいんだろうなあ。
閑話休題。
Pascalのcase文がbreak不要な形式なものとして すぐに思い浮かぶものだけど、 じゃあPascalが影響を受けたもの、たとえばALGOLなんかは どうだったのだろうかと調べてみると
ALGOL-58
The Burroughs 205 and 220 Blog: Algol-58 – The International Algebraic Language
The basic symbols defined for the language are:
- The 26 English letters: A-Z [including both upper and lower case; the report is silent on the subject of case sensitivity]
- The decimal digits: 0-9
- Arithmetic operators: + – × /
- Relational operators: < ≤ = ≥ > ≠
- Logical operators: ¬ [not] ∨ [or] ∧ [and] ≡ [equivalence]
- Sequential operators: go to, do, return, stop, for, if, or, if either, or if
- Separators: . , : ; := =: → 10 begin end
- Brackets: ( ) [ ] ↑ ↓
- Declarators: procedure, array, switch, type, comment
というのがあって、 その中に「switch」があるのに気づいて これはと他の部分を見ていくと
Switch Declarations
A switch defines a multi-way branch, after the idea of the computed go-to in FORTRAN, but essentially the same as switches in Algol-60. Note that it is a declaration, not a statement. It defines an ordinal list of designational expressions, which are either simple statement labels or indexed switch identifiers. A statement label may be an identifier or a literal integer.
A switch is used by the go to statement, which takes as its target not a label, but the more general designational expression construct. The index used with a switch identifier is evaluated dynamically, not only for a switch named in a go to statement, but also for any switch identifiers used in designational expressions within switch declarations. Thus the evaluation of a designational expression may result in a cascade of switches being evaluated before a label is finally encountered and the destination of a branch determined.
switch s1:= (start, 44, s2[i×j-1], s1[k]); switch s2:= (5, 4, 3, 2, 1, blastoff); go to s1[3];
なんじゃこりゃ。
FORTRANの割り当て型GOTOみたいな感じ?
ALGOL-60
58→60ではこの部分に大きな違いはなさそう。
ALGOL-68
68ではswitch
はなくなりcase
となって構文も変化。
- https://www.softwarepreservation.org/projects/ALGOL/report/Algol68_revised_report-AB-600dpi.pdf
- ALGOL 68 - Wikipedia
long long
上記のうぃきぺのエントリでこんな部分を発見。
Furthermore, instead of defining both float and double, or int and long and short, etc., ALGOL 68 provides modifiers, so that the presently common double would be written as LONG REAL or LONG LONG REAL instead, for example.
gcc(が最初に導入したような記憶があるんだが要検証)のlong longはここから?
EXTENDED ALGOL
閑話休題。 68でもないさらに別のALGOLのvariantだけどこんな例を発見。
Examples of CASE Statements - ALGOL Programming Reference Manual, Volume 1: Basic Implementation
Examples of CASE Statements
CASE I OF
BEGIN
J := 1; % STATEMENT 0
J := 20; % STATEMENT 1
BEGIN % STATEMENT 2
J := 3;
K := 0;
END;
J := 4; % STATEMENT 3
END;
caseの「飛び先」で実行されるのはただひとつのstatementに限られる。という仕様のよう。 だから、複数のstatementを置きたい場合はBEGINとENDでくくれば構文的には単一文と同じ。と。
が、
CASE I OF
BEGIN
1:
2:
5:
7:
J := 3;
Q := J-1;
3:
4:
20:
J := 4;
ELSE:
GO TO BADCASEVALUE;
END;
ラベル付きだと(次のラベルが来るまでの)「statementの並び」になる?
- CASE Statement - ALGOL Programming Reference Manual, Volume 1: Basic Implementation
- Unnumbered Statement List - ALGOL Programming Reference Manual, Volume 1: Basic Implementation
- Numbered Statement List - ALGOL Programming Reference Manual, Volume 1: Basic Implementation
Pascal
ちなみにPascalはというと
Syntax von Pascal in Backus-Naur Form (BNF)
<case statement> ::= case <expression> of <case list element> {; <case list element> } end
<case list element> ::= <case label list> : <statement> | <empty>
<case label list> ::= <case label> {, <case label> }
caseの分岐先に置けるのがstatement
なのは変わらないのですな
(長いこと使ってないので忘れてた)。
FORTRAN Compiler on IBM 704
level analysisのコードと格闘中
sed
アドレス部でも後方参照可能。
— IT勉強中 (@IT41408082) May 5, 2023
その場合、s コマンドの検索パターンでは参照できないようだ。ただし、検索パターンを無指定にすればOKかもしれない。(下図参照) pic.twitter.com/a7OMJzjcQH
なぜそれ(後方参照)ができると思ったのだろう?
検索パターンを無指定にすれば~ というのは
If an RE is empty (that is, no pattern is specified) sed shall behave as if the last RE used in the last command applied (either as an address or as part of a substitute command) was specified.
これっすね。
バグ
ちょっとメニューを同時押ししただけなのに…! pic.twitter.com/KJbPNVhmMZ
— こげねこ (@suteneko1027) May 13, 2023
エラーメッセージから色々中身が推測できて以下略
M4
マイクロコード用アセンブラ、そこそこ動作するようになったのだが、やはりこのままでは使い物にならない事が判明。
— スダ (@sudamin) May 13, 2023
まあ当たり前なんだけどマイクロコードというのは機械語のさらに下層、超低レベル言語なので、超わかりづらい。
ぶっちゃけ自分で書いた10分後にはもう読めない(笑)。
こんな暗号みたいなのを8080の全命令ぶん書いてデバッグなんて到底無理なので、やはりアセンブラをマクロ対応にしてオブラートに包まないと無理という結論に。
— スダ (@sudamin) May 13, 2023
アセンブラのマクロ対応問題、あっさり解決。
— スダ (@sudamin) May 13, 2023
マクロ機能をm4というマクロプロセッサ?に任せることにした。世の中には便利なものがあるんだね。ソフト屋さんには常識なんだろうな、こういうの。
とりあえずこれで8080の全命令ぶんのマイクロコードを書くのも楽勝だぜ(たぶん)
「ソフト屋」でもM4を知っていたり ましてや使える人はそう多くないんじゃないかなあ。
このあとどうなっていくのか楽しみ😄
V
Volt, the app V was created for, is finally getting released for a public beta test on May 20, 2023!
— The V Programming Language (@v_language) May 13, 2023
It will be available for all three operating systems.
Here's a cool demo to show off the performance of this IM client: scrolling through 5000 Discord messages in 1 second! pic.twitter.com/kT9czJ6Zuf