Hi Malcolm, and welcome!
On Sat, Apr 23, 2016 at 10:15:52AM +1000, Malcolm Herbert wrote:
> I've been dabbling a bit with some lists and trying to work out how best
> to abitrarily sort and filter these. Perl has a number of operators that
> help with this in map(), grep() and sort() as follows:
Greetings and welcome Malcolm,
>hey folks - I've been a long time perl programmer and only recently
>tried my hand a python, so it's probable that these questions are
>non-sensical in this context but for the moment I'm trying to stay
>afloat
Although I wrote Python first, I spent years writi
On 23/04/16 01:15, Malcolm Herbert wrote:
> @raw = (2, 1, 4, 3);
> @grepped = grep { $_ >= 3 } @raw; # (4, 3)
grepped = [item for item in raw if item >= 3]
> @mapped = map { $_ + 1 } @raw; # (3, 2, 5, 4)
mapped = [item +1 for item in raw]
or
mapped = map(lambda x: x+1, raw)
> @sorted =
hey folks - I've been a long time perl programmer and only recently
tried my hand a python, so it's probable that these questions are
non-sensical in this context but for the moment I'm trying to stay
afloat
I've been dabbling a bit with some lists and trying to work out how best
to abitrarily sor