Re: for-must-match
Thomas Leonard <[email protected]> Sat, 22 Oct 2011 13:17:39 +0100
| Newsgroups | gmane.comp.lang.e.general |
|---|---|
| Message-ID | <CAG4opy_chXSY6fEeOzm9v1hJ3gmvX+9UbPFsOAHU2iL0SRq0Bw@mail.gmail.com> |
Here's a patch to add list comprehensions: ? def list := [1, 2, 3] ? [2 * x for x in list] # value: [2, 4, 6] http://gitorious.org/repo-roscidus/e-core/commit/9bfacc4f748b4ea6a7cf64dc40d7bc9dd1890d38 And for map comprehensions: ? def map := ["alice" => 50, "bob" => 60] ? [v => k for k => v in map] # value: [50 => "alice", 60 => "bob"] http://gitorious.org/repo-roscidus/e-core/commit/980c8c93d41a69f242acdb5b83c9faccf918f4c3 They don't currently support the 'match' keyword, so you can't use them to filter (every item must be mapped to something). -- Dr Thomas Leonard http://0install.net/ GPG: 9242 9807 C985 3C07 44A6 8B9A AE07 8280 59A5 3CC1 GPG: DA98 25AE CAD0 8975 7CDA BD8E 0713 3F96 CA74 D8BA _______________________________________________ e-lang mailing list [email protected] http://www.eros-os.org/mailman/listinfo/e-lang