Deutsch English Français Italiano |
<2024Sep14.170836@mips.complang.tuwien.ac.at> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!3.eu.feeder.erje.net!feeder.erje.net!news.in-chemnitz.de!news.swapon.de!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: anton@mips.complang.tuwien.ac.at (Anton Ertl) Newsgroups: comp.lang.forth Subject: Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!] Date: Sat, 14 Sep 2024 15:08:36 GMT Organization: Institut fuer Computersprachen, Technische Universitaet Wien Lines: 37 Message-ID: <2024Sep14.170836@mips.complang.tuwien.ac.at> References: <nnd$61e0ad9a$48ed61c2@b4d945e456041481> <vasqjd$icjm$1@dont-email.me> <66d26c4b$1@news.ausics.net> <vaubf7$tbke$1@dont-email.me> <nnd$04cff141$0193ba04@301336b8dd8ed69a> <vbfqnd$v4c4$1@dont-email.me> <nnd$26b4d59b$27bdb181@ce638e508b04426e> <87bk0vbvgk.fsf@nightsong.com> <66e0fa58$1@news.ausics.net> <66e11d64$1@news.ausics.net> <877cbh4b6z.fsf@nightsong.com> <66e2a497$1@news.ausics.net> <2024Sep14.143207@mips.complang.tuwien.ac.at> <e29088cacf765cd0da6519e333fa78f1@www.novabbs.com> Injection-Date: Sat, 14 Sep 2024 17:25:07 +0200 (CEST) Injection-Info: dont-email.me; posting-host="6db5ee5180e7e79132e55bada9f3289b"; logging-data="1533181"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+IyS3/zJKBQY4Pu+sKoY+h" Cancel-Lock: sha1:0WP+6Fg2IMVcwawVcuUCycToenU= X-newsreader: xrn 10.11 Bytes: 2572 melahi_ahmed@yahoo.fr (Ahmed) writes: >Hi, >In fuzzy logic, a triangular membership function mf(x;a,b,c) is defined >as: > >mf(x;a,b,c) = (x-a)/(b-a) for a <= x < b, > (c-x)/(c-b) for b <= x < c, > 0e elsewere. > >defining it with locals: > >: tri_mf() { f: x f: a f: b f: c } ( f: x a b c -- mv) > x a f>= x b f< and if x a f- b a f- f/ exit then > x b f>= x c f< and if c x f- c b f- f/ exit then > 0e >; > >But defining it without locals ????!!!!! > >: tri_mf() ( f: x a b c -- mv) .... > >How? I wonder if the notation "mf(x;a,b,c)" indicates that a,b,c is a tuble that tends to get passed around without changing it. In that case defining it as a structure in memory and accessing its members there might be a solution. But OTOH, unless you see programming in Forth as a religious exercise, why worry, as long as your solution works. - anton -- M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html New standard: https://forth-standard.org/ EuroForth 2024: https://euro.theforth.net