unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: 2QdxY4RzWzUUiLuE@potatochowder.com
To: help-gnu-emacs@gnu.org
Subject: Re: Doing something different for the last element of a sequence (partition)?
Date: Mon, 16 Nov 2020 05:10:13 -0600	[thread overview]
Message-ID: <X7JeFVHX7mFLgdKb@scrozzle> (raw)
In-Reply-To: <87ft59egt7.fsf@passepartout.tim-landscheidt.de>

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	other threads:[~2020-11-16 11:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-16 10:28 Doing something different for the last element of a sequence (partition)? Tim Landscheidt
2020-11-16 11:10 ` 2QdxY4RzWzUUiLuE [this message]
2020-11-16 11:40   ` Tim Landscheidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=X7JeFVHX7mFLgdKb@scrozzle \
    --to=2qdxy4rzwzuuilue@potatochowder.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).