help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Too many permutations computed


From: uzibalqa
Subject: Re: Too many permutations computed
Date: Thu, 03 Aug 2023 15:52:18 +0000

------- Original Message -------
On Wednesday, August 2nd, 2023 at 10:13 PM, Emanuel Berg <incal@dataswamp.org> 
wrote:


> uzibalqa wrote:
> 
> > (while (< j h) [...]
> > (setq j (1+ j)))
> > [...]
> > for i := 0; i < k-1; i += 1 do [...]

Do you understand what the i += 1 does ?  It is the same as i++,
am I right ?

The difference lies in the timing of when the increment takes place 
(immediately in the case of i += 1, and after the value is used in 
the case of i++).   Do you think the distinction mentioned makes a 
difference for the algorithm ?

> 
> You can replace that `while' with a for loop using` cl-loop'
> and for, to make it a closer match to the pseudo-code.
> 
> This: (setq j (1+ j)) can be replaced by `cl-incf' as in
> (cl-incf j) - but better yet is to get away with that and use
> a for loop to iterate instead.
> 
> Again you can check out these two
> 
> https://dataswamp.org/~incal/emacs-init/perm.el
> https://www.emacswiki.org/emacs/StringPermutations
> 
> but after spending so much time on your own solution I get it
> you want to complete it ...
> 
> --
> underground experts united
> https://dataswamp.org/~incal



reply via email to

[Prev in Thread] Current Thread [Next in Thread]