[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] [bug] Method Link>>at: inefficiency

From: Roman
Subject: [Help-smalltalk] [bug] Method Link>>at: inefficiency
Date: Thu, 30 Aug 2012 04:33:42 -0700

Issue status update for Post a follow up:

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 [
    index<1 ifFalse: [
       i := 1.
       self do: [:element| i=index ifTrue: [ ^element ]. i:=i+1 ]
    SystemExceptions.IndexOutOfRange signalOn: self withIndex: index

reply via email to

[Prev in Thread] Current Thread [Next in Thread]