There are few commands (lists) which make tcl very flexible to use. I was hoping if some of them already exist in custom skill or some one can write those commands in skill. those tcl commands I want in skill are...
lrange list i j Returns the i th through j th elements from list.
linsert list index arg arg .. Insert elements into list before the element at position index. Returns a new list.
lreplace list i j arg arg ... Replace elements i through j of list with the args. Returns a new list.
lsearch mode list value Return the index of the element in list that matches the value according to the mode, which is -exact, -glob, or -regexp. -glob is the default. Return -1 if not found.
lsort switches list Sort elements of the list according to the switches: -ascii, -integer, -real, -increasing, -decreasing, -command command. Returns a new list.
Hope some one can tell me if there are any skill equivalent of the above or any functions that can be written.
In fact, given that SKILL is really a LISP variant, support for lists is _much_ greater than in Tcl. That said, some of the Tcl commands are effectively treating a list as an array, which is not a good way to use them in SKILL (since lists are truly sequential).Rather than me trying to give you equivalents of the above (there aren't quite direct replacements for lrange, linsert, lreplace; lsearch is either member() or exists(); lsort is sort() with particular arguments), best is to read the SKILL User Guide and think about how you're manipulating lists. If you're doing a lot of list ranging and splicing, then that's not going to be so efficient to do in SKILL - there would almost certainly be better ways of doing this - or to use different structures.Regards,Andrew.
I agree with what Andrew said.In addition, SKILL has the capability to "modify" a list, which TCL does not: the reason the functions above "return a new list" is because TCL cannot modify the existing list.So, for example, would you want an linsert that inserts into the current list, which could be done efficiently, or one that has to make a copy of the original list, which would be inefficient?It depends on exactly what you are trying to do.