From: Haris Bogdanovic Date: 2009-01-09T20:19:39+09:00 Subject: Re: functional programming I managed to find a minimum: [1,6,4,7,8].inject {|a,b| if a < b then a else b end} but I can't still find a way to sort list (functional way and not with existing sort method) Thanks "Haris Bogdanovic" wrote in message news:gk3m77$1ft$1@gregory.bnet.hr... > Hi. > > I'm starting to learn functional programming with Ruby. > I would like for someone to write me an example of finding the smallest > number in the list and a sorting algorithm. > I got the concept of map (collect), filter (select, detect and reject) and > reduce (inject) higher order functions but I don't know how to compose > algorithms from them. > So please write me those two algorithms or some other simple ones with > some explanation. > Some links to this subject would be nice also. > > Thanks > Haris >