Ticket UUID: | 693836 | |||
Title: | TIP#127 implementation | |||
Type: | Support | Version: | None | |
Submitter: | mic42 | Created on: | 2003-02-26 18:53:18 | |
Subsystem: | None | Assigned To: | dkf | |
Priority: | 9 Immediate | Severity: | ||
Status: | Closed | Last Modified: | 2009-07-29 19:40:09 | |
Resolution: | Closed By: | dkf | ||
Closed on: | 2003-10-14 13:39:58 | |||
Description: |
This patch adds a -index option like the one from lsort to lsearch. Its diff'ed -u against the current HEAD (rev 1.45) | |||
User Comments: |
dkf added on 2009-07-29 19:40:09:
IP - Comment Removed: 130.88.1.31 dkf added on 2008-11-02 18:26:31: data_type - 210894 dkf added on 2003-10-15 05:49:49: Logged In: YES user_id=79902 That issue is being tracked in Bug 823768 dgp added on 2003-10-15 05:43:18: Logged In: YES user_id=80530 Note this implementation causes new segfaults. Test cmdIL-5.5 demos this. Probably good learning opportunities here for how apparently good code can be subtly wrong. dkf added on 2003-10-14 20:39:58: Logged In: YES user_id=79902 Applied to HEAD. The documentation is perhaps a touch sparse, but that can be the subject of future bug reports if I've omitted something crucial. :^) dkf added on 2003-10-13 15:27:44: Logged In: YES user_id=79902 Thanks. I'll try to get this in when I can. mic42 added on 2003-10-13 01:54:33: Logged In: YES user_id=302287 Ok, hopefully i have done the diff'ing the right way this time. I added a basic testsuite, i wouldn't say its really complete, there should probably be more checks. (as the multiindex code is shared between lsort and lsearch there are more tests in lsearch that test it). Whats missing: more combinations of options (-inline...) Really good tests for error handling of the index code (should have copied some things from the lset and lindex tests..., as the code is copied from lindex...), some basic ones are there. A patch to the documentation. mic42 added on 2003-10-13 01:47:53: File Added - 64145: CmdIL.test.diff mic42 added on 2003-10-13 01:47:20: File Deleted - 43786: File Added - 64144: lsearch.test.diff mic42 added on 2003-10-13 01:46:30: File Added - 64143: tclCmdIL.c.diff dkf added on 2003-10-01 19:22:37: Logged In: YES user_id=79902 Reminder: still waiting the tests (or at least enough of them that I can double-check that the behaviour specified in the TIP is actually implemented) mic42 added on 2003-09-13 22:24:37: Logged In: YES user_id=302287 Sorry for the reversed patch. Should do better this time. Shall i diff against current HEAD? As the patch changes things to lsearch and lsort tests for both will be needed. I have the ones for simple syntax checks (where the error messages are checked) done, as those are trivial. Just a bit busy this week (local conference), so expect something by the end of the week/next weekend. Michael dkf added on 2003-09-13 08:08:41: File Deleted - 43783: Logged In: YES user_id=79902 Could you be a real star and produce: * a forward patch (the one you've done is reversed!) * some tests (via a patch to lsearch.test of course) While I could reverse the patch, synthesizing tests is a bit awkward as I don't understand (especially at 2am!) the nuances of what cases should be tested and how. (You could use some of the examples from the TIP as the basis...) If there are a few tests in there (so we can check that it is doing what we think it ought to be doing) I'd be happy to get this code into the core. mic42 added on 2003-03-01 23:10:28: File Added - 43786: tclCmdIL.c.diff Logged In: YES user_id=302287 I made a new patch, further enhancing lsearch (and lsort as a side effect). The new patch does the following: add two new options to lsearch: -index index -subindices -subindices is mutually exclusive with -inline and may only be specified if -index is specified. ----- ?-index index? Takes an index in the form used by lindex or lset, a list of indices is allowed to search or sort based on the values in nested sublists. ?-subindices? Returns indices one can use directly in [lset] or [lindex] to access the sublist element found. ---- mic42 added on 2003-03-01 21:28:21: File Added - 43783: tclCmdIL.c.diff Logged In: YES user_id=302287 Forgot to attach the patch. |