Skip to content
Prev 12650 / 398502 Next

style question: returning multiple arguments - structure orlist

I quite agree with everything Peter says, of course and I don't think it
conflicts with anything I said at all - but it is one thing to explore he
possibilities of R/S by this kind of torture test and quite another to lead
people to think of them as a normal and reasonable uses of the language.

In similar vein I wish <<- had never been invented, as it makes an esoteric
and dangerous feature of the language *seem* normal and reasonable.  If you
want to dumb down R/S into a macro language, this is the operator for you.

Bill.

-----Original Message-----
From: Peter Dalgaard BSA [mailto:p.dalgaard at biostat.ku.dk]
Sent: Sunday, 29 July 2001 9:45 PM
To: Venables, Bill (CMIS, Cleveland)
Cc: 'Peter Dalgaard BSA'; vogels at cmu.edu; rhelp; Thomas Lumley (E-mail)
Subject: Re: [R] style question: returning multiple arguments -
structure orlist


"Venables, Bill (CMIS, Cleveland)" <Bill.Venables at CMIS.CSIRO.AU> writes:
in
(S-PLUS,
yourself
half-way.
different
with
or
The counterpoint is that I often find it extremely instructive to try
and *make* R/S do some of the things it "can not do". This makes you
investigate some of the esoteric corners of the semantics, and
hopefully understand the whole thing a little bit better. It's not
invariably the case that you actually want to use the result of the
exercise, much less impose it on others.

I see the pedagogical problems we're facing largely as rooted in
"computational illiteracy". Basically, people have undeveloped
concepts of what computer languages are and what rules govern their
construction. 

I had the good fortune of starting at a point in time where the first
year of statistics coincided with the first year of Maths and Computer
Science. Later, this got changed to include a much less ambitious CS
course (for some good reasons, including the fact that it is useful to
teach statistics to first-year statistics students....) 

I only recently realized that this has become a straight
Pascal programming class, which the brighter students manage with
their left hand, but they learn nothing about general algorithmic
topics, parser theory, and formal program verification techniques
(actually, we didn't learn much about parsers and compilers either,
but at least we knew that they were there).

At the lower levels, people nowadays don't even realize that computer
languages exist, and expect everything to work like the Windows
desktop and characterize everything else as "DOS-like". 

As for the original challenge, I think you can actually get by with
overloading "[<-", leading to syntax of the form

LIST[a,b,c] <- f()

(which you most certainly would not want to inflict on standard R!)

LIST would want to be an object of class "foo" and "[<-.foo" a
function that returns its first argument unchanged, and has its way
with the other arguments.