subsop command
Publié : dim. janv. 05, 2020 9:49 pm
hello
A valuable improvement in the subsop command is that it allows you to accept a criterion or rule.
map( lambda x: ifte(odd(x),'NULL',x), set[ 1,2,3,4,5,6,7,9,10,11,12 ]) It does not work, returns [seq[],2,seq[],4,seq[],6,seq[],seq[],10,seq[],12]
apply(lambda x: ifte(even(x),'NULL',x), set[ 1,2,3,4,5,6,7,9,10,11,12 ]) It does not work, returns [1,seq[],3,seq[],5,seq[],7,9,seq[],11,seq[]]
A valuable improvement in the subsop command is that it allows you to accept a criterion or rule.
Code : Tout sélectionner
subsop( set[ 0, 1, 2, 3, 4 ], 2 = sqrt(2)+1 ) [enter] [0,1,sqrt(2)+1,3,4]
subsop( set[ 1,2,3,4,5,6,7,9,10,11,12 ], odd='NULL' ) [enter] set[2,4,6,8,10,12]
subsop( set[ 1,2,3,4,5,6,7,9,10,11,12 ], even='NULL' ) [enter] set[1,3,5,7,9,11]
apply(lambda x: ifte(even(x),'NULL',x), set[ 1,2,3,4,5,6,7,9,10,11,12 ]) It does not work, returns [1,seq[],3,seq[],5,seq[],7,9,seq[],11,seq[]]