From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.236.207.101 with SMTP id m65mr971237yho.41.1412660305640; Mon, 06 Oct 2014 22:38:25 -0700 (PDT) X-Received: by 10.140.40.85 with SMTP id w79mr111qgw.38.1412660305606; Mon, 06 Oct 2014 22:38:25 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!s7no1034414qap.0!news-out.google.com!q8ni43qal.1!nntp.google.com!s7no1034412qap.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 6 Oct 2014 22:38:25 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=93.37.88.74; posting-account=9fwclgkAAAD6oQ5usUYhee1l39geVY99 NNTP-Posting-Host: 93.37.88.74 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <460f8eef-a6b8-4774-ac30-edba9f366676@googlegroups.com> Subject: Re: permutation of strings From: mockturtle Injection-Date: Tue, 07 Oct 2014 05:38:25 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 2492 X-Received-Body-CRC: 2268803237 Xref: news.eternal-september.org comp.lang.ada:22168 Date: 2014-10-06T22:38:25-07:00 List-Id: On Tuesday, October 7, 2014 7:23:53 AM UTC+2, Stribor40 wrote: > I have created this code using some online tutorials and some examples th= at i tried to learn... i havent been able to find whats wrong with my code.= ...i am guessing what my variable j is somehow getting reset during the rec= ursive calls... >=20 > i have been trying to retrace recursive calls by writing each call on the= on the paper but i get lost trying to track it down...... >=20 > my code spits out numbers...123 123 123 123 123 123 instead of 123 132 21= 3 231 321 312 so i was hoping if someone can take a look and suggest how to= fix this.... >=20 > i pasted the code here it is ready to be compiled and there are no errors= when it is compiled....http://pastebin.com/rDF46RbR At the moment I do not have a compiler at hand (I'm having breakfast :-), b= ut I see at least one strange thing in your code: in the loop "for Index ..= .." I would expect calls to "change(s, i, Index)" rather than "change(s, i,= j)". With the latter there is no difference between different iterations = and this could give rise to your error. By the way, there is no need to have j declared "in out" in Change, since j= is not changed. Moreover, I suspect that with the "in out" specification t= he compiler will complain, since you cannot change a loop index.