Skip to content

Applying mixins in ln for generator #1103

Answered by HT154
sergeyshevch asked this question in Q&A
Discussion options

You must be logged in to vote

If I'm interpreting your question correctly, it seems like you're trying to iteratively apply multiple mixins to the same base value in a specific order. If that is the case, I think what you want to use here is fold:

services = import*("configs/*.pkl").toMap().map((name, service) -> Pair(
  name,
  service.groups.fold(service.service, (acc, groupName) ->
    acc |> groupConfigs["groups/" + groupName + ".pkl"].service
  )
))

If this isn't what you're going for, can you clarify a little more what your desired output is here?

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@sergeyshevch
Comment options

Answer selected by sergeyshevch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants