7 added 19 characters in body
source | link
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] := ...
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 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] := ...
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] := ...
6 added 234 characters in body
source | link
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 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] := ...
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 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] := ...
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 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] := ...
5 added 52 characters in body
source | link
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 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] := ...
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 you can do something like:

 Convert[dateQuantityList_, datePriceList_] /; 
 VectorQ[Map[DateListQ, dateQuantityList[[All, 1]], {1}], TrueQ] &&
 VectorQ[Map[DateListQ, datePriceList[[All, 1]], {1}], TrueQ] := ...
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 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] := ...
4 added 227 characters in body
source | link
3 added 227 characters in body
source | link
2 added 321 characters in body
source | link
1
source | link