c.2: hashmaps, vectors, hide MAL struct, reduce duplication #723
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix a few issues in 62d1ed3 (it seems one cannot extend a merged PR).
Out of curiosity, are the performance tests results public?
On my machine, this is ten times faster than before 62d1ed3.
As a side note, env_get searches for DEBUG-EVAL in all parent environments until REPL during each evaluation, so map search is now probably the limiting factor for speed in most implementations. The guide should probably mention that binary trees, even without effort to keep them balanced, are in this case (one large structure and lots of very small ones) both faster and easyer to implement than the currently suggested linear representation. The linear representation is only convenient until the guide requires
dissoc.Makefile:
Compute the build flags with pkg-config.
Make more settings available on the command line.
Enable the -fanalyzer warning (and close the issue found in slurp).
core:
Simplify the argument parsing and return value constructor in ".".
env:
Implement with hashmaps. Allow printing by DEBUG-EVAL.
error (new):
Format most error messages consistently.
When an error is detected, show all arguments instead of only the
remaining ones (this was not informative when the rest was empty).
Restore the previous error prefix (the MAL function, not the C function).
Use a global variables instead of a type, simplifying functions
returning non-MAL types.
hashmap (rewritten, moved to ./):
Replace binary trees with hashed maps.
linked_list (moved to ./):
Return a signed count in order to spare a later conversion.
printer:
Allow a width specifier (for DEBUG-EVAL).
Print MAL type sets (for bad_type) and hashmaps (for DEBUG-EVAL).
Shorten name for functions (else REPL fills the screen).
Move commands outside of assert (they didn’t survive NDEBUG).
Inverse the meaning of " " so that list are spaced by default.
readline (new):
Avoid duplication in steps and core (core was incorrect).
steps:
Properly report reader errors (this was dealt with by the null case in EVAL,
but not documented and removed by 62d1ed3).
Stop preventing TCO when if returns nil (the benefit is dubious).
Add a quasiquote_folder used by lists and vectors.
Stop calling quasiquote twice on each list/vector element (error in 62d1ed3).
types:
Hide the struct into the .c file.
Compute the hash of each string at creation.
Allocate common symbols once at startup.
Remove metadata from most types.
Use the same "pattern-matching" function to test the type and extract the contents.
Add metadata as an optional argument to some constructor.
vectors (new):
Provide an iterator common with lists.
global
Move equality from core to types, use it in steps and hashmaps.
In closures, store the raw fn* arguments (The &more syntax without
space is lost but could be restored if this seems important).