要求UAC我有一個腳本: open System
open System.IO
let fileSize path =
try
Some((new FileInfo(path)).Length)
with
| e ->
printfn "%A" e
None
let dirSize dir =
Directory
這個簡單的功能 let s =
function
| [] -> [[]]
| list -> []::list
具有類型( '一個列表列表 - >' 列表列表)。因此,由於'a是泛型的,它接受任意深度的列表作爲參數。我的問題是,我總是需要指定輸入列表的深度,否則F#交互會抱怨。例如 s []
將無法正常工作,而 s ([]: int List List)
我試圖展開James Hugard's後How do I plot a data series in F#?,並且在使用可變數量的函數參數時遇到了一個小故障。如果我專門命名出去Hugard的LineChartForm的功能,如在這個例子中,代碼工作正常時加載到F#交互式解釋: (* This code is based off of a Stack Overflow post by
Ja
let rec merge = function
| ([], ys) -> ys
| (xs, []) -> xs
| (x::xs, y::ys) -> if x < y then x :: merge (xs, y::ys)
else y :: merge (x::xs, ys)
let rec split = function
| [] -> ([], [])
應用我有()從按鈕派生的按鈕類 與位置屬性 namespace fgame15
open System
open System.Windows.Forms
open System.Drawing
module Game15Button =
type Game15Button(position:Point) as button =
inherit Button()
我一直在嘗試編寫一個使用u =(u1,u2,...,un)和v =(v1,v2,..., vn)並輸出u1 * v1 + u2 * v2 + ... + un * vn。我覺得我有邏輯大多正確的(至少它會在其他語言...),但我不斷收到: stdin(11,57): error FS0001: This expression was expected to have type
'a list
使用Visual Studio 2015 Update 3及fsi.exe我試圖運行此腳本: //error.fsx
#if INTERACTIVE
let msg = "Interactive"
#else
let msg = "Not Interactive"
#endif
let add x y =
x + y
printfn "%d" (add