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
[email protected]
https://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to