Flatten a list: Difference between revisions
Content added Content deleted
(Added Q solution.) |
|||
Line 2,884: | Line 2,884: | ||
>>> print list(flatten(lst)) |
>>> print list(flatten(lst)) |
||
[1, 2, 3, 4, 5, 6, 7, 8]</lang> |
[1, 2, 3, 4, 5, 6, 7, 8]</lang> |
||
=={{header|Q}}== |
|||
{{trans|K}} |
|||
We repeatedly apply <tt>raze</tt> until the return value converges to a fixed value. |
|||
<lang q>(raze/) ((1); 2; ((3;4); 5); ((())); (((6))); 7; 8; ())</lang> |
|||
=={{header|R}}== |
=={{header|R}}== |
||
Line 2,889: | Line 2,894: | ||
unlist(x)</lang> |
unlist(x)</lang> |
||
=={{header|Racket}}== |
=={{header|Racket}}== |