[riot-notifications] [RIOT-OS/RIOT] makefiles/utils/{strings, paths}: Add function library. (#11218)

Gaƫtan Harter notifications at github.com
Wed May 8 16:27:25 CEST 2019


cladmi commented on this pull request.



> +# Get the remaining words in a list (i.e. everything except the first)
+rest = $(wordlist 2,$(words $(1)),$(1))
+
+# Strings as truth values
+# In make, empty strings function as a "false" value and non-empty ones
+# as true.
+
+# Return a string ("x") if the argument is empty and vice versa
+strnot = $(if $(1),,x)
+
+# Concatenate a list of strings
+# Defined via "?=" because redefinition kill the recursive definition
+concat ?= $(if $(1),$(firstword $(1))$(call concat,$(call rest,$(1))),)
+
+# Intercalate: concatenate words in a list with a separator between each one.
+intercal = $(firstword $(2))$(call concat,$(addprefix $(1),$(call rest,$(2))))

By taking the list as first argument and the separator as second, concat could be the same "public" function I think.

```
Concatenate a list of strings:

$1: list of strings
$2: join str, default to empty
```

Maybe for the implementation you still need the other one but only one public would be enough.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11218#pullrequestreview-235090027
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190508/7228b4f4/attachment.html>


More information about the notifications mailing list