https://github.com/night-codes/scalc_test
https://github.com/night-codes/scalc_test
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/night-codes/scalc_test
- Owner: night-codes
- Created: 2020-01-17T04:44:59.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-01-18T00:26:10.000Z (over 5 years ago)
- Last Synced: 2024-04-16T08:56:06.598Z (about 1 year ago)
- Language: Go
- Size: 7.81 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Task: Sets Calculator
Write a sets calculator. It should calculate union, intersection and difference of sets of integers for given expression. Grammar of calculator is given:
```
expression := “[“ operator sets “]”
sets := set | set sets
set := file | expression
operator := “SUM” | “INT” | “DIF”
```Each file contains sorted integers, one integer in a line.
Meaning of operators:
`SUM` - returns union of all sets
`INT` - returns intersection of all sets
`DIF` - returns difference of first set and the rest onesProgram should print result on standard output: sorted integers, one integer in a line.
Solution should include: source code, building script (if building is needed). Final program should be able to be run on Linux. Solution should be delivered in tar archive file: “solution.tgz”.
The task will be assessed taking into consideration the following criteria (sorted by severity):
* compliance with specification and correctness
* good programming practices (clean code)
* clearness and readability of implemented algorithm
* computational complexity## Example:
`$ cat a.txt`
```
1
2
3
````$ cat b.txt`
```
2
3
4
````$ cat c.txt`
```
3
4
5
````./scalc [ SUM [ DIF a.txt b.txt c.txt ] [ INT b.txt c.txt ] ]`
```
1
3
4
```## Use:
Run tests:
`$ make test`Run app:
`$ make run`