From: Theodore H. <tw...@do...> - 2000-04-22 14:10:43
|
A few more items on the wish list: 1. expand() would be more useful if it returned empty strings between token delimiters; that is, expand("twh1:*::::/homes/twh1:/bin/tcsh", ":") would be ["twh1", "*", "", "", "", "/homes/twh1", "/bin/tcsh"] and expand("/var/tmp", "/") would be ["", "var", "tmp"]. This has a number of advantages: - you could use it to parse delimited records like those in /etc/passwd (currently you can't detect blank fields), or to distinguish relative and absolute paths - you can use expand(s,"") to iterate over characters, instead of doing a bunch of ascii's and charof's (which I end up doing a lot) - we would have the identity: collapse(expand(s,c),c) == s (if c contains one character) - if you need the old behavior, you can always simulate it with: expand(s,d) reject "" 2. It would be convenient if front(L,N) returned [] when N < 0, analogously to tail(L,N) when N > listlen(L). For example, front(L,listlen(L)-1) could be used to unconditionally drop the last element from a list if it exists. Similarly, tail(L,N) could return L when N < 0. This would give rise to the identity: tail(L,N) == reverse(front((reverse(L), listlen(L)-N)) and front(L,N) == reverse(tail((reverse(L), listlen(L)-N)). 3. It would be really helpful to have some means of commenting out a large block of code, like #ifdef DEBUG ... #endif. theo |