-
Title: Computational Process Organization Lba1
-
List of group members: Chen Sihan 192050195 Yue Xueying 192050217
-
Laboratory work number: 3
-
Variant description: Binary-tree based set
-
Synopsis:
- add a new element (lst.add(3), cons(lst, 3), extend(lst, 3));
- remove an element (lst.remove(3), remove(lst, 3));
- size (lst.size(), size(lst));
- conversion from and to python lists (lst.to_list(), lst.from_list([12, 99, 37]), from_list([12, 99, 37]));
- find element by specific predicate (lst.find(is_even_), );
- filter data structure by specific predicate (lst.filter(is_even));
- map structure by specific function (lst.map(increment));
- reduce – process structure elements to build a return value by specific functions (lst.reduce(sum));
- data structure should be a monoid and implement mempty and mconcat functions or methods;
- iterator: for the mutable version in Python style [12, Chapter 7. Classes & Iterators]; for the immutable version by closure [14], see example ahead.
-
Contribution summary for each group member (should be checkable by git log and git blame): Chen Sihan: Mutable Part Yue Xueying: Immutable Part
-
Explanation of taken design decisions and analysis: In immutable, it define the node class, and all operations on it are written outside class. For mutable, we define node structure and tree structure, functions are all in tree class Immutable objects which state cannot be changed once they are created. Every time they are changed, new objects are generated. Mutable objects whose state can still be changed after creation
-
Work demonstration (how to use developed software, how to test it), should be repeatable by an instructor by given command-line examples;
-
Conclusion: design binary trees in mutable and immutable ways, we realize the function of add new element,remove element,size of the tree ,list and tree transform,filter,reduce and so on. we get the difference of mutable and immutable.
forked from achen0804/CPO_lab1
-
Notifications
You must be signed in to change notification settings - Fork 0
jzm-123/CPO_lab1-1
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- Python 100.0%