-- GeNeRaTeD fOr: ../../CBS/Funcons/Computations/Control flow/Normal/Iterating/Definite/Mapping collections/vector-map.aterm {-# LANGUAGE OverloadedStrings #-} module Funcons.Core.Computations.ControlFlow.Normal.Iterating.Definite.MappingCollections.VectorMap where import Funcons.EDSL entities = [] types = typeEnvFromList [] funcons = libFromList [("vector-map",PartiallyStrictFuncon [NonStrict,Strict] stepVector_map)] -- | -- /vector-map(F,V)/ maps the computation /F/ over the vector /V/ , -- from left to right, evaluating /F/ for each given value in /V/ . vector_map_ fargs = FApp "vector-map" (FTuple fargs) stepVector_map fargs@[arg1,arg2] = evalRules [rewrite1] [] where rewrite1 = do let env = emptyEnv env <- fsMatch fargs [PMetaVar "F",PAnnotated (PMetaVar "Vec") (TName "values")] env rewriteTermTo (TApp "list-to-vector" (TTuple [TApp "list-map" (TTuple [TVar "F",TApp "vector-to-list" (TTuple [TVar "Vec"])])])) env stepVector_map fargs = sortErr (FApp "vector-map" (FTuple fargs)) "invalid number of arguments"