fundamentals capstone 3.2

I am having issues finding what my error is with this code:

 

{[tab]
tab: update exQuality: $[side=B & price \<= ask; 1b; side=S & price >= bid; 1b; 0b] from tab
}

 

I get a mismatched types error…but when I do a meta on the tab I get:

c t f a
price j
side s
bid j
ask j

 

so I am not sure where that mistype is coming from. Any help would be greatly appreciated. 

 

Thanks

First, remember that the operations are executed from right to left. For example side=B &amp; price &lt;= ask</font> is equivalent to&nbsp;<font face='"courier' new>side=(B & (price <= ask)). So you are trying to do an AND between a boolean and a symbol which leads to a type error. You should use parentheses e.g. around side=`B if you want that to be executed first.

Second, the $ conditional takes a single value, not a vector. There is a vector conditional operation that works on vectors instead.

Third, you can take advantage of operators such as <= >= & being atomic. You shouldn’t need to use any kind of conditional - in general the pattern $[x;1b;0b] (or the vector version ?[x;1b;0b]) can be replaced by just x, and the two branches that return true can be joined together with an or instead.

Thanks!! That helped a tonne!!