| Deutsch English Français Italiano |
|
<20240715051340.619@kylheku.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!3.eu.feeder.erje.net!feeder.erje.net!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Kaz Kylheku <643-408-1753@kylheku.com> Newsgroups: comp.lang.python,comp.lang.lisp,sci.lang Subject: Re: How do i get multiple Min() values? Date: Mon, 15 Jul 2024 12:27:58 -0000 (UTC) Organization: A noiseless patient Spider Lines: 42 Message-ID: <20240715051340.619@kylheku.com> References: <v6qu7m$2vg8q$1@dont-email.me> <v6rug7$35c6s$2@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Mon, 15 Jul 2024 14:27:58 +0200 (CEST) Injection-Info: dont-email.me; posting-host="cf4046d13f74d7012fcb7650b259afb8"; logging-data="737865"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18pDm54YbA3+gzl45I4HHf7Cd9F/Qm+QBM=" User-Agent: slrn/pre1.0.4-9 (Linux) Cancel-Lock: sha1:RCBbPJryMnZbd2mM1bA4X+Aqz1M= Bytes: 2484 On 2024-07-12, HenHanna <HenHanna@devnull.tb> wrote: >> >> How do i get multiple Min() values? >> >> e.g. for Y = (x-2)*(x-3) for x in range(-10,10) >> the min Y is hit twice >> >> >> print( min( ((x-2)*(x-3), (x, (x-2, x-3))) >> for x in range(-10,10) ) ) >> >> >> >> is this easy in Scheme(Gauche) ? > > > if the Min() is going to check all of the Candidate values, > it could (at least) tell us how many times the Min value was seen! I decided to add something like this to TXR Lisp. It will appear in 296. This is the TXR Lisp interactive listener of TXR 295. Quit with :quit or Ctrl-D on an empty line. Ctrl-X ? for cheatsheet. When transferring between containers, do not siphon TXR by mouth. 1> (find-mins -10..11 : [callf * pppred ppred]) (2 3) 2> (find-mins (vec-seq -10..11) : [callf * pppred ppred]) #(2 3) 3> (find-mins "abracadabra") "aaaaa" 4> (find-maxes "abracacabra") "rr" I works with any less-like function, assuming equality when it’s neither true that x is less than y, nor that y is less than x. -- TXR Programming Language: http://nongnu.org/txr Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal Mastodon: @Kazinator@mstdn.ca