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