[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Extended Syntax Conditionals - Wish list
From: |
Michael S . Zick |
Subject: |
Extended Syntax Conditionals - Wish list |
Date: |
Wed, 1 Oct 2003 11:37:36 -0500 |
These items are extracted from an earlier bug report.
Additional constructs added here.
All are Wish-List items, not bugs.
Subscript (sparse) array operations -
${#SparseArray[At-Sign]#*} : Shortest prefix extended to
First-Subscript-Of
${#SparseArray[At-Sign]%*} : Shortest suffix extended to Last-Subscript-Of
Or, more general -
Extended all ${Array[At-Sign] ... } conditionals to include the form:
${#Array[At-Sign] ... } with the result being the subscript field rather
than the element field.
Make the Glob-Fragments and Subscript accessiable to invoked
function in the general For-Each construct:
${Array[At-Sign]//*/ $(function_name Selected-Fragments) }
Suggest that the '//*/' fragments be specified using the same
syntax as specifing parameters (with these fixed meanings):
$# - subscript of current cell
$1 - full element of current cell
For non-AnyMatch glob-pattern:
$2 - Prefix fragment
$3 - Matched fragment
$4 - Suffix fragment
Allows function invocation with selected components::
${Array[At-Sign] \ # For-Each item on the linked list
//*abc*/ \ # Any glob-pattern
$( function ${3} ${#} ) \ # Result-Of: function Matched-Fragment Subscript
} \ # end conditional and scope of the ${Co-Opted Syntax} constructs.
On a single line (at least before the e-mail filter gets it)...
${Array[At-Sign]//*abc*/$(function ${3} ${#})}
Note that above works - except for being able to access the fragments
and the subscript.
Extend the Print-Quoted format to include the subscript of the array
(code currently only quotes the element) in:
printf %q Array[At-Sign]
outputs the: '[subscript=]element' format so that subscript sparse
arrays may be input/output/assigned/passed.
Extend the assignment syntax to allow append of arrays consitant
with assignment of strings.
new_var=$var1$var2 : new_var is the appended two strings
new_array=${array[At-Sign]} : new_array is old array
Extension:
new_array=${array1[At-Sign]}${array2[At-Sign]}
Currently that converts to a string containing all elements
of both arrays without seperation between the two sources
by ${IFS:0:1}
I.E: Just a copy of: append_tail (first, second) with the second
being walked to adjust subscripts.
Note: list_length != subscript_range; either or both arrays may
be subscript sparse.
Mike
$2 -
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Extended Syntax Conditionals - Wish list,
Michael S . Zick <=