1. Grid in vlookup
- Posted by CraigWelch Mar 18, 2019
- 931 views
In the manual for vlookup at https://openeuphoria.org/docs/std_search.html#_2518_lookup, we see an example of a grid.
grid = { {"ant", "spider", "mortein"}, {"bear", "seal", "gun"}, {"cat", "dog", "ranger"}, $ }
What is the purpose of "$" on the last line? It is not described; and it doesn't seem to make any difference if it's there or not.
2. Re: Grid in vlookup
- Posted by ghaberek (admin) Mar 18, 2019
- 935 views
This has nothing to do with vlookup() or the structure of the data. The dollar sign is the end-of-list terminator.
All sequences can include a special end of sequence marker which is the $ character. This is for convience of editing lists that may change often as development proceeds.
sequence seq_1 = { 10, 20, 30, $ } sequence seq_2 = { 10, 20, 30 } equal(seq_1, seq_2) -- TRUE
-Greg
3. Re: Grid in vlookup
- Posted by irv Mar 18, 2019
- 915 views
- Last edited Mar 19, 2019
You may be able to see the utility of the $ when your data is entered like this:
constant fruits = {--name,unit,price, tooltip; {"Apples", "doz", 3.50, "Mackintosh"}, {"Cherries", "lb", 2.69, "Bing"}, {"Dates", "lb", 6.99, "Medjool"}, {"Limes", "ea", .59, "Key"}, {"Oranges", "ea", .79, "Valencia"}, {"Bananas", "lb", .89, "Dole"}, $}
Without that $, the last entry would be
{"Bananas", "lb", .89, "Dole"}}
Requiring you to go back, insert a comma, lf, then add another entry. Just a convenience. More often, it helps when you need to comment out the last entry. If written as directly above, commenting out Bananas would result in an error, since the closing } for the fruits would not be there.
4. Re: Grid in vlookup
- Posted by petelomax Mar 18, 2019
- 916 views
FYI, I made this redundant in Phix:
?{1,2,3} ?{1,2,3,} -- same (removed the error) ?{1,2,3,$} -- same (for compatibility)
As said above, it makes commenting lines within a sequence in/out far less irksome.