Commit Graph

57 Commits

Author SHA1 Message Date
Scott Olsen
f13a2fdd9d Add some more calls to implement to make tests pass 2020-05-10 13:32:22 -04:00
hellerve
657f27c6ac core: add stdint types 2020-02-17 10:42:07 +01:00
Erik Svedäng
6ddf0e8f2b FIX! Avoid having to use temporary variables to help lifetime
checker.

In Concretize.hs, 'manageMemory' visits all args BEFORE managing their variables, making
it possible to apply functions to args "at the same time" as passing
them to the function.

Example:

(let [n (Array.unsafe-nth &b idx)
  new-b (Bucket.shrink @n k)]
  (Array.aset b idx new-b))))))

becomes

(let [n (Array.unsafe-nth &b idx)]
  (Array.aset b idx (Bucket.shrink @n k)))))))
2020-02-07 16:01:33 +01:00
Erik Svedäng
b7de401b82 Fixed broken code because of unsafe-nth. 2020-02-07 15:06:21 +01:00
Erik Svedäng
4fe7ea072b Merge branch 'master' into lifetimez-with-lambdas 2020-02-07 14:34:13 +01:00
hellerve
ac73729edf core: better performing Map./Set.put! 2020-01-27 16:58:10 +01:00
Erik Svedäng
576dad0984 Merge branch 'master' into lifetimez-with-lambdas 2019-11-25 12:22:04 +01:00
hellerve
98bc275ea5 core: add Byte.hash 2019-11-01 10:52:34 +01:00
GrayJack
07def7db23 Fix all nth usage 2019-10-31 06:23:23 -03:00
Erik Svedäng
6c9a6c0671 All tests run (yay). 2019-10-23 16:38:00 +02:00
Erik Svedäng
211cfdf65c Some hackery to get the Map module to not emit lifetime warnings. 2019-10-21 10:23:19 +02:00
Erik Svedäng
09f2dd7e23 Can load the core library without complaints. Tests still fail. 2019-10-18 14:40:20 +02:00
hellerve
aad568c941 core: make String.join take ref (for #562) 2019-09-16 20:22:01 +02:00
hellerve
7882b7ad57 core: copy default in Map.update-with-default 2019-06-17 13:43:45 +02:00
hellerve
c87893dd14 core: make map’s higher order functions non-owning 2019-05-27 18:42:25 +02:00
Scott Olsen
8c4d38233b Map: Fix small typo in doc empty? 2019-05-24 12:30:00 -04:00
hellerve
9010a5c2ee core: add Map.put! and Set.put! 2019-05-22 20:13:38 +02:00
hellerve
8089585f0a core: add docstring to Map.reverse 2019-05-05 11:55:37 +02:00
hellerve
58e280c553 core: add Pair.reverse and Map.reverse 2019-05-05 11:49:30 +02:00
Joel Kaasinen
0bcf6f6e72 fix Map.update-with-default docs
they were accidentally overwriting Map.update docs
2019-03-28 16:06:45 +02:00
Erik Svedäng
88e2896cb7 Tests run. 2019-03-26 14:30:00 +01:00
Erik Svedäng
32f14cd9e3 Work in progress... 2019-03-26 10:23:27 +01:00
hellerve
e54ead1922 all: various sumtype fixes
- add get-maybe to Map
- add tests
- fix emitter error on ref types
2019-02-13 11:46:20 +01:00
hellerve
66c31d524c core: simplify String.hash 2019-01-16 17:48:34 +01:00
Erik Svedäng
de1439c927
Merge pull request #368 from opqdonut/map-set-all
Set.all?, Map.all? and Map.=
2018-12-20 14:29:39 +01:00
Joel Kaasinen
5bb17b82ee core/Map.carp: Map.all? and Map.= 2018-12-18 16:17:08 +02:00
Joel Kaasinen
7aae7d55bd core/Map.carp: Set.all? 2018-12-18 15:58:58 +02:00
Joel Kaasinen
7f7f7c26b1 core/Map.carp: get-with-default
nice for types with no (zero) defined
2018-12-18 14:57:02 +02:00
Joel Kaasinen
a5e46dc71b core/Map.carp: set operations
- equality
- subset
- intersection
- union
- difference
2018-12-13 08:33:42 +02:00
Joel Kaasinen
8020434ace core/Map.carp: hash for Pair
Algorithm from https://stackoverflow.com/questions/1646807/quick-and-simple-hash-code-combinations
2018-12-11 17:37:51 +02:00
Joel Kaasinen
31824bcadb Map.to-array and Set.to-array functions, equality for non-ref Pairs 2018-12-07 21:28:36 +02:00
Joel Kaasinen
2fd86736d6 core/Map.carp: use Bucket.find in Map.update[-with-default]
to not look up the key in the bucket twice
2018-12-07 18:05:09 +02:00
Joel Kaasinen
23e2252d01 core/Map.carp: also make Bucket.shrink take a non-ref argument
for consistency
2018-12-07 17:48:07 +02:00
Joel Kaasinen
f0e62cccea core/Map.carp: Bucket.{get-idx,set-idx,push-back} helpers
in addition, make mutating Bucket operations take a non-ref argument
for consistency
2018-12-07 17:45:19 +02:00
Joel Kaasinen
df1b29fb74 core/Map.carp: factor out Bucket.find 2018-12-07 17:08:55 +02:00
Joel Kaasinen
10a9de39da core/Map.carp: Map.update and Map.update-with-default functions 2018-12-07 13:41:17 +02:00
Joel Kaasinen
845fd6409e core/Map.carp: Map.endo-map function 2018-12-07 13:27:48 +02:00
Joel Kaasinen
f28b0f9197 core/Map.carp: Set.reduce function 2018-12-07 13:17:58 +02:00
Joel Kaasinen
1b298c6e91 core/Map.carp: documentation updates 2018-12-07 13:11:05 +02:00
Joel Kaasinen
afd7dec6a8 core/Map.carp: Map.vals and Map.keys functions 2018-12-07 13:04:18 +02:00
Joel Kaasinen
6cf17937d7 core/Map.carp: add Map.kv-reduce function 2018-12-07 12:55:27 +02:00
Joel Kaasinen
81ff5f82c3 use break in Bucket.put, remove unused Bucket.grow 2018-12-04 08:31:02 +02:00
Joel Kaasinen
a473b54e06 fix Map.put and Set.put 2018-12-03 20:45:23 +02:00
Joel Kaasinen
cfb61847cb fix Map and Set behaviour for negative hash values
fixes #335

- add new Int.positive-mod function
- use it for Map and Set operations
- add tests
2018-12-01 18:01:02 +02:00
Erik Svedäng
1dc8b536fc Deftype generates 'update' functions that expect refs to functions too. 2018-11-14 14:21:12 +01:00
Erik Svedäng
fe55144273 Follow convention of passing lambdas as refs as default. 2018-11-14 14:09:43 +01:00
hellerve
e887a5633b core: remove put! and remove! from map and set 2018-10-31 13:42:05 +01:00
hellerve
16e2d7fb85 core: add remove! and put! and make reduce take ownership 2018-10-31 11:33:29 +01:00
hellerve
1c6884b93b core: fix docs for map and set 2018-08-25 19:51:27 +02:00
hellerve
91075cc613 core: remove pair from bucket for sets (less memory overhead) 2018-08-25 14:18:37 +02:00