Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.posted.palinacquisition!news.posted.palinacquisition.POSTED!not-for-mail NNTP-Posting-Date: Sat, 05 Nov 2011 16:26:26 -0500 Date: Sat, 05 Nov 2011 14:26:24 -0700 From: Peter Duniho User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.5; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 MIME-Version: 1.0 Newsgroups: comp.lang.java.programmer Subject: Re: Immutable Datastructures with good Sharing References: <4839047.311.1320512815263.JavaMail.geo-discussion-forums@pref15> <24CdnZZfrM8C5SjTnZ2dnUVZ_qmdnZ2d@posted.palinacquisition> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Message-ID: Lines: 48 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 50.46.118.188 X-Trace: sv3-fNHZn7v4S3wgKmzVbvVf+DIbyFGNfG72dy+RWwxJrUQOtS3Q7Iy1gYzXkJRczNKlvyq1NTtrNU695zT!Tcq5BXFseaSZIcEy/ncfiiXtZPwzI+/dWTOrc14kezK2Bwy/ZT5Y+ZZfH6Qt4rNKLuQoYOF4pmhE!U2HYXQ5RVflGc8LH7oXNqlQhgK7m79QQp98nsVCpJxs= X-Complaints-To: abuse@iinet.com X-DMCA-Complaints-To: abuse@iinet.com X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 3571 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:9617 On 11/5/11 11:15 AM, Stefan Ram wrote: > Peter Duniho writes: >> What inherent contradiction? Please cite an authoritative reference >> that requires that the data structure known simply as a "stack" must be >> implemented using mutable instances. > > The most authoritative reference whatsoever, world-wide surely is > the renowned internet encyclopedia »Wikipedia«. And this says: > > »The push operation adds a new item to the top of the stack« > > http://en.wikipedia.org/wiki/Stack_(abstract_data_type) > > . »Add« is a /mutation/, it means to /change/ something by > /adding/ something to it. Yes, add is a mutation. It means to change something by adding something to it. So, when you add two integers, why is that permitted, given that "int" is an immutable type? When you add two strings (i.e. concatenate), why is that permitted, given that "String" is an immutable type? Hint: you are confusing the question of changing something with the question of where the result of that change goes. Certainly, there's nothing on Wikipedia (which frankly, is not "the most authoritative reference whatsoever" in any case) supports your claim. I notice you also have failed to offer a more appropriate term. Very telling. > In this context, the verb »add« has > the same meaning as in everyday language. The push operation > has no result specified, but it has an effect specified. > > In the functional lanugage it is exactly the other way > round: It has a result specified, but no effect specified. > >> Requiring mutable instances would mean one could not, for example, >> implement a stack at all in languages like Lisp or XSLT. > > In Common Lisp, one /can/ implement mutable data structures. Yes, there are variations of functional language that introduce mutability. So? That doesn't change the fact that mutability is not required in order to implement a stack. Pete