sort: Can't freeze object

If you have found a bug and would like to report it, it's here...

sort: Can't freeze object

Postby Bill » 08 Feb 2016 22:31

Code: Select all
>seq(5) groupBy(#isOdd)
ok
>.s
[1] (ListBuffer) [[1, [1, 3, 5]], [0, [2, 4]]]
ok
>sort
[stdin:1:4] Exception : Can't freeze object
ok
>[[1, [1, 3, 5]], [0, [2, 4]]] asListBuffer sort .
[[0, [2, 4]], [1, [1, 3, 5]]] ok
Bill
 
Posts: 5
Joined: 14 Sep 2015 03:38

Re: sort: Can't freeze object

Postby Franck » 08 Feb 2016 23:12

Hi,

Yes, there is still a bug into groupBy...
I'm beginning to wonder if this method is a good idea :)

Will fix it in the next version.

Thank you Bill,
Franck

PS : If you want to check before, here the fixed (I hope) version. You can replace the old one into ListBuffer.of file (or change its name).

Code: Select all
Object method: groupBy(r) -- aList
| o key l |
   ListBuffer new
   self forEach: o [
      dup valueAt( o r perform dup ->key ) ->l
      l ifNull: [
         ListBuffer new key over add ListBuffer new dup ->l over add
         over add
         ]
      o l add
      ]
   map(#[ dup first swap second dup freeze Pair new ])
;
Franck
 
Posts: 140
Joined: 29 Oct 2014 19:01

Re: sort: Can't freeze object

Postby Bill » 09 Feb 2016 14:31

Bugs are inevitable. Don't feel bad.

Thanks for the fix.
Bill
 
Posts: 5
Joined: 14 Sep 2015 03:38


Return to Report a bug

Who is online

Users browsing this forum: No registered users and 1 guest

cron