From: rsalz@osf.org
To: malte@techfak.uni-bielefeld.de, rc@hawkwind.utcs.toronto.edu
Subject: Re: set subtract
Date: Wed, 4 Nov 1992 09:12:36 -0500 [thread overview]
Message-ID: <9211041412.AA11509@earth.osf.org> (raw)
>A related builtin I always wanted to have:
> idx = `{ index list_of_patterns list_to_search_in }
>This should return a list of indices of the search patterns in the second list.
> ; echo `{ index a ( a b c a ) }
> 1 4
Easy; the following just uses built-ins. Note that it implements
the example (first arg is a pattern, not a list of patterns); I don't
believe the synopsis can be done.
fn index { pat=() i=() result=() count=() {
pat=$1
shift || { echo 'Usage error' >[1=2] ; return 1 }
for (i) {
count=(a $count)
eval ~ $i $pat && result=($result $#count)
}
echo $result
} }
next reply other threads:[~1992-11-04 14:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1992-11-04 14:12 rsalz [this message]
-- strict thread matches above, loose matches on Subject: below --
1992-11-04 14:25 malte
[not found] <cks@hawkwind.utcs.toronto.edu>
1992-11-04 12:45 ` malte
1992-11-03 23:44 Byron Rakitzis
1992-11-04 0:42 ` Chris Siebenmann
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9211041412.AA11509@earth.osf.org \
--to=rsalz@osf.org \
--cc=malte@techfak.uni-bielefeld.de \
--cc=rc@hawkwind.utcs.toronto.edu \
/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 NNTP newsgroup(s).