+-- | Produce an array containing copies of a given element.
+replicatePD
+ :: CoreExpr -- ^ Number of copies in the resulting array.
+ -> CoreExpr -- ^ Value to replicate.
+ -> VM CoreExpr
+
+replicatePD len x
+ = liftM (`mkApps` [len,x])
+ $ paMethod replicatePDVar "replicatePD" (exprType x)
+
+
+-- | Select some elements from an array that correspond to a particular tag value
+--- and pack them into a new array.
+-- eg packByTagPD Int# [:23, 42, 95, 50, 27, 49:] 3 [:1, 2, 1, 2, 3, 2:] 2
+-- ==> [:42, 50, 49:]
+--
+packByTagPD
+ :: Type -- ^ Element type.
+ -> CoreExpr -- ^ Source array.
+ -> CoreExpr -- ^ Length of resulting array.
+ -> CoreExpr -- ^ Tag values of elements in source array.
+ -> CoreExpr -- ^ The tag value for the elements to select.
+ -> VM CoreExpr
+