[bug] Method Link>>at: inefficiency

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[bug] Method Link>>at: inefficiency

Roman
Issue status update for
http://smalltalk.gnu.org/node/652
Post a follow up:
http://smalltalk.gnu.org/project/comments/add/652

 Project:      GNU Smalltalk
 Version:      <none>
 Component:    Base classes
 Category:     bug reports
 Priority:     normal
 Assigned to:  Unassigned
 Reported by:  Roman
 Updated by:   Roman
 Status:       active

Not a bug, but inefficiency. Method Link>>at: for negative indexes scans
the entire list. My solution is:

  at: index [
     |i|
     index<1 ifFalse: [
        i := 1.
        self do: [:element| i=index ifTrue: [ ^element ]. i:=i+1 ]
     ].
     SystemExceptions.IndexOutOfRange signalOn: self withIndex: index
  ]



_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: [bug] Method Link>>at: inefficiency

Paolo Bonzini-3
Issue status update for
http://smalltalk.gnu.org/project/issue/652
Post a follow up:
http://smalltalk.gnu.org/project/comments/add/652

 Project:      GNU Smalltalk
 Version:      <none>
 Component:    Base classes
 Category:     bug reports
 Priority:     normal
 Assigned to:  Unassigned
 Reported by:  Roman
 Updated by:   bonzinip
-Status:       active
+Status:       fixed

Applied at last, thanks.



_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk