【发布时间】:2016-04-15 01:21:05
【问题描述】:
我一直在 Win8.1 上使用 VS2015 在 F# 中开发,但我最近购买了 iMAC 并为 MacOS X elCapitan 10.11.3 安装了 Xamarin Studio 6.0
有一些代码可以在 VS2015 上正常编译,我正在尝试在 iMAC 上编译它。
Array.tail 确实在 F# 交互中工作,但是 我对 Array.tail 有一个编译错误
Projects/MyAlgos/MyAlgos/Program.fs(25,25):错误 FS0039:未定义值、构造函数、命名空间或类型“tail” (FS0039) (MyAlgos)
在 Xamarin 的解决方案资源管理器面板中,我将 Target Framework 设置为 .NET Framework 4.5.2,(就像在 VS2015 中设置的一样)
//////// Travelling Salesman problem ////////
open System
open System.Collections
open System.Collections.Generic
open System.IO
open System.Windows
open FSharp.Charting
//open MyLibrary
//open MyLibrary.MyUsefulFunctions
//open MyLibrary.MyCollections
exception InnerError of string
let stopWatch = System.Diagnostics.Stopwatch.StartNew()
///////////////// preparing the data /////////////////
// format of the files
//[number_of_cities]
//[x_1] [y_1] // coordinate
let x = File.ReadAllLines "C:\Users\Fagui\Documents\GitHub\Learning Fsharp\Algos\Algos\Stanford Algo II\Algo II - PA5 - TSP.txt"
let split (text:string)=
text.Split [|'\t';' '|]
let splitInto2Values (A: string []) =
(float A.[0],float A.[1])
let parseLine (line:string) =
line
|> split
|> splitInto2Values
let num_cities = int x.[0]
let cities = x |> Array.tail |> Array.map parseLine // [x_1][y_1]
我也有这个相关的警告
/Library/Frameworks/Mono.framework/Versions/4.4.0/lib/mono/4.5/Microsoft.Common.targets:警告:此工具集不支持 TargetFrameworkVersion“v4.5.2”(ToolsVersion:4.0)。 (我的算法)
【问题讨论】:
标签: arrays xamarin compiler-errors f#