[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
lookup(): "i" option?
From: |
Olaf Till |
Subject: |
lookup(): "i" option? |
Date: |
Thu, 21 Oct 2010 12:02:43 +0200 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
Hi,
a problem occured in optimset.m, optimget.m, __all_opts__.m, which
seemed due to the usage of lookup(..., ..., "i"). A description of the
problem and a suggested fix are already on the bug-tracker, but I
thought the issue with lookup(..., ..., "i") should also be discussed
here.
I would suggest that the "i" option of lookup() should be dropped,
since lookup() requires a sorted table, while case-insensitivity makes
the sorting-criteria undefined.
An illustration of the problem:
## tbl is sorted with respect for normal lookup
octave:1> tbl = {"Ab", "aa", "c"};
octave:2> lookup (tbl, "aa")
ans = 2
## for case-insensitive lookup, tbl is not correctly sorted
octave:3> lookup (tbl, "aa", "i")
ans = 0
octave:4>
lookup(,, "i") internally converts to uppercase, so one could supply a
table correctly sorted in uppercase; but this solution is only valid
as long as lookup() indeed internally converts to
uppercase. Essentially, the correct sort order is just undefined when
case-insensitivity is used.
Olaf
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- lookup(): "i" option?,
Olaf Till <=