I'm having a little trouble with Map.addList. I have a method like
someFunc(List list)
{
m := Str:Obj?[:]
m.addList(list) |Obj? v, Int i->Str:Obj?| { return [i.toStr:v] }
}
It seems like that all lines up, but I'm getting the following compile time error: Invalid args addList(sys::Obj?[], |sys::Obj?,sys::Int->sys::Str|?), not (sys::Obj?[], |sys::Obj?,sys::Int->[sys::Str:sys::Obj?]|)
If I change the Map declaration to m := [:] instead, it compiles fine. Any pointers? Thanks!
KevinKelleySun 27 Dec 2009
Looks like Map.addList wants a function that returns the key for a value, not returns a K:V pair. Instead of
m.addList(list) |Obj? v, Int i->Str:Obj?| { return [i.toStr:v] }
Try
m.addList(list) |Obj? v, Int i->Str| { return i.toStr }
liamstaskSun 27 Dec 2009
Yikes - that was a lame one :) As usual, works as advertised - thanks!
liamstask Sun 27 Dec 2009
I'm having a little trouble with Map.addList. I have a method like
It seems like that all lines up, but I'm getting the following compile time error:
Invalid args addList(sys::Obj?[], |sys::Obj?,sys::Int->sys::Str|?), not (sys::Obj?[], |sys::Obj?,sys::Int->[sys::Str:sys::Obj?]|)
If I change the Map declaration to
m := [:]
instead, it compiles fine. Any pointers? Thanks!KevinKelley Sun 27 Dec 2009
Looks like Map.addList wants a function that returns the key for a value, not returns a K:V pair. Instead of
Try
liamstask Sun 27 Dec 2009
Yikes - that was a lame one :) As usual, works as advertised - thanks!