From: Gavin Sinclair Date: 2002-09-25T15:12:25+09:00 Subject: Re: are functions/methods "first class objects"? Bulat, Your problem is interesting, but I can't provide much help because your post is difficult to read: - it is an HTML email, whereas code is much much easier to read in plain text, and plain text should always be used on newgroups and mailing lists - your writing is sloppy: all lower-case letters - the description of what you want to achieve is unclear I am only gently criticising you here, and merely wish to point out that you will probably get a better response if you pay attention to clarity, detail and netiquette. Hopefully others can provide greater assistance. Regarding what you want to achieve, I suggest you concentrate on the objective (sorting files on multiple criteria) and not on the method (returning function to sort). You are trying to solve the problem in a functional way whereas I'm sure it is better solved in Ruby using the OO paradigm. If there is a pressing need to use the method you describe, I'd like to know what it is and how I can best advise. I hope this helps, Gavin ----- Original Message ----- From: "Bulat Ziganshin" To: "ruby-talk ML" Sent: Wednesday, September 25, 2002 2:53 PM Subject: Re: are functions/methods "first class objects"? > Hello Christian, > > Tuesday, September 24, 2002, 4:40:31 PM, you wrote: > > CS> Now, let us be honest, is it so important? I do a lot of > CS> meta-programming, but I have never encountered a situation > CS> requiring such a high level approach. > > i had. sorting a list of filenames on given criterion: > > sort_by "es", filenames # sorts by extension then size > sort_by "n", filenames # sorts by filename w/o path and extension > > i want to create meta-function which returns function to sort (or just > compare criterions) given ordering string: > > sort_by "es" > returns > {|filename| [File.ext(filename), File.stat(filename).size] } > > can you (and Ruby :) help me? -eval > > -- > Best regards, > Bulat mailto:bulatz@integ.ru >