統計解析R たぶんpart3くらい (587レス)
統計解析R たぶんpart3くらい http://mevius.5ch.net/test/read.cgi/tech/1340339592/
上
下
前
次
1-
新
通常表示
512バイト分割
レス栞
466: デフォルトの名無しさん [] 2023/02/16(木) 19:25:35.83 ID:76X7tEQ5 こうした言葉を思いつくのは才能なんだろうね。 Rだと簡単にハイゼンバグの例を作れた。 ``` {r a_10850, dependson = ""} uncertainly = with (new.env (), { plus = \(x) \(y) x + y x = 1L plus_1 = plus (x) x = 1000L plus_1 (2) |> print () }); ``` アレレ?ということでデバッグ文を入れてみる。 ``` {r a_29042, dependson = ""} principle = with (new.env (), { plus_debug = \(x) { cat ("Schr?dinger says ", x, "\n", sep = "") \(y) x + y } x = 1L plus_1 = plus_debug (x) x = 1000L plus_1 (2) |> print () }); ``` デバッグ文の有無で挙動が変わる。`uncertainly`の挙動は、バグではなく、 言語仕様だと思った方が良いと思う。 `uncertainly`の挙動を防ぐには関数`force`を使えば良い。 * [How to not fall into R's 'lazy evaluation trap](https://stackoverflow.com/questions/29084193) http://mevius.5ch.net/test/read.cgi/tech/1340339592/466
メモ帳
(0/65535文字)
上
下
前
次
1-
新
書
関
写
板
覧
索
設
栞
歴
あと 121 レスあります
スレ情報
赤レス抽出
画像レス抽出
歴の未読スレ
AAサムネイル
Google検索
Wikipedia
ぬこの手
ぬこTOP
0.019s