232 |
end |
end |
233 |
val indices' = List.map checkIndex indices |
val indices' = List.map checkIndex indices |
234 |
val order = List.length indices' |
val order = List.length indices' |
235 |
|
val expectedTy = TU.mkTensorTy order |
236 |
|
val resultTy = TU.slice(expectedTy, List.map Option.isSome indices') |
237 |
in |
in |
238 |
if U.matchType(ty, TU.mkTensorTy order) |
if U.matchType(ty, expectedTy) |
239 |
then () |
then () |
240 |
else err (cxt, [ |
else err (cxt, [ |
241 |
S "type error in slice operation\n", |
S "type error in slice operation\n", |
242 |
S " expected: ", S(Int.toString order), S "-order tensor\n", |
S " expected: ", S(Int.toString order), S "-order tensor\n", |
243 |
S " but found: ", TY ty, S "\n" |
S " but found: ", TY ty, S "\n" |
244 |
]); |
]); |
245 |
(* need to determine the new tensor type by copying dimensions that have ":" |
(AST.E_Slice(e', indices', resultTy), resultTy) |
|
* indices and removing dimensions that have integer indices. |
|
|
*) |
|
|
(* FIXME *)raise Fail "unimplemented" |
|
246 |
end |
end |
247 |
| PT.E_Tuple args => let |
| PT.E_Tuple args => let |
248 |
val (args, tys) = checkExprList (env, cxt, args) |
val (args, tys) = checkExprList (env, cxt, args) |