Java Mailing List Archive

http://www.junlu.com/

Subjects
Home
mod jk2 https
Donation of JAXP 1 3 Sources to Apache
R annoyances
RE: Finding out when the aspnet admin worker process has recycled
Favorite Linux Distribution
eigenvalues of a circulant matrix
Apache Install
Reachin apache from outside
Ant should have an ext directory
Warning: Documentroot doesn 't exist
Can this be Done?
RE: Multilanguage Application
RE: Simple Question On setting up Sub Domain site
Lack of independence in anova()
How to close connection instead of sending 403?
winning the case for ANT
Re: adding php
New Ant GUI 'Ant 's Nest '
Narrowing Down A Strange Problem
Ant Task: sshexec
R Graph Gallery : categorization of the graphs
I 've been hacked, I need some help please
RE: Anyone working with DotNetNuke?
RE: Exception Handling Opinion
hex format
RE: IIS stopped working :(
<for > Build Failed:problem
RE: Separation of Objects from Logic
RE: Tracking pages with long request execution time
sending email to multiple destination
Web Site
ant UI
Easy cut & paste from Excel to R?
Win32 Apache Restart
Improving Tasks
HELP! PLEASE!
RE: Adding Controls to a Page
read table
RE: ASPNET account doesn 't exist!
Best way to uninstall Apache2 on red hat
from win to linux how to web page
XMLParseException changes and creation of XMLLocator2
Re Post: rewrite backslash to forward slash
Target or macrodef?
Page display problem XPSP2
Authentication problems
Dynamic Dictionary Data Type?
Newbie unable access my www from outside
off topic question: Latex and R in industries
Conflict between xtable and Hmisc when using Sweave?
Very old problem without any new solution
mod rewrite help
Basic Authentication question
RE: Code Security
calling ant from java program
prevent double signing
Re: Controlling Copy/Paste/Print
Using R to illustrate the Central Limit Theorem
web server slow too much slow
access to user directories
Links
Home
Official R Project Site
 
Search:  
Power your search with and, or, +, -, or "some phrase" operators.
Dynamic Dictionary Data Type?

Dynamic Dictionary Data Type?

2005-06-02       - By Prof Brian Ripley
Reply:     1     2     3     4     5     6     7     8     9     10     >>  

On Thu, 2 Jun 2005, hadley wickham wrote:

>> An environment is a hash table, and copying occurs only on modification,
>> when any language would have to copy in this context.

Caveat: the default is new.env(hash=FALSE), so an environment is a hash
table in one sense but not necessarily so in the strict sense.

> Yes, I'm aware that copying only occurs on modification.  However, it
> was my understanding that
>
> a <- list(a =1)
> a$b <- 4
>
> would create a new copy of a,

Thomas was talking about environments, not lists (and $ works differently
for them).

> whereas in Java say
>
> HashMap a = new HashMap();
> a.put("a", 1);
> a.put("b", 2);
>
> wouldn't create a copy of a. (please bear in mind my java syntax is very
rusty!)
>
> Caching data implies updating at each step, thus possibly creating n
> copies of the list.  Is that wrong?

It depends what you mean by `copy'.  If you expand a hash table you at
some point need to re-arrange the hashing of the entries.  That's what
will happen with an R environment or an R list too.  The possible
difference is that you might expect the table to have some room for
expansion, and in your list example you did not give any.

R's operations on lists make more copies than are strictly necessary, but
it is not clear that this is more costly than the housekeeping that would
otherwise be necessary.  In a$b <- 4, the wrapper VECSXP is recreated and
the pointers copied across, but the list elements are not copied.  For
a$a <- 4 it is probable that no copying is done (although if a2 <- a had
been done previously, the pending recursive copy would then be done).
(It is also possible that I have overlooked something in the rather
complex code used to do these subassignments.)

--
Brian D. Ripley,                  ripley@(protected)
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

______________________________________________
R-help@(protected) mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

©2008 junlu.com - Jax Systems, LLC, U.S.A.