Hi ,(adsbygoogle = window.adsbygoogle || []).push({});

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

**Physics Forums - The Fusion of Science and Community**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Functions in Mathematica - sort function

Loading...

Similar Threads - Functions Mathematica sort | Date |
---|---|

Mathematica Cannot do the integral of the Hyper-geometric function? | Sunday at 9:46 AM |

Mathematica Cannot Plot This Function in Mathematica | Feb 26, 2018 |

Mathematica How to append functions to a list of functions? | Oct 8, 2017 |

Is the integral for current correct? | Jul 7, 2017 |

Trying to define a integrating function in Mathematica | Jun 11, 2016 |

**Physics Forums - The Fusion of Science and Community**