i have code few hundred lines. many small pieces of have following structure:
let soa = election |> series.observations printfn "%a" <| soa
frequently 2 things happen:
1) mysteriously last line changed to:
printfn "%a" <|
so code above , follows becomes
let soa = election |> series.observations printfn "%a" <| let sls = election |> series.sample (seq ["party a"; "party r"]) printfn "%a" <| sls
this happens hundreds of lines above editing file in editor.
2) when happens f# interactive
not flag error. no error messages generated. however, if try access sls
message:
error fs0039: value or constructor 'sls' not defined.
any ideas on why bit of code erased in editor? (this happens quite frequently)
and why doesn't f# interactive
issue error message?
the second let
block interpreted argument preceding printfn
, because pipe, being operator, provides exception offset rule: second argument of operator not have indented farther first argument. , since second let
block not @ top level, rather part of printfn
's argument, definitions don't become accessible outside.
let's try experimentation:
let f x = x+1 // normal application f 5 // complex expression argument f (5+6) // let-expression argument f (let x = 5 in x + 6) // replacing `in` newline f ( let x = 5 x + 6 ) // replacing parentheses pipe f <| let x = 5 x + 6 // operators (of pipe one) have exception offset rule. // done support flows this: [1;2;3] |> list.map ((+) 1) |> list.toarray // applying exception `f` + `let` expression: f <| let x = 5 x + 6
Comments
Post a Comment