-
-
Save kos59125/9bd657f343d060429d10a753b33db695 to your computer and use it in GitHub Desktop.
emurate c function in R
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
def c(*args): | |
l = [] | |
for x in args: | |
if hasattr(x, '__iter__'): | |
l.extend(list(x)) | |
else: | |
l.append(x) | |
return l | |
# [0, 1, 2, 3, 4, 9, 14, 15, 16, 17] | |
print(c(range(0, 5), 9, range(14, 18))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment