Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #46984

Re: "pattern matching as inverting functions" for "languages without named parameters"

From Paul Rubin <no.email@nospam.invalid>
Newsgroups comp.lang.forth
Subject Re: "pattern matching as inverting functions" for "languages without named parameters"
Date 2016-05-07 17:51 -0700
Organization A noiseless patient Spider
Message-ID <87shxt74oe.fsf@jester.gateway.pace.com> (permalink)
References <fefae4e1-f4e0-40ed-b668-4071310ac798@googlegroups.com> <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>

Show all headers | View raw


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).

Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

"pattern matching as inverting functions" for "languages without named parameters" Andreas Wagner <andreas.wagner@lowfatcomputing.org> - 2016-05-03 11:24 -0700
  Re: "pattern matching as inverting functions" for "languages without named parameters" Andreas Wagner <andreas.wagner@lowfatcomputing.org> - 2016-05-03 11:42 -0700
  Re: "pattern matching as inverting functions" for "languages without named parameters" anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-05-06 14:56 +0000
    Re: "pattern matching as inverting functions" for "languages without named parameters" anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-05-06 16:35 +0000
      Re: "pattern matching as inverting functions" for "languages without named parameters" Paul Rubin <no.email@nospam.invalid> - 2016-05-06 09:43 -0700
        Re: "pattern matching as inverting functions" for "languages without named parameters" anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-05-07 13:57 +0000
          Re: "pattern matching as inverting functions" for "languages without named parameters" Paul Rubin <no.email@nospam.invalid> - 2016-05-07 17:51 -0700
            Re: "pattern matching as inverting functions" for "languages without named parameters" anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-05-08 14:02 +0000
    Re: "pattern matching as inverting functions" for "languages without named parameters" "WJ" <w_a_x_man@yahoo.com> - 2016-05-07 14:51 +0000

csiph-web