1st is the way to verify that two lists contain the same set of values (when order does not matter). There's a dozen of ways to do it via basic api, for example:
I added a Str.chars method, that seems generally useful.
Regarding list comparisons that is really because we are lacking true set functionality. I had an proposal to add an List.isSet mode via `http://fantom.org/sidewalk/topic/884`. I still think we probably want something like that eventually maybe in 1.1, so I don't want to add anything that would conflict with those enhancements.
qualidafialTue 6 Jul 2010
Can we also get a Str.fromChars(Int[])? I found myself needing that last night.
Edit: clarify method signature
brianWed 7 Jul 2010
I was thinking that myself if we should have that if we are going to have Str.chars
ivan Tue 6 Jul 2010
I found that I miss several things in sys api.
1st is the way to verify that two lists contain the same set of values (when order does not matter). There's a dozen of ways to do it via basic api, for example:
but I think a single method can be useful.
Also, list equality with type checks is a constant pain:
fansh> [1,2,3].map { it.toStr } == ["1","2","3"] false fansh> [1,2,3].map |Int i->Str| { i.toStr } == ["1","2","3"] true fansh> Str[] s := [1,2,3].map { it.toStr } [1, 2, 3] fansh> s.typeof sys::Obj?[]And the last minor note - it would be great to have either sys::Str.map or sys::Str.toChars
brian Tue 6 Jul 2010
I added a
Str.charsmethod, that seems generally useful.Regarding list comparisons that is really because we are lacking true set functionality. I had an proposal to add an
List.isSetmode via `http://fantom.org/sidewalk/topic/884`. I still think we probably want something like that eventually maybe in 1.1, so I don't want to add anything that would conflict with those enhancements.qualidafial Tue 6 Jul 2010
Can we also get a
Str.fromChars(Int[])? I found myself needing that last night.Edit: clarify method signature
brian Wed 7 Jul 2010
I was thinking that myself if we should have that if we are going to have Str.chars
I added
Str.fromChars