I’ve noticed that whenever I use “parameters” or “parenthesized part” in my scripts, I always wonder why they are so long. An idea to replace “Parameter” with “Param” springs to mind, but I’m fairly sure you’d balk at that as the ‘plain english’ element is something you’re probably quite keen to keep in place. But I would hope you could see the benefit of adding a bit of clarity to the rather verbose relevance statments that tend to spring up quite frequently. Perhaps just something very terse like (AP “SysRoot”), where AP stands for ‘Action Parameter’ would be quite sleek. There are plenty of shortened forms of other commands, but they’re almost all linked with html capabilities.
Secondly, I wondered why the word “Parenthesized” even has to exist. As you dont say “Tuple item 0 of it”, you shouldn’t have to say “Parenthesized part 1 of it”. “Part” isn’t used on its own(afaik, having checked the current windows inspectors pdf) and should be available as a keyword in its own right.
Has there ever been any consideration of creating the inverse of concatenation, perhaps using the keyword ‘split’? I think it would be quite handy, as you could just return a tuple of the elements or refer to individual ‘items’ of it. This would save on having to do lengthy ‘preceding text of first “|” of it, preceding text of first “|” of following text of first “|” of it,…’ statements. But then again, I guess it’s also just another way to work around using a regex and dealing with all those parenthesized parts…
I appreciate the feedback but not quite sure how thats helpful (e.g. not sure what to do with the output)
If working with ‘lines of file “xxx”’, I most likely want to work with various pieces. As when used in Perl, splitting a string on a specific delimiter allows you to extract numbered entities or dump it into an array. The parenthesized part of a match from a regex is basically there, except for the cumbersome nature of then having to say ‘parenthesized part 1 of’ for every single element.
If you could explain a bit more of how to use substrings, as with an example of how to build a multiline file of only the 1st, 3rd and 8th elements from a delimited file (of a total of 15 elements in each line).
(item 0 of it &"|"& item 2 of it &"|"& item 7 of it) of split “|” of (lines of file “lotsa_letters.txt”)
What I would have to do now is something like:
(parenthesized part 0 of it &"|"& parenthesized part 2 of it &"|"& parenthesized part 7 of it) of parenthesized parts of matches (regex “^(.+)|(.+)|(.+)|(.+)|(.+)|(.+)|(.+)|(.+).*$”) of (lines of file “lotsa_letters.txt”)
(This is rather simplistic, as I often would want to do calculations/manipulations of the elements prior to writing them back out or using them elsewhere)
But which one would you want to read/modify in future?
I can see your perl experiences are definitely influencing you here
Here are some responses to your comments/questions:
As a language design goal go, we don’t usually rate shorthand expressions as a particularly important goal. The way we would like to tackle this kind of thing is to allow autocompletion in our editors so they will guess your expression for you and help with the syntax (I believe we are working on this).
Unordered lists are a primary way data is manipulated in Relevance… Tuples are another way to manipulate data and are sort of like an array, but they are relatively new and they are fixed length…
Our “split” operator (“substrings separated by”) effectively returns a list of the results and we don’t have “first element of list” operators (by design due to the fact that lists theoretically are unordered)… so your example is difficult because you can’t specific the index into the list… Another way to do it is to use ‘preceding text of first “|” of …’ , but that gets very ugly very fast…
Here is some Relevance shorthand for your expression (although note that your regex actually should be 'regex "^
^\
+|
^\
… '):
q: concatenation “|” of parenthesized parts (1;3;8) of matches (regex “^(.+)|(.+)|(.+)|(.+)|(.+)|(.+)|(.+)|(.+)|(.+)|(.+)$”) of "a|bb|ccc|dddd|eeeee|ffffff|ggggggg|hhhhhhhh|iiiiiiiii|jjj"
A: a|ccc|hhhhhhhh
Yes, that’s a suitable replacement (and that regex was off the cuff last night), but of course that is sliding slightly past my point of how ugly and awkward it would be to actually then juggle those ‘parts’ around.
I guess if you’re happy with the way it is, it’s going to be very tricky to change your or the other developers minds about this. I still think the word ‘parenthesized’ is a complete waste of space and I’m not sure why ‘split’ wouldn’t be worth consideration to implement, given how extremely useful it can be (just thinking back of the code I’ve written, split is probably one of the most generic regex actions I use).
I recently had a statment in which I specified 30 sets of parenthesis in a regex in order to get all my matches out of a comma delimited line and I certainly checked it more than twice in order to be sure I had the right number of them. I certainly wouldn’t like it if someone changed the delimited on me.
To me, Split (or subdivide or segment) seems like a natural, helpful inversion of the (concatenation “x”) keyword and I’d much rather write (parenthesized parts of split “,” of lines of file “x”), wouldn’t you?
There is a little-documented “tuple string item X” inspector you might be able to use. If you can coerce your string into being delimited by a comma-space character (and the space MUST be included), you can look at item X of it:
q: “Alpha|Bravo|Charlie|Delta”
A: Alpha|Bravo|Charlie|Delta
T: 0.016 ms
I: singular string
q: substrings separated by “|” of “Alpha|Bravo|Charlie|Delta”
A: Alpha
A: Bravo
A: Charlie
A: Delta
T: 0.077 ms
I: plural substring
q: concatenation ", " of substrings separated by “|” of “Alpha|Bravo|Charlie|Delta”
A: Alpha, Bravo, Charlie, Delta
T: 0.096 ms
I: singular string
q: tuple string item 2 of concatenation ", " of substrings separated by “|” of “Alpha|Bravo|Charlie|Delta”
A: Charlie
T: 0.109 ms
I: singular string
We are sensitive to this kind of thing. I’m going to file a bug for discussion to introduce “parts” or “groups” as an alias for “parenthesized parts” and “split” as an alias for “substrings separated by”. I really really can’t promise anything is going to come out of it though.
(if((name of operating system starts with “Win”) = True) then comments of local users else “N/A”) ; (if((name of operating system starts with “Win”) = True) then (if (account disabled flag of it =FALSE) then “enable” else “disable”) of local users else “N/A”) ; (if ((name of operating system starts with “Win”) = True) then ((month of it as two digits & “/” & day_of_month of it as two digits & “/” & year of it as string) of dates (local time zone) of (last logons of local users)) else “N/A” )