dockimbel on master
FIX: issue #4269 ([Crash, View]… (compare)
-are present before a number, it would be "skip"
lit-paren!is a fine name, as a parallel to
lit-path!, but we have to draw a line somewhere. e.g. what would a
get-paren!mean? But since we already have a value that represents what you want, why not use that? Of course, this is all part of exploring and balancing the core language and what it lets you create. Constraints can be very helpful. e.g., you're using path notation, but if you described your dialect, what are the key elements and actions?
Constraints can be very helpful. e.g., you're using path notation, but if you described your dialect, what are the key elements and actions?
Are you telling me to take into considration the key elements of my ideas when I think about path dialects or are you asking me to write them down here?
@greggirwin I have read again my last year's notes and your replies. You are right, many things have to be considered but I now think parens are not a good solution. The current working must be maintained, we should just change the path segment operation to skip using some symbol and maintain the current mechanism. Let's made the hypothesis we choose
This skips 2 positions on the right
This skips 4 positions on the left
as before but gets the gets the number from :value
as before but gets the gets the number from the resulting of (code)
But we can just go further.
Paths navigate through series and we have another great Red tool to navigate through them: PARSE! Why don't we use it?
Please take a look at this path:
word/<:[skip 2 thru 'section-start <:]/word
If a path segment has
<: then the current path series position is passed to PARSE and the block is its RULES argument. While parsing, each time you encounter
<: the path current series position is changed to the parse one. If parse fails, the path fails and it returns
(Conceptually this last solution seems so easy and straightforward)
I like both ideas but second one is even more powerful and implementable reusing 99% of the code we have in Red.
[Id <object> "section2" id 33]parts and similar names, let you express the elements after object in one path selection, without using blocks and reusing the same words:
word/>>3/idreturns 33. Excessive nesting is sometime also a problem and not all structures are better when nested, sometime they are better when expressed linearly...
>>) The last usage I forgot to write is the SKIP to value or datatype. Let's take the first example and extend it
[Id word word <object> data data id 33]the first part, as before, ends in
object. With TO shifting you can have variable data length on the first segment of data and in the second just with
word/>>object!/>>id. With this syntax a full horizontal navigation is possible in just one line.
findexpressed in one efficient and compact path.
struct!datatype, which would be more memory friendly than
block!and would provide named accessors to all values.
[1 2 3 4 5 6 7 8 9]vs
[[1 2 3] [4 5 6] [7 8 9]]. Nesting, and keys vs positional values, add overhead, but also information. There is no single solution that it best in every case, so it will be interesting to see what comes of your work.