Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /trunk/src/compiler/ast/type-util.sml
ViewVC logotype

Diff of /trunk/src/compiler/ast/type-util.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 398, Thu Oct 14 20:08:18 2010 UTC revision 399, Thu Oct 14 20:08:35 2010 UTC
# Line 11  Line 11 
11     *)     *)
12      val mkTensorTy : int -> Types.ty      val mkTensorTy : int -> Types.ty
13    
14      (* function to compute the slice of a tensor type based on a boolean
15       * mask.  The value true in the mask means that the corresponding
16       * dimension is being indexed, while false means that it is being
17       * copied.
18       *)
19        val slice : Types.ty * bool list -> Types.ty
20    
21    (* returns true if the type is a value type (bool, int, string, or tensor) *)    (* returns true if the type is a value type (bool, int, string, or tensor) *)
22      val isValueType : Types.ty -> bool      val isValueType : Types.ty -> bool
23    
# Line 207  Line 214 
214                  end                  end
215            (* end case *))            (* end case *))
216    
217        fun slice (Ty.T_Tensor(Ty.Shape l), mask) = let
218              fun f (d, true, dd) = dd
219                | f (d, false, dd) = d::dd
220              in
221                Ty.T_Tensor(Ty.Shape(ListPair.foldr f [] (l, mask)))
222              end
223          | slice (ty, _) = raise Fail(concat["slice(", toString ty, ", _)"])
224    
225    end    end

Legend:
Removed from v.398  
changed lines
  Added in v.399

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0