From: Pawel Szymczykowski Date: 2006-11-18T17:02:15+09:00 Subject: Fortran2Ruby Hi all, This is kind of silly, but hopefully not too off topic for the list. :) I made a small contribution to a friend's (food related) blog today about the 1978 Star Trek Cookbook. The introductory chapter includes a source code listing of an old fortran program to type and run (on your PDP-11?). For whatever reason, I took it upon myself to convert it over to ruby: http://www.edibleunknown.com/articles/2006/11/17/cooking-with-trek-the-motion-picture Ultimately it works just fine, but it didn't come out as cleanly as I would like. Specifically the part where I had to pad out the arrays passed to a sprintf string so as not to get a 'too few arguments' error. If you don't feel like clicking over, here's what I mean: fmt007 = ' ' * 2 + "\n" * 3 + ' ' * 5 + '%2c' * 20 pad = Array.new(20).fill(20) puts fmt007 % [ food[1], waffl[3], dish[2], food[12], dish[3], fryer[2], waffl[13], *pad ] I wanted to keep it short and as much in the spirit of the original fortran program as possible, but that *pad hack bothers me. I've considered using Array#pack instead of the sprintf since the arguments are much more similar to fortran's format, but I'd lose the field width and precision control. Can anyone think of a better way? Maybe even just a prettier way of padding the array. And before you tell me, yes, yes... I know that ruby's not fortran and fortan's not ruby and I'm a fool for wasting your time with this. It's kind of fun for me though, and I know there are a lot of people out there more clever than me who enjoy a challenge. Is it possible to write fortran code in ruby? Thanks! -Pawel