Computational Process Organization Lab1,variant 1
- Name:Huang Yanlin, student number:192050222 lemon-0615
- Name:Lin ningning, student number:192050192 Lin-12
Lab1 variant 1
variant 1: Unrolled linked list (you can use built-in list inside node).
- 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 speci?c function (lst.map(increment));
- reduce-process structure elements to build a return value by speci?c 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);
- mutable&test_mutable:Lin ningning
- immutable&immutable_test:Huang Yanlin
Unrolled linked list is a kind of transformation or improvement of linked list. Each node of it is stored by an array. The capacity of node array is fixed. 1. Insert operation: insert the element after finding the position according to the subscript. If the current inserted node array is full, a new node is created, and half of the elements of the current node are moved to the array of the new node, and the element is inserted finally. 2. Delete: delete the element according to the subscript. A node after deleting an element may need its neighbors to merge. Unrolled linked list has the advantages of random access of array and efficient insertion and deletion of linked list.
- (how to use developed software, how to test it), should be repeatable by an instructor by given command-line examples:
- We write unrolled linked list file and test file on Pycharm.
- Use terminal to test the code. like 'python Immutable_test.py -v'and 'python test_mutable.py -v'.
Mutable version used used list to create a unrolled linked list.In immutable version,we create a new unrolled linked list before modifying each unrolled linked list, and do not change the original linked list.This Lab makes us to realize unrolled linked list and mutable/immutable version.
Computational Process Organization Lab2,variant 6
- Name:Huang Yanlin, student number:192050222 lemon-0615
- Name:Lin ningning, student number:192050192 Lin-12
Lab2 variant 6
variant 6: Regular expression
- Support special characters: , ^, ., $, *, +, [ ], [^ ], { }.
- Support functions: match, sub.
- Visualization as a finite state machine (state diagram or table).
- contribution summary for each group member (should be checkable by git log and git blame);
- lexer.py & regex.py:Huang Yanlin
- nfa.py : Lin ningning
- sample.py :HuangYanlin & Lin ningning
- lexer
- Lexical analysis of regular expressions
- regular
- About some functions for Regular expression
- nfa
- Definition of an NFA node the construction of an NFA
- sample
- About some test for Regular expression
- (how to use developed software, how to test it), should be repeatable by an instructor by given command-line examples:
- We write all files on Pycharm.
- Use terminal to test the code. like 'python sample.py -v'.
- We implement simple library for RE and demonstrate how it works.
- This lab is difficult for us but we also learn more about it.
- We add some practical examples in tests which make this code to have practical meanings.
Computational Process Organization Lab3,variant 1
- Name:Huang Yanlin, student number:192050222 lemon-0615
- Name:Lin ningning, student number:192050192 Lin-12
Lab3 variant 1
variant 1: In this variant, you should implement a lazy library for a single-linked list. For that, you should use closures. Usage of generators (yield statement) or async (async, await statements) is not allowed.
implement the following API:
- head(List) – return a list first element. If the list is empty – raise an exception.
- tail(List) – return tail of the list.
- length(List).
- map(List, Function) and reduce(List, Function, InitialState).
- mempty().
- mconcat(List1, List2) – should not force list evaluation.
- from_list(pythonList) and to_list(List).
- it should be an iterator.
- Complex test – factorial - To proof correctness, use unit tests, properties-based tests - To proof laziness,demonstrate it for all suitable implemented functions on an infinite list (e.g. natural numbers sequence) and a
- contribution summary for each group member (should be checkable by git log and git blame);
- Linkedlist:Huang Yanlin
- Linkedlist_test:Lin ningning
we create a single-linked list and use closures.And we not use generators (yield statement) or async (async, await statements).
- (how to use developed software, how to test it), should be repeatable by an instructor by given command-line examples:
- We write Linkedlist file and test file on Pycharm.
- Use terminal to test the code. like 'python Linkedlist.py -v'and 'python Linkedlist_test.py -v'.
We create a single-linked list and use closures.It's easy to see the test result.