diff --git a/elm.json b/elm.json index 415738f..88f17b0 100644 --- a/elm.json +++ b/elm.json @@ -3,7 +3,7 @@ "name": "linsyking/messenger-core", "summary": "Core library for Messenger.", "license": "BSD-3-Clause", - "version": "4.0.1", + "version": "4.1.0", "exposed-modules": { "Definitions": [ "Messenger.Recursion", diff --git a/src/Messenger/RecursionArray.elm b/src/Messenger/RecursionArray.elm index f8b0139..6e8d684 100644 --- a/src/Messenger/RecursionArray.elm +++ b/src/Messenger/RecursionArray.elm @@ -1,5 +1,5 @@ module Messenger.RecursionArray exposing - ( updateObjects + ( updateObjects, updateObjectsWithTarget , getObjectIndices, getObjectIndex, getObjects, getObject, updateObjectByIndex, updateObjectsByTarget ) @@ -10,7 +10,7 @@ module Messenger.RecursionArray exposing Array implementation for the recursion algorithm -@docs updateObjects +@docs updateObjects, updateObjectsWithTarget ## Tools @@ -35,6 +35,13 @@ updateObjects rec env msg objs = updateRemain rec newEnv ( newMsgUnfinished, newMsgFinished ) newObjs +{-| Recursively update all the objects in the Array, but also uses target +-} +updateObjectsWithTarget : RecBody a b c d -> c -> List ( d, b ) -> Array a -> ( Array a, List b, c ) +updateObjectsWithTarget rec env msgs objs = + updateRemain rec env ( msgs, [] ) objs + + -- Below are all helper functions diff --git a/src/Messenger/RecursionList.elm b/src/Messenger/RecursionList.elm index cfef4af..a5f1dfd 100644 --- a/src/Messenger/RecursionList.elm +++ b/src/Messenger/RecursionList.elm @@ -1,5 +1,5 @@ module Messenger.RecursionList exposing - ( updateObjects + ( updateObjects, updateObjectsWithTarget , getObjectByIndex, getObjectIndices, getObjectIndex, getObjects, getObject, updateObjectByIndex, updateObjectsByTarget ) @@ -10,7 +10,7 @@ module Messenger.RecursionList exposing List implementation for the recursion algorithm -@docs updateObjects +@docs updateObjects, updateObjectsWithTarget ## Tools @@ -34,6 +34,13 @@ updateObjects rec env msg objs = updateRemain rec newEnv ( newMsgUnfinished, newMsgFinished ) newObjs +{-| Recursively update all the objects in the List, but also uses target +-} +updateObjectsWithTarget : RecBody a b c d -> c -> List ( d, b ) -> List a -> ( List a, List b, c ) +updateObjectsWithTarget rec env msgs objs = + updateRemain rec env ( msgs, [] ) objs + + -- Below are all helper functions