Convert[quantities_, prices_] /; Length[quantities] == Length[prices] := ...
Since DateList
returns a list of Length
6
and the first five elements have Head
Integer
while the last has Head
Real
you can write your own DateListQ
. Here is a head start:
DateListQ[lis_List] := Length[lis] == 6 && VectorQ[Most[lis], IntegerQ] &&
Head[Last[lis]] == Real
But note that this is an example and if you're inputting your DateList
by hand and the last element is also an Integer
then you can simply use:
DateListQ[lis_List] := Length[lis] == 6 && VectorQ[lis, IntegerQ]
Now for your second case, you can do something like:
Convert[dateQuantityList_, datePriceList_] /; Length[dateQuantityList] == Length[datePriceList] &&
VectorQ[Map[DateListQ, dateQuantityList[[All, 1]], {1}], TrueQ] &&
VectorQ[Map[DateListQ, datePriceList[[All, 1]], {1}], TrueQ] := ...
OR more elegantly:
Convert[dateQuantityList_, datePriceList_] /; Length[dateQuantityList] == Length[datePriceList] &&
VectorQ[dateQuantityList[[All,1]], DateListQ] && VectorQ[datePriceList[[All,1]], DateListQ] := ...