lean4-htt/library/init/data
Leonardo de Moura b1503f2c56 perf(library/init/data/array/basic): remove inefficient mforeachAux and add new hmmap and hmap
The `mforeachAux` function was keeping two references to the array
because it was implemented using `miterate a ⟨a, rfl⟩ ...`
Thus, we would have to allocate a new array even if `a` was not shared.

Another issue is that when invoking `x ← f i v`, the array would still
have a reference to `v`, and consequently `RC(v) > 1`, and `f` would not
be able to perform destructive updates to `v` or reuse its memory cell.

Thus, I removed `mforeach` (we only used it to implement `hmap`: the
homogeneous map), and implemented a new `hmap` which makes sure
destructive updates can be performed modulo the issue with float `let`
inwards I described in the previous commit.

@kha I found the problem described in the previous commit when I was
using `Array.hmap`. If we use `Array`s to implement `Syntax` as we discussed,
then a `hmap` that does not prevent destructive updates from happening is
a must-have. Otherwise, any benefit we get from using `Array`s instead
of `List`s is gone.
2019-04-19 14:52:52 -07:00
..
array perf(library/init/data/array/basic): remove inefficient mforeachAux and add new hmmap and hmap 2019-04-19 14:52:52 -07:00
char refactor(library/init/data/rbmap): use Bool instead of Prop 2019-04-03 02:54:34 -07:00
fin chore(library/init/core): HasLt => HasLess, HasLe => HasLessEq, ... 2019-03-23 10:07:46 -07:00
hashmap perf(library/init/data/hashmap/basic): reuse AssocList memory cells when expanding hashtable 2019-04-03 10:49:46 -07:00
int chore(library/init/data/int/basic): remove weird notation, dead code, and fix camelCase conversion issues 2019-04-03 02:54:34 -07:00
list chore(library/init/data/list/basic): cleanup 2019-03-29 16:33:08 -07:00
nat refactor(library/init): minor changes 2019-03-29 10:39:00 -07:00
option feat(library/init/data/option/basic): add [inline] attributes 2019-03-28 20:18:37 -07:00
ordering chore(library/init/core): HasLt => HasLess, HasLe => HasLessEq, ... 2019-03-23 10:07:46 -07:00
rbmap perf(library/init/data): add @[specialize] to RBMap and RBTree functions that depend on lt : a -> a -> Bool 2019-04-03 09:16:34 -07:00
rbtree perf(library/init/data): add @[specialize] to RBMap and RBTree functions that depend on lt : a -> a -> Bool 2019-04-03 09:16:34 -07:00
string chore(library/init/data/string/basic): naming consistency 2019-04-09 08:18:29 -07:00
assoclist.lean feat(library/init/data/assoclist): add AssocList 2019-04-03 04:35:52 -07:00
basic.lean chore(library): use lowercase in imports 2019-03-21 15:06:44 -07:00
default.lean refactor(library/init/data/hashmap): use AssocList and HasBeq 2019-04-03 05:55:08 -07:00
dlist.lean refactor(library/init): move function.lean definitions to core.lean 2019-03-22 09:33:10 -07:00
hashable.lean feat(runtime): add primitive hash functions 2019-04-03 04:01:36 -07:00
repr.lean feat(library/init/data/string): add Substring 2019-03-25 09:29:06 -07:00
tostring.lean feat(library/init/data/string): add Substring 2019-03-25 09:29:06 -07:00
uint.lean chore(library/init/core): HasLt => HasLess, HasLe => HasLessEq, ... 2019-03-23 10:07:46 -07:00