Undo NatMap/StringMap change

This commit is contained in:
MaiaVictor 2021-06-22 18:50:32 -03:00
parent 771ec45394
commit 2632f0418b
28 changed files with 9 additions and 81 deletions

View File

@ -7,5 +7,5 @@
//(coord, map)
//App.KL.Game.Map.push(coord, App.KL.Game.Map.Entity.animation(App.KL.Game.Animation.new(some(45), App.KL.Game.Sprite.fire)),
//map), coords)
//App.KL.Game.Effect.Result.new<Unit>(Unit.new, map, [], Nat.NatMap.new!)
//App.KL.Game.Effect.Result.new<Unit>(Unit.new, map, [], NatMap.new!)

View File

@ -1,8 +1,8 @@
App.KL.Game.Field.get_by_id(id: Nat): Maybe<App.KL.Game.Field>
Nat.NatMap.get!(id, App.KL.Game.Field.get_by_id.map)
NatMap.get!(id, App.KL.Game.Field.get_by_id.map)
App.KL.Game.Field.get_by_id.map: Nat.NatMap<App.KL.Game.Field>
Nat.NatMap.from_list!(List.imap!!((i,x) {i, x}, App.KL.Game.Field.list))
App.KL.Game.Field.get_by_id.map: NatMap<App.KL.Game.Field>
NatMap.from_list!(List.imap!!((i,x) {i, x}, App.KL.Game.Field.list))
App.KL.Game.Field.get_by_id.default(id: Nat): App.KL.Game.Field
App.KL.Game.Field.get_by_id(id) <> App.KL.Game.Field.Grass.field

View File

@ -1,5 +1,5 @@
App.KL.Game.Hero.get_by_id(id: Nat): Maybe<App.KL.Game.Hero>
Nat.NatMap.get!(id, App.KL.Game.Hero.get_by_id.map)
NatMap.get!(id, App.KL.Game.Hero.get_by_id.map)
App.KL.Game.Hero.get_by_id.map: Nat.NatMap<App.KL.Game.Hero>
Nat.NatMap.from_list!(List.imap!!((i,x) {i, x}, App.KL.Game.Hero.list))
App.KL.Game.Hero.get_by_id.map: NatMap<App.KL.Game.Hero>
NatMap.from_list!(List.imap!!((i,x) {i, x}, App.KL.Game.Hero.list))

View File

@ -1,2 +0,0 @@
Nat.NatMap: Type -> Type
BBT<Nat>

View File

@ -1,4 +0,0 @@
// Copies all key and vals from b to a
Nat.NatMap.assign<A: Type>(a: Nat.NatMap(A), b: Nat.NatMap(A)): Nat.NatMap(A)
BBT.assign(Nat, A, Nat.cmp, b, a)

View File

@ -1,2 +0,0 @@
Nat.NatMap.delete<A: Type>(key: Nat, map: Nat.NatMap(A)): Nat.NatMap(A)
BBT.delete!!(Nat.cmp, key, map)

View File

@ -1,2 +0,0 @@
Nat.NatMap.from_list<A: Type>(xs: List<Pair<Nat,A>>): Nat.NatMap(A)
BBT.from_list!!(Nat.cmp, xs)

View File

@ -1,2 +0,0 @@
Nat.NatMap.get<A: Type>(key: Nat, map: Nat.NatMap(A)): Maybe<A>
BBT.lookup!!(Nat.cmp, key, map)

View File

@ -1,2 +0,0 @@
Nat.NatMap.keys<A: Type>(xs: Nat.NatMap<A>): List<Nat>
BBT.foldr_with_key!!!((key, value, list) key & list, [], xs)

View File

@ -1,2 +0,0 @@
Nat.NatMap.new<A: Type>: Nat.NatMap(A)
BBT.tip!!

View File

@ -1,2 +0,0 @@
Nat.NatMap.set<A: Type>(key: Nat, val: A, map: Nat.NatMap(A)): Nat.NatMap(A)
BBT.insert!!(Nat.cmp, key, val, map)

View File

@ -1,2 +0,0 @@
Nat.NatMap.to_list<A: Type>(xs: Nat.NatMap(A)): List<Pair<Nat,A>>
BBT.to_list!!(xs)

View File

@ -1,2 +0,0 @@
String.NatMap.union<A: Type>(a: Nat.NatMap(A), b: Nat.NatMap(A)): Nat.NatMap(A)
BBT.union!!(Nat.cmp, a, b)

View File

@ -1,2 +0,0 @@
Nat.Map.values<A: Type>(xs: Nat.NatMap(A)): List<A>
BBT.foldr_with_key!!!((key, value, list) value & list, [], xs)

2
base/NatMap.kind Normal file
View File

@ -0,0 +1,2 @@
NatMap<A: Type>: Type
BitsMap<A>

View File

@ -1,3 +0,0 @@
String.StringMap(V: Type): Type
BBT<String, V>

View File

@ -1,4 +0,0 @@
// Copies all key and vals from b to a
String.StringMap.assign<A: Type>(a: String.StringMap(A), b: String.StringMap(A)): String.StringMap(A)
BBT.assign(String, A, String.cmp, b, a)

View File

@ -1,8 +0,0 @@
// Deletes a element of a specified key
// #Example :
// Map.delete!("orange",
// Map.from_list([{"orange", 2}, {"black, 3"}])) ==
// Map.from_list([{"black, 3"}]))
// If there is not key corresponding, leaves the map unchanged
String.StringMap.delete<A: Type>(key: String, map: String.StringMap(A)): String.StringMap(A)
BBT.delete!!(String.cmp, key, map)

View File

@ -1,8 +0,0 @@
// Iterates over a map applyng a String -> A -> A -> B function
// #Example :
// let map = Map.from_list!([{"orange", 2}, {"black", 3}, {"yellow", 4}, {"brown", 1}, {"white", 1}])
// Map.for!(map)!({".", 0}, (x, y, z) { z@fst | x | ".", z@snd + y})
// ==
// {".black.brown.orange.white.yellow.", 11}
String.StringMap.for<A: Type>(map: String.StringMap(A))<B: Type>(b: B, f: String -> A -> B -> B): B
BBT.for!!(map)!(b, f)

View File

@ -1,6 +0,0 @@
// Construct a map from a list
// Example Map.from_list!([{"ab", 2}, {"cd", 4}]), gives a map
// associated with "ab" on 2 and "cd" on 4
String.StringMap.from_list<A: Type>(xs: List<Pair<String,A>>): String.StringMap(A)
BBT.from_list!!(String.cmp, xs)

View File

@ -1,7 +0,0 @@
// Gets a value from a key or return none if there is no key associated in the map
// #Examples
// Map.get!("ab", Map.from_list!!([{"ab", 2}, {"cd", 4}])) == some(2)
// Map.get!("doge", Map.from_list!!([{"ab", 2}, {"cd", 4}])) == none
String.StringMap.get<A: Type>(key: String, map: String.StringMap(A)): Maybe<A>
BBT.lookup!!(String.cmp, key, map)

View File

@ -1,2 +0,0 @@
String.StringMap.keys<A: Type>(xs: String.StringMap<A>): List<String>
BBT.foldr_with_key!!!((key, value, list) key & list, [], xs)

View File

@ -1,2 +0,0 @@
String.StringMap.map<A: Type, B: Type>(fn: A -> B, map: String.StringMap(A)): String.StringMap(B)
BBT.map!!!(fn, map)

View File

@ -1,2 +0,0 @@
String.StringMap.new<A: Type>: String.StringMap(A)
BBT.tip!!

View File

@ -1,2 +0,0 @@
String.StringMap.set<A: Type>(key: String, val: A, map: String.StringMap(A)): String.StringMap(A)
BBT.insert!!(String.cmp, key, val, map)

View File

@ -1,2 +0,0 @@
String.StringMap.to_list<A: Type>(xs: String.StringMap(A)): List<Pair<String,A>>
BBT.to_list!!(xs)

View File

@ -1,2 +0,0 @@
String.StringMap.union<A: Type>(a: String.StringMap(A), b: String.StringMap(A)): String.StringMap(A)
BBT.union!!(String.cmp, a, b)

View File

@ -1,2 +0,0 @@
String.StringMap.values<A: Type>(xs: String.StringMap(A)): List<A>
BBT.foldr_with_key!!!((key, value, list) value & list, [], xs)