Sort a number list in ascending order

How would you go about sorting a list of numbers to be in ascending order. I’ve googled this but all the scripts I find don’t entirely work. The ones I found just check the first number so a list like this:

{20, 3, 35, 2}

would return {2, 20, 3, 35} instead of {2, 3, 20, 35}

and also remove repeated numbers.

Assuming you mean using AppleScriptObjC:

 set theList to {2, 20, 3, 1, 21}
 -- make unique set
 tell current application's NSSet to set theSet to setWithArray_(theList)
 -- define sorting
 tell current application's NSSortDescriptor to set theDescriptor to sortDescriptorWithKey_ascending_(missing value, true)
 --sort
 set sortedList to theSet's sortedArrayUsingDescriptors_({theDescriptor})
 log sortedList