Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- proc simpleTreeDiff*[T, L, V](
- source, target: T,
- getLabel: proc(t: T): L,
- getValue: proc(t: T): V,
- valueScore: ScoreCmpProc[V],
- similarityTreshold: int = 60,
- initialMapping: bool = true
- ): auto =
- # ^^^^ implementation noise, included for context
- # vvvv if I have this *order of statements* things work fine
- let
- sourceIndex: TreeIndex[L, V] = makeIndex[T, L, V](
- source, true, getValue, getLabel)
- var tmp: Table[NodeId[L, V], NodeId[L, V]]
- let
- targetIndex: TreeIndex[L, V] = makeIndex[T, L, V](
- target, false, getValue, getLabel)
- # vvvv but if I move it like this, I get erro belov
- var tmp: Table[NodeId[L, V], NodeId[L, V]]
- let
- sourceIndex: TreeIndex[L, V] = makeIndex[T, L, V](
- source, true, getValue, getLabel)
- let
- targetIndex: TreeIndex[L, V] = makeIndex[T, L, V](
- target, false, getValue, getLabel)
- #[
- /mnt/workspace/github/hmisc/tests/tHTreeDistance.nim(36, 24) template/generic instantiation of `simpleTreeDiff` from here
- /mnt/workspace/github/hmisc/src/hmisc/algo/htree_distance.nim(958, 54) template/generic instantiation of `makeIndex` from here
- /mnt/workspace/github/hmisc/src/hmisc/algo/htree_distance.nim(163, 31) template/generic instantiation of `[]=` from here
- /home/test/.choosenim/toolchains/nim-1.4.0/lib/pure/collections/tableimpl.nim(58, 21) template/generic instantiation of `rawGet` from here
- /home/test/.choosenim/toolchains/nim-1.4.0/lib/pure/collections/hashcommon.nim(60, 48) Error: type mismatch: got <string, NodeId[system.string, system.string]>
- but expected one of:
- proc `==`(x, y: bool): bool
- first type mismatch at position: 1
- required type for x: bool
- but expression 't.data[h].key' is of type: string
- proc `==`(x, y: char): bool
- first type mismatch at position: 1
- required type for x: char
- but expression 't.data[h].key' is of type: string
- proc `==`(x, y: cstring): bool
- first type mismatch at position: 2
- required type for y: cstring
- but expression 'key' is of type: NodeId[system.string, system.string]
- proc `==`(x, y: float): bool
- first type mismatch at position: 1
- required type for x: float
- but expression 't.data[h].key' is of type: string
- proc `==`(x, y: float32): bool
- first type mismatch at position: 1
- required type for x: float32
- but expression 't.data[h].key' is of type: string
- proc `==`(x, y: int): bool
- first type mismatch at position: 1
- required type for x: int
- but expression 't.data[h].key' is of type: string
- proc `==`(x, y: int16): bool
- first type mismatch at position: 1
- required type for x: int16
- but expression 't.data[h].key' is of type: string
- proc `==`(x, y: int32): bool
- first type mismatch at position: 1
- required type for x: int32
- but expression 't.data[h].key' is of type: string
- proc `==`(x, y: int64): bool
- first type mismatch at position: 1
- required type for x: int64
- but expression 't.data[h].key' is of type: string
- proc `==`(x, y: int8): bool
- first type mismatch at position: 1
- required type for x: int8
- but expression 't.data[h].key' is of type: string
- proc `==`(x, y: pointer): bool
- first type mismatch at position: 1
- required type for x: pointer
- but expression 't.data[h].key' is of type: string
- proc `==`(x, y: string): bool
- first type mismatch at position: 2
- required type for y: string
- but expression 'key' is of type: NodeId[system.string, system.string]
- proc `==`(x, y: uint): bool
- first type mismatch at position: 1
- required type for x: uint
- but expression 't.data[h].key' is of type: string
- proc `==`(x, y: uint16): bool
- first type mismatch at position: 1
- required type for x: uint16
- but expression 't.data[h].key' is of type: string
- proc `==`(x, y: uint32): bool
- first type mismatch at position: 1
- required type for x: uint32
- but expression 't.data[h].key' is of type: string
- proc `==`(x, y: uint64): bool
- first type mismatch at position: 1
- required type for x: uint64
- but expression 't.data[h].key' is of type: string
- proc `==`(x, y: uint8): bool
- first type mismatch at position: 1
- required type for x: uint8
- but expression 't.data[h].key' is of type: string
- proc `==`(x1, x2: XmlNode): bool
- first type mismatch at position: 1
- required type for x1: XmlNode
- but expression 't.data[h].key' is of type: string
- proc `==`(x: string; y: type(nil) | type(nil)): bool
- first type mismatch at position: 2
- required type for y: typeof(nil) or typeof(nil)
- but expression 'key' is of type: NodeId[system.string, system.string]
- proc `==`(x: type(nil) | type(nil); y: string): bool
- first type mismatch at position: 1
- required type for x: typeof(nil) or typeof(nil)
- but expression 't.data[h].key' is of type: string
- proc `==`[A, B](tpl: (Option[A], Option[B]); tpl1: (A, B)): bool
- first type mismatch at position: 1
- required type for tpl: (Option[==.A], Option[==.B])
- but expression 't.data[h].key' is of type: string
- proc `==`[Enum: enum](x, y: Enum): bool
- first type mismatch at position: 1
- required type for x: Enum: enum
- but expression 't.data[h].key' is of type: string
- proc `==`[I, T](x, y: array[I, T]): bool
- first type mismatch at position: 1
- required type for x: array[I, T]
- but expression 't.data[h].key' is of type: string
- proc `==`[T: proc](x, y: T): bool
- first type mismatch at position: 1
- required type for x: T: proc
- but expression 't.data[h].key' is of type: string
- proc `==`[T: tuple | object](x, y: T): bool
- first type mismatch at position: 2
- required type for y: T: tuple or object
- but expression 'key' is of type: NodeId[system.string, system.string]
- proc `==`[T](opt: Option[T]; val: T): bool
- first type mismatch at position: 1
- required type for opt: Option[==.T]
- but expression 't.data[h].key' is of type: string
- proc `==`[T](x, y: openArray[T]): bool
- first type mismatch at position: 2
- required type for y: openArray[T]
- but expression 'key' is of type: NodeId[system.string, system.string]
- proc `==`[T](x, y: ptr T): bool
- first type mismatch at position: 1
- required type for x: ptr T
- but expression 't.data[h].key' is of type: string
- proc `==`[T](x, y: ref T): bool
- first type mismatch at position: 1
- required type for x: ref T
- but expression 't.data[h].key' is of type: string
- proc `==`[T](x, y: seq[T]): bool
- first type mismatch at position: 1
- required type for x: seq[T]
- but expression 't.data[h].key' is of type: string
- proc `==`[T](x, y: set[T]): bool
- first type mismatch at position: 1
- required type for x: set[T]
- but expression 't.data[h].key' is of type: string
- expression: t.data[h].key == key
- real 0m1.295s
- user 0m1.223s
- sys 0m0.069s
- ]#
Advertisement
Add Comment
Please, Sign In to add comment