Tallying is a simple counting system that works in base 5. There are various different tallying systems used around the world, but the one that is used in most English-speaking countries is perhaps the most simple - count units by marking vertical lines, then for each 5th mark put a horizontal line through the previous collection of four. This clusters the tally marks in groups of 5 (and makes them easier to quickly count).
You are going to write a program that displays tally marks up to a given value. But, tallying in only base 5 is boring! Therefore, your program should also be able to display tallies in different bases.
The input will be either one or two non-negative integer values separated by a comma (e.g.
8,4). The first number is the value that should be displayed by the tally. The second value is the base of the tally. If the second value is not given, use base 5.
The output will be the inputted value represented as ASCII art tally marks. Here are some examples you can test your program against - your output should match them exactly!
| | | | | | | | | | -+-+-+-+- -+-+-+-+- | | | | | | | | | | | |
| | | | | -+-+- -+-+- | | | | | |
| | -+- -+- | |
6,10 (notice the leading spaces)
| | | | | | | | | | | | | | | | | |
Note also that base 1 is intended to be inconsistent - only vertical lines should be used.
If either of the inputted values is 0, there should be no output whatsoever (and your program should end gracefully).
- This is code-golf, so the shortest correct implementation (in bytes) wins.
- Input/output can be in any suitable medium (e.g. stdin/stdout, file...).
- Input can be in the form of multiple command-line arguments or separated by spaces, etc. if it is more suitable for your target language.
- Trailing newlines are allowed in the output. Trailing spaces are not. This rule only applies when there is an output (i.e. not when the inputted value is 0).
- Your code must default to base 5 when no base is input.