Re: [Rd] small syntax suggestion

2010-08-24 Thread Greg Snow
> Sent: Tuesday, August 24, 2010 9:03 AM > To: phgrosj...@sciviews.org > Cc: r-devel@r-project.org > Subject: Re: [Rd] small syntax suggestion > > hi ted, philippe, and others---I agree with everything you write about > good coding practice.none of us would be writing x<-

Re: [Rd] small syntax suggestion

2010-08-24 Thread Barry Rowlingson
On Tue, Aug 24, 2010 at 4:18 PM, Ted Harding wrote: > So, on those grounds, I doubt its wisdom (and would prefer > giving the advice to bracket things, as in "x<(-3)". It's > a potential syntactic trap, but it's only one of many which > can be avoided in similar ways, and I think it's better to >

Re: [Rd] small syntax suggestion

2010-08-24 Thread Ted Harding
On 24-Aug-10 14:42:11, Davor Cubranic wrote: > On August 23, 2010 01:27:24 pm Philippe Grosjean wrote: >> They have to write such a code like this: >> >> if (x < -3) do_something >> >> That way, there is no ambiguity. Don't you think it's important to >> write clear code, including by using space

Re: [Rd] small syntax suggestion

2010-08-24 Thread ivo welch
hi ted, philippe, and others---I agree with everything you write about good coding practice.none of us would be writing x<-3, even when we want to assign 3. we know better. we would at least use a space, if not a paren. alas, my suggestion is not so much for you. It is trying to spare novi

Re: [Rd] small syntax suggestion

2010-08-24 Thread Davor Cubranic
On August 23, 2010 01:27:24 pm Philippe Grosjean wrote: > They have to write such a code like this: > > if (x < -3) do_something > > That way, there is no ambiguity. Don't you think it's important to > write clear code, including by using spaces where it makes it easier > to read,... and less amb

Re: [Rd] small syntax suggestion

2010-08-23 Thread Philippe Grosjean
I tell to my students that it is very important (not only for legibility) to place spaces between operands. They have to write such a code like this: if (x < -3) do_something That way, there is no ambiguity. Don't you think it's important to write clear code, including by using spaces where i

Re: [Rd] small syntax suggestion

2010-08-23 Thread Ted Harding
On 23-Aug-10 17:50:44, Barry Rowlingson wrote: > On Mon, Aug 23, 2010 at 6:06 PM, Davor Cubranic > wrote: > >> The students are trying to *compare* to a negative number, and >> trip on> R's parsing of "<-". They could use '=' for assignment >> all they want (which I thought is being discouraged a

Re: [Rd] small syntax suggestion

2010-08-23 Thread Barry Rowlingson
On Mon, Aug 23, 2010 at 6:06 PM, Davor Cubranic wrote: > The students are trying to *compare* to a negative number, and trip on R's > parsing of "<-". They could use '=' for assignment all they want (which I > thought is being discouraged as a code style these days, BTW), and they'll > still r

Re: [Rd] small syntax suggestion

2010-08-23 Thread Davor Cubranic
On 2010-08-23, at 6:15 AM, Barry Rowlingson wrote: > On Sun, Aug 22, 2010 at 4:33 PM, ivo welch wrote: >> I have found that my students often make the mistake of >> mixing up comparisons and assignments with negative numbers: >> >> if (x<-3) do_something; > > If you tell your students not to u

Re: [Rd] small syntax suggestion

2010-08-23 Thread Barry Rowlingson
On Sun, Aug 22, 2010 at 4:33 PM, ivo welch wrote: > Dear R development Team:  I really know very little, so you may ignore > this post.  I have found that my students often make the mistake of > mixing up comparisons and assignments with negative numbers: > >  if (x<-3) do_something; > > I parenth