zoukankan      html  css  js  c++  java
  • 【F#】 入门代码

    找下感觉: 语法和go 如出一辙, 都是erlang派的语言

    在 vs 中我没有找到自动缩进的快捷键

    github上的F#代码也相对较少

    //http://fsharp.org 上了解有关 F# 的更多信息  
    // 请参阅“F# 教程”项目以获取更多帮助。
    open System
    
    //2. 相当于一个类实体
    type internal Person = {
        id: int
        name: string
        parent: int
    }
    // 
    type internal User = {
        id: int
        name: string 
    }
    
    let hellofunc() =
        Console.WriteLine "hello word"
        let hh = Console.ReadKey(true)
        //3. personobj 是根据相同结构确定定义的对象吗?
        let personobj = {
            id= 1
            name = "f#"
            parent = 7 
             }
        //是这样的(我还是喜欢直接写代码  后看理论)
        let user = {
            id = 1
            name = "username"
        }
        Console.WriteLine personobj.name
        Console.WriteLine hh.Key
        let hhh = Console.ReadLine
        0
    
    //1. 用“EntryPointAttribute”特性标记的函数必须是编译序列中最后一个文件中的最后一个声明,并且只能在编译为 .exe 时才可使用    
    //f#是从上往下编译的
    //那么文件依赖有顺序吗?
    [<EntryPoint>]
    let main argv =  
        hellofunc()

    接下来深喉+直捣黄龙,来看看高并发多线程下F#有何玄机:

  • 相关阅读:
    Sum Root to Leaf Numbers 解答
    459. Repeated Substring Pattern
    71. Simplify Path
    89. Gray Code
    73. Set Matrix Zeroes
    297. Serialize and Deserialize Binary Tree
    449. Serialize and Deserialize BST
    451. Sort Characters By Frequency
    165. Compare Version Numbers
    447. Number of Boomerangs
  • 原文地址:https://www.cnblogs.com/viewcozy/p/4625027.html
Copyright © 2011-2022 走看看