ときどきの雑記帖 RE* (新南口)
石の猫
渋谷
246越えた向こう側か。
宮益坂から道玄坂まで「谷底」に降りずに移動できるようになるってのもなかなかすごそう。 あー、でもかなりの部分はできてるのかその経路も (ヒカリエの裏辺りからフクラスや井の頭線の渋谷駅まで)。
ついでにこっちも。
線路のかさ上げ作業では、レールの位置だけではなく、ホームの高さも上昇させる必要があります。ここでは、 ホームという構造物自体をジャッキで上昇させるのではなく、仮設の床をかさ上げする方法で、 作業が進められていました。ホームの下には鋼管が配置されており、その上に木の土台を置くことで、 ホーム高さを調整する仕組みです。もちろん、これは仮設の床のため、今後あらためて本設ホームの工事が進められる予定です。
ホームドアを(まだ)設置できないわけだよねえ。 簡易型のものならひょっとしたら可能かもしれないけど。
宇都宮
いつ行けるかなあ…
#宇都宮LRT #ライトライン 平日昼間の盛況ぶりを見ていて気づいた。通勤通学客がいなくなる平日昼間に、中高年女性の外出需要を獲得するようになったか…! おばちゃん達に支持される製品やサービスは強い。しかもおばちゃんの口コミで評判が広がっていくから宣伝効果も大きい。 https://t.co/9TWMwHsjvg
— ぷよ太郎 (@puyotaroh) November 23, 2023
昼間なのにこの乗客数。
— タテモノスキー (@tatemonoski) November 20, 2023
誰ですか?
昼間は空気運ぶって言ってた人は⁇#宇都宮ライトレール #LRT pic.twitter.com/I1tsewyv6c
新刊近刊
矢沢さん本
見かけたのでパラパラと眺めてみた。
bitapやビットカウントについても書かれていて、 いい方向に驚いた(ちと失礼な物言いだけど)。
にしても、基本情報の問題でも出てくるんだねえ>Bitapアルゴリズム
基本情報技術者過去問題 令和元年秋期 午後問8(データ構造及びアルゴリズム)|基本情報技術者試験.com
efficient
某所で早売りされているのを見かけたのでどんなものかと思ったけど、 今の自分には(買わないでも)いいかなあ という感じだった。
詳しい書評(や感想)は誰か書くだろう。たぶん。
それはそれとして
awk "$1<=\"$(date +%Y-%m-%d)\"" input.txt
みたいなワンライナーが載っていて改めて思ったのだけど この辺どうにかならないもんですかねえ。
PerlやRubyだと 内側の(言語処理系に対する)文字列をくくるのに qq演算子や%Q記法が使えるんだけど。
コマンドプロンプト本
displayswitch.exeについて調べたくて、 この本に載っていたら(それでも内容次第だけど) 買おうと思って書店でチェックしてみたら 載っていませんでしたの巻。 amazonでポチっていたら大ダメージを受けていたところだった。
- マルチディスプレイの「メインのみ/拡張/複製/セカンドのみ」を簡単に切り替えるコマンド - QWERTY.WORK
- Displayswitchコマンドを活用してスマートにディスプレイを切り替える – おもしろちゃんじゃん
- 【悲報】DisplaySwitch.exe改悪 22H2 Update後の対策
- DisplaySwitch.exe behavior on Windows 11 22H2 - Microsoft Q&A
Better string handling for the kernel
読めるようになったので読んだ。
Better string handling for the kernel [LWN.net]
Seq_buf was introduced in 2014 for the 3.19 kernel release as an improved way to build strings in the tracing subsystem. It is organized around this structure:
struct seq_buf { char *buffer; size_t size; size_t len; loff_t readpos; };
ふむ。 実体をポインターで持つことには メリットもデメリットもあると思うんだけど その辺どう判断したんだろうか。
language
C3
C2の後継(?)でC3。らしい。
bruh go with the times we are on c99 already
このコメントの意味(とくにbruh)がよくわからなかったのでググると やはりスラングだったか
Neat now we have D2 and C3 - really looking forward to B4 and E1
英文字1文字+数字1桁のプログラミング言語にD2というものがあるので、 B4とE1があればきれいに並ぶという話 (P5は?)
ん?ひょっとしてその並びだとF0
もアリか?😄
uiua
すごい言語だ。レベルが違うhttps://t.co/X3MRVHFYyO pic.twitter.com/DnDyUlneds
— あいや🐕 (@public_ai000ya) November 23, 2023
なんかちょっと前に見かけた名前のような…と思ったら 新山さんもチェックしていた奴 だった。
新山祐介 (Yusuke Shinyama): “プログラミング言語 Uiua - すべての演算子が1文字で表…” - Mastodon 🐘
code_report
先の投稿についたフォローを追いかけるといくつか興味深いものがあった。
このタイプの言語(*どれ?)、このcode_reportってYouTubeチャンネルでいくつか扱ってておもろいのでおすすめ
— Cj-bc_sd.sh@ソーダー (@Cj_bc_sd) November 23, 2023
動画見て何となくはわかったけど全然慣れはしない...https://t.co/rhTc8ZznMe https://t.co/CjT6BPdim1
BQN
APLかな?と思ったけど、間に(APLを一文字づつ進めた)BQNという言語があって、その系譜なんですね https://t.co/9hlNdVmIjy
— Akira Ishino (@akrisn) November 23, 2023
Why I Love BQN So Much! (vs Python)https://t.co/2X0J5ceGlV
— chamekan (@chame) November 23, 2023
I
スタックベースの 配列プログラミング言語 - Uiuahttps://t.co/TWHySDa9Am
— chamekan (@chame) November 23, 2023
>Griph は関数の効果と対応するように選択されているため、一度覚えて慣れてしまうとコードが圧倒的な情報密度で表現・視認できるという効果があります。 pic.twitter.com/O8STbd9KK3
Iという言語は知らなかった(BQNもだけど)。 あとこの図だとAPLとDyalog APLが別物になっているけど なにか大きな違いがあったっけ?
Dyalog APL, or simply Dyalog, is a nested APL based on NARS and APL2, first released by British company Dyadic Systems Ltd. (now Dyalog Ltd.) in 1983 for the Zilog Z8000 processor. (The name Dyalog is a portmanteau of Dyadic and Zilog).
ふむ。
awk
one true awk
awk: regular expression too big: out of space in set_gototab...
・ Issue #199 ・ onetrueawk/awk- Correctly reset the goto table for a state. by millert ・ Pull Request #200 ・ onetrueawk/awk
この辺りの話に進展があった。
awk: regular expression too big: out of space in set_gototab...
· Issue #199 · onetrueawk/awk
gototab issues have been fixed for wide-character induced growth.
とコメントがあり
fix issue #199: gototab improvements · onetrueawk/awk@08544f6
@@ -25,6 +25,11 @@ THIS SOFTWARE.
This file lists all bug fixes, changes, etc., made since the
second edition of the AWK book was published in September 2023.
Nov 24, 2023:
Fix issue #199: gototab improvements to dynamically resize the
table, qsort and bsearch to improve the lookup speed as the
table gets larger for multibyte input. thanks to Arnold Robbins.
Nov 23, 2023:
Fix Issue #169, related to escape sequences in strings.
Thanks to Github user rajeevvp.
というコミットがすぐに見つかったけど 実際にコードを変更したコミットを History for b.c - onetrueawk/awk から探すのにちょっと手間取った。
でまあ、元はこういう
static int get_gototab(fa *f, int state, int ch) /* hide gototab inplementation */
{
int i;
for (i = 0; i < f->gototab_len; i++) {
if (f->gototab[state][i].ch == 0)
break;
if (f->gototab[state][i].ch == ch)
return f->gototab[state][i].state;
}
return 0;
}
見るからに素直に線形探索しているコードを 二分探索するように変えたのがこれ Sort the gototab entries and binary search them. · onetrueawk/awk@e7ad51d (二分探索ができるようにソートも追加されている)
ちょっと(性能的に)気になる点があるっちゃあるんだけど それは実際に動かして(そして計測して)みないと わからんからなあ。
FORTRAN Compiler on IBM 704
にゃーん。
member
わたしLinux kernel mailing listで「お前がなぜ構造体のfieldのことをmemberと呼ぶのか分からないがティムポのことだからやめたほうがいい」と注意されたことがあります。相手は英語ネイティブ。しらねーよ
— がちゃぴん先生 (@gachacomplete) November 21, 2023
member という英単語に「(手足などの) 体の一部」なんて意味があるとは知らなかった…
— Shinya Kato (@0x19f) November 21, 2023
“member” が陰茎の隠語なの結構困るんよな,プログラムの説明で使いたいことがかなりある(“entry” で言い換えればいいかなと思っていたが,“item” などでいい表す方法もあるっぽい)
— 画力・博士号・油田 (@bd_gfngfn) November 21, 2023
でもC言語というコンテキスト的には構造体はfieldが正しいような気がする。memberって言いだすのはC++あたりじゃなかろうか?
— MURAOKA Taro (@kaoriya) November 22, 2023
これだから北米人は案件だ…(イギリスフランス以外のヨーロッパでは普通に使われている楽器の名前が北米人が俗語にしてしまったせいで英語で使えなくなってしまったという楽器をやっているのでとても共感)
— sylph01 (@s01) November 22, 2023
これ(memberは俗にティムポのことである)まじ? https://t.co/AG7Da8ijXh
— 🍣maguro (@yusuktan) November 22, 2023
辞書ひこうよ… (自分はオックスフォードの英英で確認した)😓
と思ったが、 ちゃんと調べていたらしい(失礼しました)。 後続のツイートで Why is “member” a slang term for “penis”? - Quora を紹介していた。
で、辞書的にはともかく、Cに関するドキュメント類(や仕様書)で どのように書かれているのか気になったのでちょいと見てみると、 たとえばChistory だと
Beguiled by the example of PL/I, early C did not tie structure pointers firmly to the structures they pointed to, and permitted programmers to write `pointer->member` almost without regard to the type of pointer; such an expression was taken uncritically as a reference to a region of memory designated by the pointer, while the member name specified only an offset and a type.
While it foreshadowed the newer approach to structures, only after it was published did the language support assigning them, passing them to and from functions, and associating the names of members firmly with the structure or union containing them.
Compilers in 1977, and even well after, did not complain about usages such as assigning between integers and pointers or using objects of the wrong type to refer to structure members.
のように、member
を使っている。
一方 c.texi - c-intro-and-ref.git - GNU C Language Intro and Reference だと
@cindex fields in structures
A @dfn{structure} is a user-defined data type that holds various
@dfn{fields} of data. Each field has a name and a data type specified
in the structure's definition.
@node Field Offset
@section Field Offset
@cindex field offset
@cindex structure field offset
@cindex offset of structure fields
To determine the offset of a given field @var{field} in a structure
type @var{type}, use the macro @code{offsetof}, which is defined in
the file @file{stddef.h}. It is used like this:
@example
offsetof (@var{type}, @var{field})
@end example
field
を使っている。
member
も使っているのだけど
The members don't have to be different in data type. Sometimes
each member pertains to a way the data will be used. For instance,
@example
union datum
@{
double latitude;
double longitude;
double height;
double weight;
int continent;
@}
@end example
This union holds one of several kinds of data; most kinds are floating
points, but the value can also be a code for a continent which is an
integer. You @emph{could} use one member of type @code{double} to
access all the values which have that type, but the different member
names will make the program clearer.
unionに対して。
ちなみにK&Rだと、索引に「(構造体の)メンバー」はあるけど 「フィールド」はなかった (正確には「ビットフィールド」で出てくるは出てくる)。
ところで このポストの引用 / X を追いかけてみると 「オースティン・パワーズ ゴールドメンバー」 に言及している発言が複数あって、 ひょっとして? と思って調べたら
『オースティン・パワーズ ゴールドメンバー』(Austin Powers in Goldmember)は、2002年に製作されたアメリカ合衆国のコメディ映画。 「メンバー(member)」は陰茎を意味するスラングで、「ゴールドメンバー(goldmember)=金の陰茎」は『007 ゴールドフィンガー』のパロディである。 タイトルを巡って『007』シリーズを製作するメトロ・ゴールドウィン・メイヤーから提訴されたものの、変更なしで公開された。
そうだったのか! (オースティン・パワーズは2作目までしか観ていない)
kinabaさん
「1+1」と「1 + 1」に違いはあるのだろうか。
— ふも (@fumokmm) November 24, 2023
そう言えばkinabaさんが演算子の周りの空白の置き方で 式の部分式の評価順(優先順位)を変えると どうだとか話していたことがあったような。
あと数値リテラルとは事情が違うけど、
long-name
みたいに
つなげる記号に-
や+
を使いたくなることがある😄
ので、空白あるなし(の強制)もありかもしれない。
現状でも使える言語がないわけではないけど。