ときどきの雑記帖 RE* (新南口)
Escape from L.A.
今回の一件(ってなんですか)が
よほど琴線逆鱗に触れたんでしょうか
怒涛の連続5日書き込み…
Not only is the Internet dead, it’s starting to smell really bad.:2022年01月分
SugarSync
何年使っていたかわからないけどついに(ようやく)解約。 解約しようとしたらそれまでは見ることもできなかった 割安プランを提示してきて、 逆にそれで踏ん切りがついた😄
NHK BS のウルトラセブン
後番組はなんになるんですかね。
今週のしずえさん
2月の日数がほかの月より短いのはなぜ?
named after presidents
異形の軍艦「リンドン・B・ジョンソン」ズムウォルト級の最終艦いよいよ就役へ | 乗りものニュース
艦名の由来はアメリカの第36代大統領リンドン・ジョンソンで、海軍によると、アメリカ大統領の名を冠した軍艦としては34隻目になるといいます。
歴代アメリカ合衆国大統領の一覧 - Wikipedia 空母に使われている人はわかるけど あとはよくわからん(カーター(第39代)が原潜に使われているらしい ジミー・カーター (原子力潜水艦) - Wikipedia )。ということで アメリカ海軍艦艇一覧 - Wikipedia から探してみた(ヒマだねえ)
- フランクリン・D・ルーズベルト (空母) - Wikipedia
- ジョン・F・ケネディ (空母・初代) - Wikipedia
- ドワイト・D・アイゼンハワー (空母) - Wikipedia
- セオドア・ルーズベルト (空母) - Wikipedia
- エイブラハム・リンカーン (空母) - Wikipedia
- ジョージ・ワシントン (空母) - Wikipedia
- ハリー・S・トルーマン (空母) - Wikipedia
- ロナルド・レーガン (空母) - Wikipedia
- ジョージ・H・W・ブッシュ (空母) - Wikipedia
- ジェラルド・R・フォード (空母) - Wikipedia
- ジミー・カーター (原子力潜水艦) - Wikipedia
空母(と潜水艦1隻)だけだとこんなもんか。で他にはどんなのが と思ったら原潜(戦略型)に結構使われていた(空母と重複している (もちろん同時には使われていない)ものもあり)。
- ジョージ・ワシントン (原子力潜水艦) - Wikipedia
- セオドア・ルーズベルト (原子力潜水艦) - Wikipedia
- エイブラハム・リンカーン (原子力潜水艦) - Wikipedia
- トーマス・ジェファーソン (原子力潜水艦) - Wikipedia
- アンドリュー・ジャクソン (原子力潜水艦) - Wikipedia
- ジョン・アダムズ (原子力潜水艦) - Wikipedia
- ジェームズ・モンロー (原子力潜水艦) - Wikipedia
- ウッドロウ・ウィルソン (原子力潜水艦) - Wikipedia
- ジェームズ・マディソン (原子力潜水艦) - Wikipedia
- ユリシーズ・S・グラント (原子力潜水艦) - Wikipedia
- ジェームズ・K・ポーク (原子力潜水艦) - Wikipedia
まだ足りないけどここからどうしたものかと思ったが さすがうぃきぺ。探してみたらこんな項目もあった。
List of U.S. military vessels named after presidents - Wikipedia
数は確かめない(笑)
mysterious %
なるほどと思いつつもなんでマニュアル参照しないんですかねと思ったり (実際にはしているのかもしれないけど記事中には出てこない)。
PROMPT_EOL_MARK
When the PROMPT_CR and PROMPT_SP options are set, the PROMPT_EOL_MARK parameter can be used to customize how the end of partial lines are shown. This parameter undergoes prompt expansion, with the PROMPT_PERCENT option set. If not set, the default behavior is equivalent to the value ‘%B%S%#%s%b’.
PROMPT_CR オプションと PROMPT_SP オプションがセットされていたときに、 partial linesの末尾をどのように表示するかカスタイマイズするのにPROMPT_EOL_MARKを使用できます。 このパラメーターはPROMPT_PERCENTオプションがセットされている場合は prompt expansionをundergoesします。 PROMPT_PERCENTオプションがセットされていない デフォルトでの動作は‘%B%S%#%s%b’がセットされている 場合と等価なものです。
16.2.8 Prompting
PROMPT_BANG <K>
If set, ‘!’ is treated specially in prompt expansion. See Prompt Expansion.
セットされていた場合、’!‘をprompt expansionで特別扱いします。 Prompt Expansion を参照してください。
PROMPT_CR (+V) <D>
Print a carriage return just before printing a prompt in the line editor. This is on by default as multi-line editing is only possible if the editor knows where the start of the line appears.
ラインエディター中のプロンプトを印字する直前にキャリッジリターンを印字します。 表示される行の先頭がどこなのかをエディターが知っているときにのみ複数行編集が可能なので このオプションはデフォルトでオンになっています。
PROMPT_SP <D>
Attempt to preserve a partial line (i.e. a line that did not end with a newline) that would otherwise be covered up by the command prompt due to the PROMPT_CR option. This works by outputting some cursor-control characters, including a series of spaces, that should make the terminal wrap to the next line when a partial line is present (note that this is only successful if your terminal has automatic margins, which is typical).
PROMPT_CRオプションの影響でコマンドプロンプトによって covered up されてしまうpartial line (つまり末尾が改行でない行) をpreserveしようと試みます。 これは、partial lineが発生したときに次の行へterminalをwrapさせる いくつかの制御文字(これには空白の並びも含みます)を出力することで行われます (note that this is only successful if your terminal has automatic margins, which is typical)。
When a partial line is preserved, by default you will see an inverse+bold character at the end of the partial line: a ‘%’ for a normal user or a ‘#’ for root. If set, the shell parameter PROMPT_EOL_MARK can be used to customize how the end of partial lines are shown.
partial lineがpreserveされたとき、デフォルトではそのpartial lineの末尾に 通常のユーザーであれば’%‘が、rootであれば’#‘が 反転かつボールドされて表示されます。このオプションがセットされていた場合、 PROMPT_EOL_MARKを使ってpartial linesの末尾をどのように表示するかカスタマイズできます。
NOTE: if the PROMPT_CR option is not set, enabling this option will have no effect. This option is on by default.
注意: PROMPT_CRオプションがセットされていなかった場合、 このオプションを有効にしても何の効果もありません。 このオプションはデフォルトで有効になっています。
PROMPT_PERCENT <C> <Z>
If set, ‘%’ is treated specially in prompt expansion. See Prompt Expansion.
セットされていた場合、’%‘をprompt expansionで特別扱いします。 Prompt Expansion を参照してください。
PROMPT_SUBST <K> <S>
If set, parameter expansion, command substitution and arithmetic expansion are performed in prompts. Substitutions within prompts do not affect the command status.
セットされている場合、プロンプトで parameter expansion、command substitution、arithmetic expansion が行われます。プロンプト中での置換(Substitutions)はコマンドのステータスには 影響しません。
TRANSIENT_RPROMPT
Remove any right prompt from display when accepting a command line. This may be useful with terminals with other cut/paste methods.
f-string
のコメントをみて初めて気がついた(知った)のだけど
r""
やf""
の
前にくっついている文字(なんか呼び名あったっけ?)って
複数並べられたのね。
# × m = re.findall(r'({regex})', text) # 〇 m = re.findall(rf'({regex})', text)
- Pythonの文字列を拡張するf,r,b,uについて. pythonでは文字列の先頭にf, r… | by Kai | LSC PSD | Medium
- Pythonのf文字列(フォーマット済み文字列リテラル)の使い方 | note.nkmk.me
公式ドキュメントによれば組み合わせ可能なものは以下の通り。
2. 字句解析 — Python 3.10.0b2 ドキュメント
文字列リテラルは以下の字句定義で記述されます:
stringliteral ::= [stringprefix](shortstring | longstring) stringprefix ::= "r" | "u" | "R" | "U" | "f" | "F" | "fr" | "Fr" | "fR" | "FR" | "rf" | "rF" | "Rf" | "RF" shortstring ::= "'" shortstringitem* "'" | '"' shortstringitem* '"' longstring ::= "'''" longstringitem* "'''" | '"""' longstringitem* '"""' shortstringitem ::= shortstringchar | stringescapeseq longstringitem ::= longstringchar | stringescapeseq shortstringchar ::= <any source character except "\" or newline or the quote> longstringchar ::= <any source character except "\"> stringescapeseq ::= "\" <any source character> bytesliteral ::= bytesprefix(shortbytes | longbytes) bytesprefix ::= "b" | "B" | "br" | "Br" | "bR" | "BR" | "rb" | "rB" | "Rb" | "RB" shortbytes ::= "'" shortbytesitem* "'" | '"' shortbytesitem* '"' longbytes ::= "'''" longbytesitem* "'''" | '"""' longbytesitem* '"""' shortbytesitem ::= shortbyteschar | bytesescapeseq longbytesitem ::= longbyteschar | bytesescapeseq shortbyteschar ::= <any ASCII character except "\" or newline or the quote> longbyteschar ::= <any ASCII character except "\"> bytesescapeseq ::= "\" <any ASCII character>
ところで
import re regex = r'[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?' text = '22 10.08 .52667 2.96996e-05 .57E+05' m = re.findall(r'({regex})', text) print([t[0] for t in m]) #=> ['22', '10.08', '.52667', '2.96996e-05', '.57E+05']
という例があげられているんだけど、この正規表現だと 55. みたいな小数点で終わる数を(小数点のついた数として)受理しないけど それでいいんだろうか?
$ python
Python 3.10.0 (tags/v3.10.0:b494f59, Oct 4 2021, 19:00:18) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> regex = r'[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?'
>>> text = '22 10.08 .52667 2.96996e-05 .57E+05'
>>> m = re.findall(f'({regex})', text)
>>> print([t[0] for t in m])
['22', '10.08', '.52667', '2.96996e-05', '.57E+05']
>>> text = '3.14 0.25 .77 55.'
>>> m = re.findall(f'({regex})', text)
>>> print([t[0] for t in m])
['3.14', '0.25', '.77', '55']
.77と同様にvalidな表記だと思うんだけど
(55
でも値としては等しいっちゃっ等しいけど)。
B
pdp7-unix/b.b at master - DoctorWkt/pdp7-unix · GitHub に、Bのコンパイラーらしきものがあって。
/* b.b - B compiler for PDP-7 Unix
Coding style and organization based on lastc1120c.c
(C) 2016 Robert Swierczek, GPL3
To compile the compiler with b.c:
gcc -Wno-multichar b.c -o b
./b b.b b.s
perl as7 --out b.out bl.s b.s bi.s
To compile hello.b:
perl a7out b.out hello.b hello.s
perl as7 --out h.out bl.s hello.s bi.s
perl a7out h.out
To compile the compiler with itself:
perl a7out b.out b.b b2.s
perl as7 --out b2.out bl.s b2.s bi.s
*/
main() {
extrn symtab, eof, ns;
while (!eof) {
ns = symtab + 51;
extdef();
blkend();
}
}
...
jumpc(n) {
write('f '); /* ifop */
write('1f');
write('+');
number(n);
write('*n');
}
jump(n) {
write('x ');
write('1f');
write('+');
number(n);
gen('*nn',6); /* goto */
}
label(n) {
write('l');
number(n);
write('=.');
write('*n');
}
そして「インタープリター」がこれ? pdp7-unix/src/cmd at master · DoctorWkt/pdp7-unix · GitHub
んで、その中身を見ると確かにうぃきぺに書かれている 「スレッデッドコード」なものに見える。
"** 06-5-12.pdf page 12
" bi
start:
jms initio
-1
tad .main
dac pc
fetch:
lac pc i
lmq
and o17777
dac addr
cla; lls 4 " XXX replaced for now: ecla lls 4
tad .+3
dac .+1
jmp .. i
jmp . i
autop; binop; consop; ifop; etcop; setop; traop
unaop; extop; aryop
ifop:
-2
tad sp
dac sp
lac sp i
dac t1
lac t1 i
sza
jmp fetch
-1
tad addr i
dac pc
jmp fetch
autop:
lac addr
tad dp
dac sp i
isz sp
isz sp
jmp fetch
fetch
からの数行がいわゆる「内部インタープリター」なのだろうけど
tad .+3
dac .+1
jmp .. i
jmp . i
と、二つ並んだジャンプ命令の、
後者の.
(の意味)はわかるのだけど前者がわからん。..
ってなに?
- B (programming language) - Wikipedia
- Index of /pdf/dec/pdp7
- Unixの歴史を再現したリポジトリを読む① - Qiita
- Unixの歴史を再現したリポジトリを読む② - Qiita
- Unixの歴史を再現したリポジトリを読む③ - Qiita
- Unixの歴史を再現したリポジトリを読む④ - Qiita
- Unixの歴史を再現したリポジトリを読む⑤ - Qiita
- PDP-7時代のUNIXファイルシステム - Programmer’s Note
- UNIXの歴史 再検証 — Part1
- UNIX初期の歴史再検証 — Part2
- UNIX初期の歴史再検証 — Part3
- UNIX初期の歴史再検証 — Part4
- UNIX初期の歴史再検証 — Part5
- DoctorWkt/pdp7-unix: A project to resurrect Unix on the PDP-7 from a scan of the original assembly code
- GitHub - DoctorWkt/pdp7-unix: A project to resurrect Unix on the PDP-7 from a scan of the original assembly code
- pdp7-unix/b.b at master - DoctorWkt/pdp7-unix ・ GitHub
銀河の歴史がまた一ページ
宇宙暦799年1月30日 銀河帝国遠征軍の全軍が、自由惑星同盟領のポレヴィト星域に集結した。#本伝5巻 #神々の黄昏戦役
— 今日は何の日@銀英伝bot (@logh_today) January 29, 2022
宇宙暦799年2月1日 JL77基地からの最後の情報が届き、統合作戦本部と宇宙艦隊司令部の合同会議がおこなわれた。#本伝5巻 #神々の黄昏戦役
— 今日は何の日@銀英伝bot (@logh_today) January 31, 2022
宇宙暦799年2月3日 スーン・スールズカリッター少佐がビュコック元帥の副官に任命された。#本伝5巻 #神々の黄昏戦役 #ランテマリオ星域会戦
— 今日は何の日@銀英伝bot (@logh_today) February 2, 2022
宇宙暦799年2月4日 自由惑星同盟軍宇宙艦隊がバーラト星系を進発した。#本伝5巻 #神々の黄昏戦役 #ランテマリオ星域会戦
— 今日は何の日@銀英伝bot (@logh_today) February 3, 2022