From ripley at stats.ox.ac.uk  Sat Aug 27 10:23:37 2005
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Sat, 27 Aug 2005 09:23:37 +0100 (BST)
Subject: [Rd] RFC: "loop connections"
In-Reply-To: <deosbv$8qa$1@sea.gmane.org>
References: <dedndn$daj$1@sea.gmane.org> <denvc0$eag$1@sea.gmane.org>
	<971536df05082614254465b8c6@mail.gmail.com>
	<deosbv$8qa$1@sea.gmane.org>
Message-ID: <Pine.LNX.4.61.0508270825270.25461@gannet.stats>

On Sat, 27 Aug 2005 dhinds at sonic.net wrote:

> Gabor Grothendieck <ggrothendieck at gmail.com> wrote:
>> OK.  I guess you want one of the core people to respond but in the

One has.

>> interim can you explain the terminology "loop"?
>> Also, do you have any prototypical applications in mind?
>
> "loop" is short for "loopback".  A loop or loopback device is one that
> just returns the data sent to it.

That is definitely not what text connections do, and not what I read the 
proposal as being given the analogies to text connections.

> The prototypical applications are the same sort of applications text
> connections are used for: data transformation,

That I think is where Hinds' confusion arises.  As the posting guide asks, 
please do your homework before posting.

Text connections are from the Green Book, where they are described as

- a 'text connection' using S character strings as lines of text input

- Text connections are a convenience to make it easy to use an object
   containing character strings in a computation that expects to read
   from a connection.

They are read-only (or in R but not S, write-only).  Think for them as the 
analogues of the C functions sscanf and sprintf.  Output text connections 
are a particularly convenient way to create text labels -- see for example 
capture.output().

> in this case of raw binary data, rather than formatted text data.  In my 
> case, I needed to interpret a "long raw" column from an Oracle table, 
> that consisted of packed single precision floating point numbers.

That is exactly what read-write anonymous file() connections are designed 
for.  They too come from the Green Book.  (If efficiency were an issue, a 
short purpose-designed C routine would be the answer.  But file 
connections are already much 'smarter' than the proposed implementation of 
loop connections and do allow seeking.)

Another piece of homework might be my article in the very first R 
newsletter.

-- 
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



[Rd] RFC: "loop connections"
Prof Brian Ripley