next up previous contents index
suivant: Sort a list by monter: Lists and vectors précédent: Prepend an element at   Table des matières   Index


Sort : sort

sort takes as argument a list or an expression. sort accepts an optionnal second argument, which is a bivariate function returning 0 or 1. If provided, this function will be used to sort the list, for example (x,y)->x>=y may be used as second argument to sort the list in decreasing order. This may also be used to sort list of lists (that sort with one argument does not know how to sort).
Input :
sort([3,4,2],(x,y)->x>=y)
Output :
[4,3,2]



giac documentation written by Renée De Graeve and Bernard Parisse