Please tell your friends about federated social media site that speaks several fediverse protocols thus serving as a hub uniting them, hubzilla.eskimo.com, also check out friendica.eskimo.com, federated
macroblogging social media site, mastodon.eskimo.com a federated microblogging site, and yacy.eskimo.com an uncensored federated search engine. All Free!
It isn't always easy to figure out whether you have progressed as a programmer or not, but managing to write a recursive function right the first try definitely is a solid milestone. #programming
Here's the problem I solved with recursion: I want to update a value in a multi-dimensional array based on a key path. The path is a list of array keys in increasing depth. The value should override the existing one or be created (along with the intermediate keys) if it doesn't.
For example, with the following key path: friendica, database, user and the value hypolite, I want to update the following array key: array[friendica][database][user] = hypolite. Of course the key path length is arbitrary.
I can't think of a way of not using recursion, but I'm curious how you would do it.
Nanook
in reply to Hypolite Petovan • •Nanook
in reply to Hypolite Petovan • •Brad Koehn
in reply to Hypolite Petovan • •Hypolite Petovan
in reply to Brad Koehn • •Here's the problem I solved with recursion: I want to update a value in a multi-dimensional array based on a key path. The path is a list of array keys in increasing depth. The value should override the existing one or be created (along with the intermediate keys) if it doesn't.
For example, with the following key path:
friendica, database, userand the valuehypolite, I want to update the following array key:array[friendica][database][user] = hypolite. Of course the key path length is arbitrary.I can't think of a way of not using recursion, but I'm curious how you would do it.