-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dict now have a `map()` method that return a list of values from a given list of keys.
- Loading branch information
Showing
4 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
## New `map()` method on dict | ||
|
||
Dict now have a `map()` method that return a list of values from a given | ||
list of keys. | ||
|
||
It allows to keep objects in a dict, and to select needed objects from a list | ||
of keys. For example: | ||
|
||
``` | ||
dependencies = { | ||
'a': dependency('a'), | ||
'b': dependency('b'), | ||
'c': dependency('c'), | ||
... | ||
} | ||
lib_dependencies = { | ||
'libA': ['a', 'b'], | ||
'libB': ['b', 'c'], | ||
... | ||
} | ||
libA = library('A', dependencies: dependencies.map(lib_dependencies['libA'])) | ||
libB = library('B', dependencies: dependencies.map(lib_dependencies['libB'])) | ||
... | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters