ときどきの雑記帖 RE* (新南口)
一撃必殺うなってとぶが
空手バカ一代のアニメは大昔に再放送で何話か観たことがあるだけで OPの歌詞も曲も全然覚えていなかったのだけど、EDの一節の 「一撃必殺♪うなってとぶが♪」 の部分だけはっきり覚えていてびっくりした (今の今まで空手バカ一代の曲(の一部)ということも忘れていたけど)。
【公式】空手バカ一代 ED「空手道おとこ道」│"KARATE MASTER" (1973) - YouTube
OP の「天下無敵の」というフレーズもなかなか。
(1) 【公式】空手バカ一代 OP「空手バカ一代」│"KARATE MASTER" (1973) - YouTube
- 山崎照朝・ロイヤルナイツ 空手道おとこ道 歌詞&動画視聴 - 歌ネット
- 大安蓮・パイオニア児童合唱団 空手バカ一代 歌詞 - 歌ネット
- 空手道おとこ道 - Wikipedia
- 空手バカ一代 (曲) - Wikipedia
IE11
EOL がはっきりしたわけですが、「IE限定」のあれやこれやがある 某社の社内システムどうすんですかね。
- Internet Explorer(IE)が来年6月16日にサポート終了、その日がくると起動せず - デザインってオモシロイ -MdN Design Interactive-
- IE11がついに2022年6月15日で終了へ 日本でのシェアは?:Windowsフロントライン(1/3 ページ) - ITmedia PC USER
- Microsoft、2022年6月15日でInternet Explorerのサポートを終了へ | TECH+
- IE終了に動揺広がる。「弊社のシステム、IEじゃないと正常に動かない」 | ハフポスト
Flash
それどころか実はちょっと前にこれもEOLになったFlashを使ったものもあるんだけど なんとこれを(以下検閲削除)
Java applet
はさすがにもう使ってなかったと思うんだけど、業務用PCにJavaのランタイム入れろってのがあったなあ。
なんだったっけあれ。
でもまあ入れたら入れたで色々「うるさい」ので、
Java(のランタイム)が必要だというそれを使うことはまずない(なくなった)から
数年前二年ほど前に「まるごと」アンインストールしてしまった(笑)>Java(というかJDKか)
二分探索
のコードを書く羽目になった。VBAで(謎)。
「二分探索のコードを『正しく』書けるプログラマー」は数少ないそうなのでちとガクブル。
ref
glob(そのn)
前回三つの関数
(makearg、locstack、endstak)のコードを貼り付けたわけなんですが、
その一つlokstak
を見直していてふと思ったこと。
v7unix/stak.c at ed636a47207476db76d53b7869447889dee3bbad ・ v7unix/v7unix
STKPTR locstak()
{ /* set up stack for local use
* should be followed by `endstak'
*/
IF brkend-stakbot<BRKINCR
THEN setbrk(brkincr);
IF brkincr < BRKMAX
THEN brkincr += 256;
FI
FI
return(stakbot);
}
ここで使っている setbrkなる関数は
v7unix/setbrk.c at ed636a47207476db76d53b7869447889dee3bbad · v7unix/v7unix
で定義されているもので、要は sbrk(2)を使って作業領域を広げているわけなんだけど、 「realloc(3)みたいなもん」で胡麻化しちゃってもOK?
setbrk(incr)
{
REG BYTPTR a=sbrk(incr);
brkend=a+incr;
return(a);
}
システムコールそのものの説明はともかく、その背景となる情報も…と思うと書くのが面ど(ry
エラーメッセージ
Rubyのハッシュでno implicit conversion of symbol into integerがでたがintegerでなく自分のミスだった件について - Qiita
すると以下のエラーが発生します。
no implicit conversion of symbol into integer
文字列にしろとでているので、subject[“math”[“sin”]]など確かめたが表示されませんでした。
このエラーメッセージのどこをどう読めば「文字列にしろ」という解釈がでてくるのかわからんのですが (誰か解説ぷりーず)
irb(main):004:0> :foo
=> :foo
irb(main):005:0> :foo[2]
=> "o"
irb(main):006:0> :foo[:bat]
Traceback (most recent call last):
5: from xxxxx/bin/irb.cmd:31:in `<main>'
4: from xxxxx/bin/irb.cmd:31:in `load'
3: from xxxxx/lib/ruby/gems/3.0.0/gems/irb-1.3.0/exe/irb:11:in `<top (required)>'
2: from (irb):6:in `<main>'
1: from (irb):6:in `[]'
TypeError (no implicit conversion of Symbol into Integer)
irb(main):007:0>
つまりはこういうことですよね。 (整数(と解釈できるなにか))を期待している場所に 整数に変換できないシンボルが来ているのでエラー。
たとえばエラーメッセージが日本語になっていたら、その辺読み取れたのだろうかと思ったり。
演算子
walrus operator とか elvis operator とか 世の中には一風変わった名前の演算子がありますが、Scala(Scalaz)にはこんなものがあるそうで。
Read Scalazによる関数型プログラミングへの道 | Leanpub
5.6.1 Apply
which is exactly what we used in Chapter 3:
(d.getBacklog |@| d.getAgents |@| m.getManaged |@| m.getAlive |@| m.getTime)
The |@| operator has many names. Some call it the Cartesian Product Syntax, others call it the Cinnamon Bun, the Admiral Ackbar or the Macaulay Culkin. We prefer to call it The Scream operator, after the Munch painting, because it is also the sound our CPU makes when it is parallelising All The Things.
知名度や使われ具合はそれほどでもないのかググってもほとんどみつからんけど。
脱線
うぃきぺの エルビス演算子 - Wikipedia のところに
GNU C/C++ (GCCによる拡張) では、三項演算子の第二項を省略することができる[4]。GCC 2.95.3より使用可能[5] (March 2001)。
とあるんだけど、2.95.3 よりもずっと前から使えていたと思うがなあ (そもそもversion 2系列の最後の最後じゃんねえ>2.95.3)。
Henry Spencer’s regex
そう言えば。
長いことアーセン・ベンゲルみたいな風貌だろうと(なぜか)思い込んでいました >Henry Spencer
Not only is the Internet dead, it’s starting to smell really bad.:2021年05月16日分
まったくやる気起きねぇというかHenry Spencer’s regexの古臭いマクロまみれのコード読んでるとSAN値が削られるのだ。
ここは「『古臭いマクロ』まみれのコード」なのか 「古臭い(マクロまみれの)コード」なのか ちょっと悩んだんですが、 それはさておき Henry Spencerのregexで使われているマクロは
regex/regcomp.c at master · garyhouston/regex
/*
* macros for use with parse structure
* BEWARE: these know that the parse structure is named `p' !!!
*/
#define PEEK() (*p->next)
#define PEEK2() (*(p->next+1))
#define MORE() (p->next < p->end)
#define MORE2() (p->next+1 < p->end)
#define SEE(c) (MORE() && PEEK() == (c))
#define SEETWO(a, b) (MORE() && MORE2() && PEEK() == (a) && PEEK2() == (b))
#define EAT(c) ((SEE(c)) ? (NEXT(), 1) : 0)
#define EATTWO(a, b) ((SEETWO(a, b)) ? (NEXT2(), 1) : 0)
#define NEXT() (p->next++)
#define NEXT2() (p->next += 2)
#define NEXTn(n) (p->next += (n))
#define GETNEXT() (*p->next++)
#define SETERROR(e) seterr(p, (e))
#define REQUIRE(co, e) ((co) || SETERROR(e))
#define MUSTSEE(c, e) (REQUIRE(MORE() && PEEK() == (c), e))
#define MUSTEAT(c, e) (REQUIRE(MORE() && GETNEXT() == (c), e))
#define MUSTNOTSEE(c, e) (REQUIRE(!MORE() || PEEK() != (c), e))
#define EMIT(op, sopnd) doemit(p, (sop)(op), (size_t)(sopnd))
#define INSERT(op, pos) doinsert(p, (sop)(op), HERE()-(pos)+1, pos)
#define AHEAD(pos) dofwd(p, pos, HERE()-(pos))
#define ASTERN(sop, pos) EMIT(sop, HERE()-pos)
#define HERE() (p->slen)
#define THERE() (p->slen - 1)
#define THERETHERE() (p->slen - 2)
#define DROP(n) (p->slen -= (n))
こういうやつっすね。
多少の違いはあるもののいくつかのLLのregex(のCソース)でも同じようなものを目にすることがあって、 影響は大きかったんだなあと思ったりするわけです。 特にPerlはHenry Spencerのregexを原型にしているとLarry Wallが書いてましたし。 とは言っても今(5.34.0)だとどのくらい面影が残っているんだろうか😄
でまあ、今でも大学の「ftpサイト」で配布してたりするんだろうかと思ったんですが、 世の流れに従い(?) githubに転載してる人がいました。
regex - Henry Spencer’s regular expression libraries
Henry Spencer wrote three different regular expression libraries. He originally distributed them via Usenet or FTP, but for convenience I have collected them here.
Firstly the “old library” or the “book library”. This was originally posted to the Usenet group mod.sources on 19 January 1986 and was updated for the book Software Solutions In C, ed. Dale Schumacher, Academic Press, 1994 [ref: Usenet]. This version was obtained from the ftp server at zoo.toronto.edu (now defunct). The man page is dated 5 September 1996 and original tar archive was dated 4 April 1998.
The library can be obtained from a github repository, or download regex.old-master.zip.
The second is the “BSD library”. This is a POSIX.2 compliant library that was included in 4.4BSD Unix. Spencer wrote that it was basically an alpha release, and pretty slow [ref: Usenet]. For more information on this library, see the README and COPYRIGHT files and the man pages regex(3) and regex(7). This version was also obtained from zoo.toronto.edu and is dated 10 August 1999.
The library can be obtained from a github repository, or download from the release archives. The alpha3.8 release is the code obtained from zoo.toronto.edu, with a subsequent releases with a bug fix.
There is also a modified version, with a CMake build system, also available in a github repository, or download from the release archives.
The third is the “Tcl library”, which was added to Tcl in 1999 (version 8.1) and supports wide-character Unicode. Although Spencer was working on packaging this library as a standalone distribution [ref: Usenet], as far as I know he never released it.
However, a couple of ports are available. Walter Waldo made a C++ library, which can be obtained from a github repository, or download hsrex-master.zip. Documentation is somewhat lacking for this library, but here’s a basic example for the ASCII version: hsrex-char.c. The Tcl library documentation may also be useful.
There’s also a Java port by Basis Technology Corporation available in github.
一瞬、あれ?「三種類」(Henry Spencer wrote three different regular expression libraries) ? と思ったけど、 そういやそうだった(二つ目の POSIX.2 compliant library that was included in 4.4BSD Unix を忘れていた)。 にしても、結局「alpha」で放置されたのかコレ。
三つ目 (The third is the “Tcl library”, which was added to Tcl in 1999) もなかなか面白くて、 最初の二つとは別の意味でSAN値を、いやHPか?を削られるようなものだったり。 しかしこれももう20年以上前のものかあ(ひー)。
regex では別系統でglibcのregex(それ以前に配布されていた regex や rxではなく)の 話も書いておきたい気もするけどめn(ry
そう言えばそう言えば
bm の話も興味深く読んでいるのですが [オレオレN6] わからない俺は雰囲気でregex(3)のコードを弄っている(その6) で紹介されていた CiNii 論文 - 文字の出現頻度を考慮した文字列検索アルゴリズムの提案 で学生時代にお世話になった先生のお名前を見つけてびっくり。 当時を思い返すと色々もったいなかったなあ としばし遠い目に(いやまあ実際に話を伺ってもかけらも理解が及ばなかったけどさ)。
で、やっぱり
暦の話は闇が深かった(解説ありがとうございます)。
(そう言えば)^3
Firefox のftpサポートがもうすぐなくなるという話を聞いても ああそうなのかくらいにしか思ってなかったのだけど、 今日書いた分のあれやこれやを調べたときに 必要な情報(というかソースコードというか)が ftpサイトにしかなかったり(多分)して、 実際なくなるとそれなりに困ることになるかもしれない。 個人的に。
先行詞は直前にあるとは限らない
しかし、後方互換性のない言語でも小さな仕様変更を加えることができると、都合が良い場合もあります。 もっとも分かりやすいのは、新しいキーワードを導入すると、おなじ名前の変数が無効になるという例です。 例えば、Rust言語の最初のバージョンにはasync と await というキーワードはありませんでした。 後のバージョンで、突然これらの単語をキーワードに仕様変更すると、let async = 1;のようなコードが壊れてしまいます。
なんかひっかかるパラグラフだなあと思って(例によって例のごとく)原文にあたりましたならば
The Plan for the Rust 2021 Edition | Rust Blog
There are times, however, when it is useful to be able to make small changes to the language that are not backwards compatible. The most obvious example is introducing a new keyword, which would invalidate variables with the same name. For example, the first version of Rust did not have the async and await keywords. Suddenly changing those words to keywords in a later version would’ve broken code like let async = 1;.
that 以下はその直前の language を説明してんじゃなくて その前の small changes っすね (そもそもlanguageは単数形で、「are」って複数形を受けてんじゃ)。
not backwards compatible な small changes を the language (Rust)に加えられる(行える)のが usefulなときも(一回ならず)あると。
わざわざ(?) small と書いているのはまあそういうことなんでしょう。
これはわからん
Scala 3には多くの変更が組み込まれており、Dottyに基づいている。新しいコンパイラは、Document Object Types (DOT) の内部データ構造を使用する。
Road to Scala 3: Release Candidate Available
Scala 3 incorporates many changes and is based on Dotty, a new compiler using the internal data structures of Document Object Types (DOT). Scala 3 is a backward binary compatible version with Scala 2.13.
DOT のところにあるリンク先のPDF http://lampwww.epfl.ch/~amin/dot/fool.pdf までみると、この DOTは Document Object Types の頭字語ではなく、 Dependent Object Types の頭字語だということがわかる(つまり原文から埋め込まれていたミス)
Dependent Object Types
Towards a foundation for Scala’s type system
We propose a new type-theoretic foundation of Scala and languageslike it: the Dependent Object Types (DOT) calculus.
ということをみずしまさんが指摘していたのだけどそのツイートを削除してるな。 なんでだろう (指摘を受けて元記事が修正されたようでもないし)。
接点がまるでなかった有名人であっても、 同い年であったり同年代の方の「急逝」の知らせを見ると心が穏やかではなくなるというか 寂寥感に襲われるというか。