[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
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
]
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Help-smalltalk] [bug] Method Link>>at: inefficiency,
Roman <=