lean4-htt/library/init
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
..
control chore(library/init/control/id): spurious [inline] annotations 2019-04-05 14:16:38 -07:00
data perf(library/init/data/array/basic): remove inefficient mforeachAux and add new hmmap and hmap 2019-04-19 14:52:52 -07:00
lean chore(library/init/lean/parser/trie): add HasEmptyc instance 2019-04-12 07:30:06 -07:00
coe.lean chore(library/init): Bool.tt => Bool.true and Bool.ff => Bool.false 2019-03-21 15:06:44 -07:00
core.lean chore(library/init/core): remove misleading annotation 2019-04-05 16:29:44 -07:00
default.lean chore(library/init,runtime,library/compiler): add fix primitive back 2019-03-27 17:13:53 -07:00
env_ext.lean chore(library): capitalize types and namespaces 2019-03-21 15:06:43 -07:00
fix.lean chore(library/init,runtime,library/compiler): add fix primitive back 2019-03-27 17:13:53 -07:00
init.md
io.lean chore(library/init): remove fix.lean 2019-03-27 13:11:00 -07:00
platform.lean chore(library): capitalize types and namespaces 2019-03-21 15:06:43 -07:00
util.lean chore(*): Uint => UInt, Usize => USize 2019-03-21 15:06:44 -07:00
wf.lean feat(library/init/wf): remove wf_term_hack 2019-03-27 12:41:16 -07:00