From: "Eustáquio 'TaQ' Rangel" Date: 2008-03-26T23:52:23+09:00 Subject: Re: The inject function -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 | I agree that reverse() is the correct tool for this job, but just to | fully answer the question: | >> [1, 2, 3, 4].inject([]) { |rev, item| [item] + rev } Just to use the same approach but with insert: |> [1,2,3,4,5,6].inject([]){|m,v| m.insert(0,v)} => [6, 5, 4, 3, 2, 1] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQFH6mMbb6UiZnhJiLsRAsmcAKCJL0YI4hyf1/37tP7PCs7rQx/fsQCdFFcW ponhdDBGbDpbA5JsPMnu+Wk= =I8Go -----END PGP SIGNATURE-----