Zdenek Sekera wrote:

> This is formatted as a script that you can cut & run.
> The -> indicates the output of the 'echo' command.
> Ignore comments at the beginning of the line, they are there
> only to prevent useless errors.
> 
> -------------- [script start] ----
> let a = [[1,2], [3,4]]
> echo a
> " -> [[1,2], [3,4]]
> "  This works
> 
> echo "list a=".a
> " E730: using List as a String
> " E15: Invalid expression: "list a=".a
> "  So no conversion list->string is done here
> 
> echo "list a="a
> " -> list a= [[1,2], [3,4]]
> "  This works, but why? Isn't this also concatenation of two strings?
> " Note: it adds a blank after '=' sign, why?

This is not concatenation, this is listing a string and a list
separately.


> " This gets more obscure as you go on IMHO:
> let c=a[1]
> echo c
> " -> [3,4]
> "  That's OK
> 
> echo "list c=".c
> " -> I get the same error, not surprising
> " -> E730: using List as a String
> " -> E15: Invalid expression: "list c=".c
> 
> echo "list c="c a[0]
> " -> list c= [3,4] [1,2]
> "  This also works, seems to me also a mixture of string and list
> "  so it shouldn't work, or is it correct?

Each item is echo'ed separately, that works.

> let d=c[0]
> echo d
> " -> 3
> "  Correct
> 
> echo "list d=".d
> " -> list d=3
> "  So here it works? 'd' is suddenly considered a string?
> "  While it was obtained from the list?
> 
> echo "list d="d
> " -> list d= 3
> "  That works, too, with additional blank after '='
> ----------------------- [script end] -----------
> 
> The last two cases are confusing the whole issue.
> So when a string and a list can be mixed, when not,
> what are the rules, or are some of the above bugs?

It's a difference between concatenation with "." and listing two
separate things.

You can use string() to convert a list to a string before concatenating
it to another string.

-- 
How To Keep A Healthy Level Of Insanity:
18. When leaving the zoo, start running towards the parking lot,
    yelling "run for your lives, they're loose!!"

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

Reply via email to