lib/: add tests, fix detected problems, improve implementations
authorNicolas Boulenguez <nicolas.boulenguez@free.fr>
Fri, 17 May 2019 23:38:59 +0000 (01:38 +0200)
committerNicolas Boulenguez <nicolas.boulenguez@free.fr>
Fri, 17 May 2019 23:52:13 +0000 (01:52 +0200)
commit83665b4fda83c879598cc916a368fca08f401c64
tree9266df0f76b82aff04e0f6c4953349dc59772567
parent4924fac100951d461c326cd6242ff61623ce0fd3
lib/: add tests, fix detected problems, improve implementations

equality.mal:
- fix typos
- let and2 and or2 always return booleans
- when looping in sequences, compare lengths only once
- empty? instead of an equality test
- when looping on a keys, do not check if a contains the current key
- change the `cond` logic: when a is a sequence and b a map, return
  false instead of delegating to scalar-equal?.
- add tests

memoize.mal:
- make explicit that the function name must be kept
- fix typo in tests

protocols.mal:
- document
- add a function mapping an object to its type
- add default types for remaining built-in MAL values
- let defprotocol return the new protocol instead of last method
- set the right profile for abstract methods, improving error messages
- replace incomplete example with lots of tests

pprint:
- escape parenthesis in expected test results

[kanaka]
- explain in lib/README.md how to run tests/lib/*.
- rename folds to reducers and composition to threading
- move fib and sumdown from lib/ to tests/
17 files changed:
lib/README.md
lib/equality.mal
lib/memoize.mal
lib/protocols.mal
lib/reducers.mal [moved from lib/folds.mal with 100% similarity]
lib/threading.mal [moved from lib/composition.mal with 94% similarity]
tests/computations.mal [moved from lib/heavy_computations.mal with 100% similarity]
tests/lib/equality.mal [new file with mode: 0644]
tests/lib/memoize.mal
tests/lib/pprint.mal
tests/lib/protocols.mal
tests/lib/reducers.mal [moved from tests/lib/folds.mal with 92% similarity]
tests/perf1.mal
tests/perf2.mal
tests/perf3.mal
tests/step8_macros.mal
tests/stepA_mal.mal