tailieunhanh - How to Design Programs Languages phần 8

Mục đích: để soạn một chuỗi các thủ tục vào một bộ lọc thủ tục duy nhất: ((X - boolean) (listof X) - (listof X)) Mục đích: để xây dựng một danh sách từ tất cả các mục trong danh sách mà các vị nắm giữ foldlể áp dụng một chức năng để mỗi mục trên một hoặc nhiều danh sách bản đồ chỉ có hiệu lực | build-string nat nat - char - string Purpose build-string n f string f 0 . f - n 1 compose Y-1 - Z Y-N - Y-N-1 X-1 . X-N - Y-N - X-1 . X-N - Z Purpose to compose a sequence of procedures into a single procedure filter X - boolean listof X - listof X Purpose to construct a list from all those items on a list for which the predicate holds foldl X Y - Y Y listof X - Y Purpose foldl f base list x-1 . x-n f x-n . f x-1 base foldr X Y - Y Y listof X - Y Purpose foldr f base list x-1 . x-n f x-1 . f x-n base for-each any . - any listof any . - void Purpose to apply a function to each item on one or more lists for effect only map X . - Z listof X . - listof Z Purpose to construct a new list by applying a function to each item on one or more existing lists memf X - boolean listof X - union false listof X 121 Purpose to determine whether the first argument produces true for some value in the second argument ormap X - boolean listof X - boolean Purpose ormap p list x-1 . x-n or p x-1 or . p x-n procedure any - boolean Purpose to determine if a value is a procedure quicksort listof X X X - boolean - listof X Purpose to construct a list from all items on a list in an order according to a predicate sort listof X X X - boolean - listof X Purpose to construct a list from all items on a list in an order according to a predicate Unchanged Forms define-struct structid fieldid . The same as Intermediate s define-struct. local definition . expr letrec id expr-for-let . expr let id expr-for-let . expr let id expr-for-let . expr The same as Intermediate s local letrec let and let . cond expr expr . expr expr else The same as Beginning s cond. if expr expr expr 122 The same as Beginning s if. and expr expr expr . or expr expr expr . The same as Beginning s and and or. time expr The same as Intermediate s time. check-expect expr expr check-within expr expr expr check-error expr expr The same as Beginning s check-expect etc. empty empty true boolean false boolean Constants for the empty