[R] Some Programming Humor - Quine
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu May 15 15:07:17 CEST 2003
On Thu, 15 May 2003, Wolfgang Koller wrote:
> At 13:17 15.05.03 +0100, Prof Brian Ripley wrote:
> >On Thu, 15 May 2003, Wolfgang Koller wrote:
> >
> >> By the way, some questions that arose in this programming exercise:
> >> a) is there a simpler way to do the assignment
> >> STR <- "\""
> >> without using quotes?
> >
> >Not simpler, but '"' is probably easier to read.
> This version still uses a quote --- the one in the middle. With "simpler" I
> meant in comparison with the version I used in quine()-code, which is
> admittedly ugly and depends on the source code of paste(), but does not use
> quotes (nor double quotes or whatever ' and " are correctly named in English):
> STR <- substr(deparse(paste)[1],start=24,stop=24)
>
> Maybe something analogous to letters[] would be a nice additional feature
> in R? I have needed something like that on several occasions before.
What analogue do you have in mind: remember the encoding is OS- and
locale-dependent? I've written CharToInt and IntToChar functions on
occasion.
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list