Re: Interactive golf hole

2002-01-09 Thread Yitzchak Scott-Thoennes
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Yitzchak Scott-Thoennes) wrote: Ronald J Kimball [EMAIL PROTECTED] wrote: Here's my current solution, at 64: -pl $_=join':',grep defined,/([^]*)(?![^\s#])|([^\s#]+)|#.*/g Originally I had $_.0 instead of defined, but I realized that that skips

Re: Interactive golf hole

2002-01-08 Thread Jeff 'japhy' Pinyan
On Jan 8, Yitzchak Scott-Thoennes said: I prefer (at least sometimes) to see golf worked out interactively, on the list. I'm not sure I understand. Shall I show my code? A file has 0 or more fields on each line. Fields are separated by 1 or more whitespace characters. Leading and trailing

Re: Interactive golf hole

2002-01-08 Thread Jeff 'japhy' Pinyan
On Jan 8, Jeff 'japhy' Pinyan said: On Jan 8, Yitzchak Scott-Thoennes said: I prefer (at least sometimes) to see golf worked out interactively, on the list. I'm not sure I understand. Shall I show my code? My \s* should've been a \s+. -- Jeff japhy Pinyan [EMAIL PROTECTED]

Re: Interactive golf hole

2002-01-08 Thread Yitzchak Scott-Thoennes
In article [EMAIL PROTECTED], Jeff 'japhy' Pinyan [EMAIL PROTECTED] wrote: On Jan 8, Yitzchak Scott-Thoennes said: I prefer (at least sometimes) to see golf worked out interactively, on the list. I'm not sure I understand. Shall I show my code? Yes. -n

Re: Interactive golf hole

2002-01-08 Thread Ronald J Kimball
On Tue, Jan 08, 2002 at 02:50:16PM -0500, Jeff 'japhy' Pinyan wrote: On Jan 8, Yitzchak Scott-Thoennes said: A file has 0 or more fields on each line. Fields are separated by 1 or more whitespace characters. Leading and trailing whitespace should be ignored. Comments (starting with # and

Re: Interactive golf hole

2002-01-08 Thread Ronald J Kimball
On Tue, Jan 08, 2002 at 11:50:44AM -0800, Yitzchak Scott-Thoennes wrote: Also, I said: Fields are separated by 1 or more whitespace characters, so xx is one 4 character field, not two 1 character fields. Woops, I got that part wrong. Gotta go rework my solution... Ronald

Re: Interactive golf hole

2002-01-08 Thread Yanick
On Tue, Jan 08, 2002 at 11:50:44AM -0800, Yitzchak Scott-Thoennes wrote: -n $\=$/;$,=':';print/([^]*|[^\s#]+)\s*(?:#.*)?/g Close. I said: The surrounding quotes are themselves not part of the field, so the quotes should not get printed. Also, I said: Fields are separated by 1 or more

Re: Interactive golf hole

2002-01-08 Thread Ronald J Kimball
On Tue, Jan 08, 2002 at 01:30:12PM -0800, Yitzchak Scott-Thoennes wrote: On Tue, Jan 08, 2002 at 11:50:44AM -0800, Yitzchak Scott-Thoennes wrote: -n $,=':';$\=$/;print grep$_,/\G\s*(?:([^]*)(?:\s|$)|([^\s#]+))/g; (but what a poor score it gives... :/ ) It gets worse: While

Re: Interactive golf hole

2002-01-08 Thread Wesley Darlington
On Tue, Jan 08, 2002 at 10:37:45AM -0800, Yitzchak Scott-Thoennes wrote: Here's a hole: A file has 0 or more fields on each line. Fields are separated by 1 or more whitespace characters. Leading and trailing whitespace should be ignored. Comments (starting with # and continuing to the end

Re: Interactive golf hole

2002-01-08 Thread Yitzchak Scott-Thoennes
Wesley Darlington [EMAIL PROTECTED] wrote: -p s/\s*(([^]*)|((\S*?)#.*)|(\S+))\s*/$2$4$5:/g,s/:+$/\n/ That's downright clever. I think the approach could be a winner, but as is it removes trailing empty fields: x becomes: x instead of: x:

Re: Interactive golf hole

2002-01-08 Thread Yitzchak Scott-Thoennes
Wesley Darlington [EMAIL PROTECTED] wrote: -p s/\s*(([^]*)|((\S*?)#.*)|(\S+))\s*/$2$4$5:/g,s/:+$/\n/ That's downright clever. I think the approach could be a winner, but as is it removes trailing empty fields: x becomes: x instead of: x: Now that someone has braved removing the quotes in

Re: Interactive golf hole

2002-01-08 Thread Keith C. Ivey
Wesley Darlington [EMAIL PROTECTED] wrote: -p s/\s*(([^]*)|((\S*?)#.*)|(\S+))\s*/$2$4$5:/g,s/:+$/\n/ Is the third set of parens necessary? Won't this do the same? -p s/\s*(([^]*)|(\S*?)#.*|(\S+))\s*/$2$3$4:/g,s/:+$/\n/ And from there you can cut it further to -p

Re: Interactive golf hole

2002-01-08 Thread Yitzchak Scott-Thoennes
Ronald J Kimball [EMAIL PROTECTED] wrote: Here's my current solution, at 64: -pl $_=join':',grep defined,/([^]*)(?![^\s#])|([^\s#]+)|#.*/g Originally I had $_.0 instead of defined, but I realized that that skips empty fields, i.e. . Is there a shorter way to test for defined? Not that I can