- #1
Physics_rocks
- 12
- 0
Hi ,
I'm trying to write down the following function :
sort[list_]
it needs to sort a list of numbers by checking each two adjacent numbers and swap them
if it is needed , but it doesn't work . I need to implement it using Pattern Matching .
but I don't understand how can I interate in "list" , meaning how can I ask an "IF" question
such as If list < list[i+1] then swap(list,list[i+1]) .
10x
I'm trying to write down the following function :
sort[list_]
it needs to sort a list of numbers by checking each two adjacent numbers and swap them
if it is needed , but it doesn't work . I need to implement it using Pattern Matching .
but I don't understand how can I interate in "list" , meaning how can I ask an "IF" question
such as If list < list[i+1] then swap(list,list[i+1]) .
10x