Path: csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Paul Rubin Newsgroups: comp.lang.forth Subject: Re: "pattern matching as inverting functions" for "languages without named parameters" Date: Sat, 07 May 2016 17:51:29 -0700 Organization: A noiseless patient Spider Lines: 13 Message-ID: <87shxt74oe.fsf@jester.gateway.pace.com> References: <2016May6.165650@mips.complang.tuwien.ac.at> <2016May6.183555@mips.complang.tuwien.ac.at> <878tzncf2v.fsf@nightsong.com> <2016May7.155757@mips.complang.tuwien.ac.at> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="6f8cc70e6892455e89d230a40ec2704b"; logging-data="2786"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18ZJ9srhHWFUr/udPriGgJP" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:ykFhZ5a0z5fhbXXd7uIprUl5VNc= sha1:rCHBEzFlAk+HczbMXwolwXZwwC4= Xref: csiph.com comp.lang.forth:46984 anton@mips.complang.tuwien.ac.at (Anton Ertl) writes: >>Lisp and Python have features like that > Can you present an example use that cannot be solved with same-length > or shorter programs with OOP or higher-order words? It's used all the time, e.g. the Python equivalent of the Forth word /MOD is the divmod function: quotient, remainder = divmod(num, divisor) divmod returns a pair, and in that example I bound the two elements of the pair into 'quotient' and 'remainder' through destructuring (that's the Lisp term, I don't remember if there's a Python term).