1. Grid in vlookup

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.

new topic     » topic index » view message » categorize

2. Re: Grid in vlookup

This has nothing to do with vlookup() or the structure of the data. The dollar sign is the end-of-list terminator.

4.1.1.1 Atoms and Sequences

docs said...

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

new topic     » goto parent     » topic index » view message » categorize

3. Re: Grid in vlookup

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.

new topic     » goto parent     » topic index » view message » categorize

4. Re: Grid in vlookup

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.

new topic     » goto parent     » topic index » view message » categorize

5. Re: Grid in vlookup

Thanks all,

Craig

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu