12 ms·
The python equivalent is lambda *lst: ''.join([str(lst[0]), str(lst[0]).join([str(_) for _ in lst])]) Which is uh… begging for an initial line of "lst = m
by falsedan 9y ago
The python equivalent is
lambda *lst: ''.join([str(lst[0]), str(lst[0]).join([str(_) for _ in lst])])
Which is uh… begging for an initial line of "lst = map(str, lst)"
- AlexCoventry 9y agoWow, that was a journey. Thanks.
- falsedan 9y agoA more idiomatic solution: lambda *lst: ''.join(['{}{}'.format(lst[0], _) for _ in lst])
- RodgerTheGreat 9y agoIf I follow correctly, the equivalent in K would be {,/(*t),/:t:$x} Flatten (,/) the first element of the list (*t) joined with each element of the list (a,/:b), where t is the input x cast to a list of strings (t:$x). Curly braces make the expression an anonymous function, and since no argument names are specified explicitly the name x is the single input argument.