- round 四舍五入
- quotient 整除
- remainder 余数
- current-inexact-milliseconds 毫秒计
- inexact->exact 转精确数
- #e 转分
- #b #o #x 不同进制表示
- (number->string 23423 2) 进制转换
- eqv? 区分整数与小
- char->integer 字符与Unicode码转换(支持中文) 字符加#\
- char-alphabetic? 单个字符判
- char-numeric?
- char-whitespace
- char-downcase 字符大小写
- char-upcas
- char=? (与eqv?相同)和char-ci=?(忽略大小写)
- string-set
- make-string
- string-re
- string<\? 顺序比较字符串 string<-ci?(忽略大小写)
- string->symbol 当有字母以外的符号时,输出两边有竖线,write输出竖线,display不输
- andmap ormap fliter for-each
- assoc 找字典
- mcons 可变pair set-mcar!
- 向量是定长数组,更新元素消耗O(1) #(1 2 3
- vector-ref list->vector vector->list
- magnitude 返回极坐标系下数的大小,可以是复
- [named let] (let xxx ([])) xxx可以当函数用
- cond =>将判定结果传进一个函
- void 什么都不返回 empty返回’()
- begin 可以把一堆命令变成一个从
- begin以最后一个值作为返回值,begin0以第一个值作为返回值
- 少用set
- letrec 递归赋值,和lambda配合?????
- quote的参数不能以 #< 开头
- quasiquote unpuote == `
- struct-copy 复制结构体
- 结构体预定义 #:prefab 先随便define ’#s(xxx xxx) 再定义结构体匹配
- 结构体参数:#:mutable 自动生成set-dot-x!一类的函数,可以改变结构体的属性,[属性名 #:mutable]可以单独让一个属性可变
- (struct posn (x y [z #:auto]) #:transparent #:auto-value 0) auto用于设置默认
- #:guard 设置一个函数,每当创建实例的时候调用
- #method 实现泛型接口?????
- #:property ????
- #:super ?????
- 【第七章】?????
- open-output-file #:exist ‘update 从文件开头更新,剩下没更新的部分保留 ‘truncate 删除之前的重写 close-output-port
- open-input-file close-input-port
- call-with-input-file call-with-output-file 里面嵌套一个lambda,运行完自动关闭文件
- display 输出的是尽量简化的格式
- write 可以和read搭配
- printf可以格式化 ~a==display ~s==write ~v==print
- make-pipe 生成单向的in->out管道???
- reencode-output-port reencode-input-port 转utf8
- (break-thread (current-thread))
- with-handlers
- in-range 首 尾 步长
- in-naturals 无上限
- stop-before 不包含判定的字符 stop-after 包含判定的字符
- in-list in-vector in-string 等同于in-range加上类型判定
- for 多个变量同时迭代,有一个迭代完就全部停止 for* 多个变量嵌套迭代
- for/list for*/list for/vector for*/vector 同上
- 可以在两个变量中间或主体部分加#:when 进行筛选
- for/and for/or 返回真值,主体部分一般是equal判定
- for/first 返回第一个匹配的 for/last 返回最后一个匹配的
- for/fold for*/fold
- #:break 马上跳出循环 #:final 执行完当前循环次后跳出循环
- time计算运行时间,中间放什么都行
- match 模式匹配 可以区分list cons vector 可以匹配变量x 最后加上[_ ‘xxx]指定没匹配上的返回值 加…可以省略一部分(模糊匹配)
- match-let match-lambda ???
- arithmetic-shift 移位
- random-integer (require math/base) 没有位数限制
Racket 常用方法
最新推荐文章于 2024-09-07 23:13:34 发布