ときどきの雑記帖 RE* (新南口)
がんばれ森川君2号
Open The Kimono
へー。
Open The Kimono – Spinach Forest
NetWare
懐かしい。会社で一時期NetWareサーバーの面倒見ていた。 4.0だか5.0の辺りで偉く面倒になった記憶がある。
An Overview of the NetWare Operating System (1994) [pdf] | Hacker News
re
【知っておきたい接頭語】“re”の意味や使い方を例文付きで徹底解説| Kimini英会話
428
「しぶや」ではなく「よつや」と読んでしまう。
MID$
つづき。
september 1978の BASIC-PLUS-2 RSX-11M/lAS User’s Guide によると、
- MID 関数 あり
- MID statement なし
october 1979の TOPS-20 BASIC-PLUS-2 Language Manual でも
- MID 関数 あり
- MID statement なし
ということなので、MID statement、つまり左辺にMID$関数を置く書き方は DEC由来ではないのかもしれない(79年のcopyrightがついているN-BASICに MID# statementがあるから)。
DECによるものでも 時代をぐっと下った https://vmssoftware.com/docs/VSI_BASIC_USER.pdf には
11.5.4. MID$ Assignment Statement
You can replace a portion of a string with another string using the MID$ assignment statement. You specify a starting character position that indicates where to begin the substitution. If you specify a starting character position that is less than 1, VSI BASIC for OpenVMS assumes a starting character position of 1. In addition, you can optionally specify the number of characters to substitute from the source string expression. If you do not specify the number of characters to substitute, VSI BASIC for OpenVMS attempts to insert the entire source expression. However, the MID$ statement never changes the length of the target string variable; therefore, the entire source expression might not fit into the available space
という記述がある。
そしてMID関数自体の起源についても BASIC-PLUS - Wikipedia を見ると
Influenced by
Dartmouth BASIC, Tymshare SUPER BASIC
Influenced Microsoft BASIC
という記述があり、そのTymshare SUPER BASICのページを見ると
SUPER BASIC also greatly improved string handling over the rudimentary system in Dartmouth, introducing the LEFT, MID and RIGHT string functions, simple string concatenation and other features. These were later used in DEC’s BASIC-PLUS, which was later used as the basis for the original Microsoft BASIC that saw widespread use in the 1980s.
とあるのでDECのものではなくこちらが起源なのかもしれない。
ただ、このSUPAR BASICのマニュアル https://archive.org/details/bitsavers_tymshareSDSuperBasicReferenceManualVer3Feb78_12921584/page/n45/mode/2up を見ると(p.36)
- LEFT
- RIGHT
- SUBSTR
と名前が微妙に違う。
どういうこと?とうぃきぺを見なおしてみると
String operators and functions
SUPER BASIC included operators for = for comparison and + for concatenation. It included the following functions:[31]
という記述の後に
ASC(S), returns the ASCII number for the first character in the string CHAR(N), returns a string with a single ASCII character, same as MS CHR() COMP(A,B), compares two strings, returns -1,0,1 depending on which is “bigger” INDEX(A,B), returns the index of B within A. Optional 3rd parameter is an offset starting point LENGTH(A), length of the string SPACE(X), returns a string consisting of X number of spaces VAL(A), looks through the string for a number and returns it STR(N), converts a number into a string LEFT, as in MS RIGHT SUBSTR, as MS’s MID
というものが。ふむ。
機能としてはここから伝播したけど、名前は変わって導入されたということなんだろうか? SUBSTRだと6文字だから長いと思ったとか?
いずれにしても、代入可能な MID Statementのようなものは見当たらないので、 これは本当にMSのBASICで最初に導入されたのかも知れない (要検証)。
change
さて、もう一方(?)の系統のBASICでは (LEFT、RIGHT、MIDのような)関数を導入するのではなく 部分文字列にアクセスするための記法を導入している。
http://www.bitsavers.org/pdf/phaseOneSystems/oasis/BASIC_Language_Reference_Manual_2ed.pdf
p.104(112枚目)の 9.22 LET Statementに
- [LET] <numeric variable> = <numeric expression>
- [LET] <string variable> = <string expression>
- [LET] <string variable><substring> = <string expression>
- [LET] <user derifined function> = <expression>
- [LET] ERR = <numeric expression>
Where:
<substring> ::= [<numeric expression>:<numeric expression>]
Purpose:
The LET statement assigns a value to a variable.
Comment:
This is the only statement where the statement verb (LET) is not required for proper syntax.
For all of the forms of the LET statement the expression is evaluated and assigned to the element on the left of the first equal sign (may be more, than one equal sign because of relational expressions). The previous contents of the element are lost but only after the· expression has been evaluated. Therefore, the variable may be an element in the expression.
Formats 1 and 2 of the LET statement are the standard forms of the assignment statement used by all BASIC implementations. The type of the expression (string or arithmetic) must match the type of the variable on the left side of the assignment operator.
The third format string variables of the LET statement provides a powerful method of modifying string variable by means of the substring operator. The general form of this substring is:
<string varlable>[<from>:<to>]
Replacement When <from> is less than or equal to <to> a character replacement is performed on the variable from column <from> to column <to>. The string expression on the right side of the assignment operator will be padded with spaces or truncated to a length of <to> minus <from> plus one.
Deletion When <from> is greater ·than <to> a character deletion is performed on the string variable. The contents of the variable on the left side of the assignment operator is first modified by deleting the characters from, but not including, column <to> through column <from>. The string expression on the right side of the assignment operator is then inserted into the variable after the <to> column. .
Insertion When the <from> is zero the string expression on the right side of the ~ssignment operator is inserted after the <to> character position.
These rules and operations are best explained by example:
Assume that A$ contains ABCDEFGHIJ
A$[4:6] = “123” ABC123GHIJ A$[6:4] = "" ABCDGHIJ A$[6:4] = “01234” ABCD01234GHIJ A$[0:6] = “0123” ABCDEF0123GHIJ A$[0:0] = “0123456” 0123456ABCDEFGHIJ
このBASIC、あまり見ないような構文要素(予約語)がいくつかあって、 たとえば関数定義の終端を示すこれ
9.14 FNEND Statement
Example: Explanation: 0010 DEF FNTEST(A) Start of function definition 0020 FNTEST=PI*A*A 0030 FNEND End of function definition 0040 DEF FNCENTER$(STRING$,LENGTH) Start of function definition 0050 IF LENGTH=O THEN FNCENTER$="" GOTO 110 0060 IF LEN(STRING$)=O THEN FNCENTER$ = SPACE$(LENGTH) GOTO 110 0070 FILL·= LENGTH-LEN(STRING$) 0080 IF MOD(FILL,2)=0 0090 THEN FACENTER$ = SPACE$(FILL/2)&STRING$&SPACE$(FILL/2) 0100 ELSE FNCENTER$ ~ SPACE$(FILL/2)&STRING$&SPACE$(FILL/2+1) 0110 IFEND 0120 FNEND End of function definition
DEF FN
と同じ行に=
があると
他のBASICでも見るような関数定義になるらしい。
もうひとつIF文に関して
9.19 IF
1 IF <expression> THEN <then clause> ELSE <else clause> 2 IF <expression> THEN <then clause> 3 IF <expression>
この、三番目の表記に関して
Format 3 of the IF statement provides for complex, multi-line IF statements, where the other lines contain THEN and/or ELSE statements. This ·multi-line structure is terminated by the IFEND statement.
と、IFEND
という予約語がくるまでが
IFのブロックになる(ENDIF
じゃないんですな)。
9.20 IFEND
Examples: Explanation: 0010 IF A Test A for non zero 0020 THEN GOSUB 2000 Perform if A<>O 0030 PRINT USING "###",A " " " 0040 GOTO TOP.OF.PAGE " " " 0050 IFEND End of 'oonditional exeoution 0010 IF VALUE > CONTROL Test expression 0020 THEN IF VALUE > LIMIT Perform if expr is true 0030 THEN GOSUB ERROR Perform if both expr are true 0040 GOTO EXIT " " " " " " 0050 ELSE IF ERR.NUM < ERR.LIMIT THEN QUIT Perform only if first expr is true . and seoond expr is false 0060 IFEND End conditional exeoution from seoond expr 0070 IFEND End of oonditional exeoutio
FORTRAN 77だとTHEN
があるとBLOCK IFになるから、
それとは逆になっていて面白い。
まあ、元のBASICでTHENをすでに使っていたせいもあるのだろうけど。
operator precedence
MIDの件で色々さがしていたときに http://www.bitsavers.org/pdf/phaseOneSystems/oasis/BASIC_Language_Reference_Manual_2ed.pdf のp.26(34枚目)
5.5.5 Expression evaluation
に演算子の優先順位の表を発見。 それによれば
Operator | Hierarchy |
---|---|
() | 0 |
^ | 1 |
Ifunctions | 2 |
substring | 2 |
+ unary | 3 |
- unary· | 3 |
• | 4 |
/ | 4 |
+ | 5 |
- | 5 |
& | 5 |
> | 6 |
>= | 6 |
< | 6 |
<= | 6 |
= | 6 |
<> | 6 |
NOT | 7 |
AND | 8 |
OR | 9 |
XOR | 10 |
EQV | 11 |
IMP | 12 |
単項のマイナスよりもべき乗の方が優先順位が上。
そしてこれは 今回の件とは別に見つけていたものだけど ALGOL 60のもの。
The Dijkstra-Zonneveld ALGOL 60 Compiler for the Electrologica X1
p.57
5.9 The transformation of expressions
( | 0 |
:= | 2 |
≡ | 3 |
⇒ | 4 |
∨ | 5 |
∧ | 6 |
¬ | 7 |
<≦=≧>≠ | 8 |
+. (binary)- | 9 |
(unary)-, *,/,_: | 10 |
↑ | 11 |
演算子の記号がよく見るものとは違うけど こちらも単項マイナスよりもべき乗演算子の方が 優先順位が上。
FORTRAN Compiler on IBM 704
*level analysis main start
LA0000 LXA L(0),A 4F13749 0
CLA E+2 4F13750 1
SLT 2 IS THIS A FUNCTION NAME 4F13751 2
TRA LA0000+36 NO 4F13752 3
SLN 2 YES - TURN F LITE BACK ON 4F13753 4
LXD BK,C IS FORSUB EMPTY 4F13754 5
TXL LA0000+13,C,0 YES. GO SET FS BITS TO 0 4F13755 6
SXD LA0000+12,C 4F13756 7
*+8
CAS FORSUB,A SEARCH FN NAME IN FORSUB 4F13757 8
TXI LA0000+12,A,-2 4F13758 9
TRA LA0000+15 4F13759 10
TXI LA0000+12,A,-2 4F13760 11
*+12
TXH LA0000+8,A,0 4F13761 12
*+13
STZ FSBITS SET FSBITS TO 0 4F13762 13
TRA LA0000+25 4F13763 14
*+15
CAL FORSUB+1,A FN NAME IN FORSUB 4F13764 15
ANA MASK2 EXTRACT TYPE NUMBER 4F13765 16
FORSUBは2ワードで1エントリが構成されるテーブルで、 エントリの最初のワードには関数(サブルーチン)名が 格納されている。 そして2ワード目には型などの情報がある。
TXH LA0000+8,A,0
のdecrement partは
SXD LA0000+12,C
によって実行時に書き換えられる
(その元の値は2行前のLXD BK,C
で取り出したもの)。
エントリ一つが2ワードなので、
インデックスレジスターの操作は
TXI LA0000+12,A,-2
のようにする
(704の特性により、操作の意味合い的には「2を加える」なのだけど
インデックスレジスターに対しては「2減らす」となる)。
ガニメデ
ガニメデに探査機が行くらしいし2500万年前の超光速宇宙船が発見される日も近いな
— mod_poppo (@mod_poppo) April 14, 2023
クロネコヤマト
AIが考える「クロネコヤマト」 pic.twitter.com/x1RNvD0uj6
— ツノウサ (@hajime2e) April 23, 2023
江ノ電
(鉄郎。えのでん好きは…本当のえのでん好きはあんまりえのでんに乗らないわ…線路沿いを歩くのよ…乗ってしまうとえのでんが見えないので… とりあえず江ノ島駅から長谷駅まで歩いてみて…良さがわかるわ…)
— メーテル (@_maeter) April 24, 2023
また134号沿いを歩きたいわねえ…
(元)CITIBANK
CITIBANK の頃からつこてる SMBC信託銀行、なにやらサービス改訂云々のお知らせ来てて『ん?変わらんだろ?』と全無視してたけど、今日物理メールが来て変更の実態を漸く理解した…
— 眼力 玉壱號 (@objectxplosive) April 24, 2023
わたしも元CITIBANKのSMBC信託銀行の口座を持っているのだけど なんか来ていたかな?😓
額はそれほどでもないけど米ドルでもいくらか 口座にあるから条件が違うかも。
いずれにしても解約してもいいかもなあ。