Comment detail

全ての組み合わせ (Nested Flatten)

This comment is reply for 2153 sumim: Squeak Smalltalk で。(全ての組み合わせ). Go to thread root.

ether さんの #2152 の簡潔さに感心しつつ、それをヒントにして同様のことを Squeak Smalltalk で。
1
2
3
4
| input |
input := #((0 1) 'ab' (foo bar)).
^input reversed inject: #(()) into: [:arrs :colln |
    colln inject: #() into: [:rs :elem | rs, (arrs collect: [:arr | {elem}, arr])]]

Index

Feed

Other

Link

Pathtraq

loading...