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

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

Re: Doing something different for the last element of a sequence (partit


From: 2QdxY4RzWzUUiLuE
Subject: Re: Doing something different for the last element of a sequence (partition)?
Date: Mon, 16 Nov 2020 05:10:13 -0600

On 2020-11-16 at 10:28:52 +0000,
Tim Landscheidt <tim@tim-landscheidt.de> wrote:

> Hi,
> 
> I have a list of URLs (all-urls) and I want to launch a
> Firefox window for the first x URLs, then wait y seconds,
> then launch another one, etc., and then prompt the user if
> the source of URLs can be deleted (provided that everything
> went smoothly).
> 
> If I do:
> 
> | (seq-doseq (firefox-urls (seq-partition (seq-sort all-urls #'string<) x))
> |   (apply 'call-process "firefox" nil "*firefox*" nil firefox-urls)
> |   (sleep-for y))
> 
> that works fine, except that it also waits for y seconds af-
> ter the last launch.

Or handle the first one as the special case (completely untested):

    (cl-do (((firefox-urls (seq-partition (seq-sort all-urls #'string<) x))
             (delay 0 y)))
      (sleep-for delay)
      (apply 'call-process "firefox" nil "*firefox*" nil firefox-urls))



reply via email to

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