Git Product home page Git Product logo

cs15100's Introduction

CMSC 15100 Style guide

  1. 类型签名:(: name : type) (:print-type expression)

    1. 匿名函数的标识和struct的标识与一般的不同
    (lambda ([param-1 : ty-1] ... [param-n : ty-n]) expr)
  2. 基本类型:

    1. Natural
    2. Integer
    3. Exact-Rational
    4. Real
    5. Number
    6. Boolean
    7. String
    8. Symbol
  3. 作用:减少错误、性能优化、利于阅读

  4. 词法作用域:静态作用域

  5. union type: (: U T_1 T_2 ... T_k)

  6. single type:枚举类型

    (: R : 'red)
    (define R 'red)
    
    This kind of type is called a singleton type, since it is a type that has 
    exactly one value. By combining multiple singleton types in a union, 
    we can describe enumeration types. For example, our color type is 
    the union of 'red, 'green, and 'blue. Two other useful singleton 
    types are #t and #f (as one might guess, Boolean is the union of #t and #f).
    
    (: color-to-string : (U 'red 'green 'blue) -> String)
    ;; convert a color to a string
    (define (color-to-string c)
      (cond
        [(symbol=? c 'red) "red"]
        [(symbol=? c 'blue) "blue"]
        [else "green"]))
  7. Type definitions:

    ;; A color is one of 'red, 'blue, or 'green.
    we can give an explicit definition using the define-type construct
    
    (define-type Color (U 'red 'blue 'green))
  8. Subtyping

    使用U
  9. Pattern-matching gotchas:

    Patterns and pattern matching

  10. 递归类型

  11. 多态函数和多态类型

    (All (A B) (Two-Things A B) -> (Two-Things B A))
    is called universal quantification and it means 
    "for all types A and B a function from (Two-Things A B) to (Two-Things B A)". 
    If we apply swap to a value of type (Two-Things Integer Boolean)
  12. 高阶函数

  13. Listof和Vectorof

  14. 命令式:

    (void):

  15. ctrl + i 格式化代码

  16. optional,要么空,要么有值。maybe,maybe monad

  17. 将现存类型命名成新类型

  18. match*:模式匹配多个值

  19. match:== 相等扩展

https://blog.csdn.net/yeswenqian/article/details/22291675

boxOf

cast

cs15100's People

Contributors

caocao485 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.