What happened to this site? And what's that frog about?

Row count check for pair operation

F139 - Failure Feedback Forum 

Status: resolved Severity: minor Category: Vlerq Ratcl Created: 2007-02-09 Updated: 2007-02-10

The following crashes for me:

 view a def {1 2 3 4} | pair [view b def {1 2}] | get

Having this caught as an error would be helpful.

Summary

Thanks for catching this. I've however fixed it slightly differently: the result size gets adjusted to the minimum size of the input views.

You can therefore now also do things like "view $v pair 3", as alternative for the "first" vop.



2007-02-09 btheado

Imported

2007-02-10 jcw

The reason this failed is interesting, in a way: the "pair" operator is very different from all other operators, in that it constructs a view which does not add an extra layer of indirection (making it very efficient). Views are internally collections of columns: "pair" basically concatenates its two input collections into a new one. When the input views have different row counts, that caused the result to be a mix of different column sizes, which leads to all sorts of bad things. I now check view sizes, and apply the "first" operator on either side to end up with properly matched columns if necessary. Several tests added to verify all cases.

(it's not as easy to throw an error at this point, the "minimum of both" semantics were easier to implement)

2007-02-10 btheado

Thanks for the fix. I like your solution of adjusting the size.

Add a comment:

Tip: add empty lines between paragraphs and indent lines to prevent reformatting.

Your name or initials:  

Powered by Mavrig