Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #45482
| From | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: YC on Rosetta Code |
| Date | 2016-02-12 12:51 +0000 |
| Organization | Institut fuer Computersprachen, Technische Universitaet Wien |
| Message-ID | <2016Feb12.135128@mips.complang.tuwien.ac.at> (permalink) |
| References | (2 earlier) <22c78045-ac50-4104-9c58-0cc953405cc1@googlegroups.com> <6821ab9f-be45-4ab9-b608-d7e935b0693d@googlegroups.com> <861t8ixxhe.fsf@molnjunk.nocrew.org> <caeb063c-bb63-492f-98c1-7b684e42e54e@googlegroups.com> <56bdbcd8$0$23857$e4fe514c@news.xs4all.nl> |
Albert van der Horst <albert@spenarnc.xs4all.nl> writes:
>I don't have a good intuition about what y does. If I read the Rosetta
>site correctly it is the pinnacle of functional programming, avoiding
>global or local variables and even RECURSE.
Pinnacle is the wrong word. Statically typed functional programming
languages like Haskell cannot define Y (at least not in the usual way)
and don't miss it.
I see it more as a way to show the power of lambda calculus (or,
alternatively, the S and K combinators). There is no obvious way to
define recursive functions (much less loops) in these formalisms,
but there is a way to define the Y combinator, and with that you can
define all functions that you can also define as recursive functions
(in a roundabout way).
More practical programming languages allow direct recursion, so the Y
combinator is not used in practice.
>Eating up dictionary space seems at odds with that.
When you evaluate lamda expressions (or combinatorial expressions)
according to the text book, you get intermediate expressions that can
be arbitrarily much larger than the original expression. The computer
equivalent is using memory; In a Scheme implementation (the closest to
Lambda calculus we usually have), this memory is consumed by a bunch
of closures, and will eventually be garbage-collected. In Forth, we
have no garbage collection, and the natural way to emulate closures is
to generate anonymous colon definitions at run time. This consumes
dictionary memory, but so what; in theoretical computer science,
memory is infinite (or 0), and this is just of theoretical interest.
- 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: http://www.forth200x.org/forth200x.html
EuroForth 2015: http://www.rigwit.co.uk/EuroForth2015/
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
YC on Rosetta Code Lars Brinkhoff <lars.spam@nocrew.org> - 2016-02-11 07:22 +0100
Re: YC on Rosetta Code Lars Brinkhoff <lars.spam@nocrew.org> - 2016-02-11 07:40 +0100
Re: YC on Rosetta Code "WJ" <w_a_x_man@yahoo.com> - 2016-02-11 13:22 +0000
Re: YC on Rosetta Code humptydumpty <ouatubi@gmail.com> - 2016-02-11 13:36 -0800
Re: YC on Rosetta Code humptydumpty <ouatubi@gmail.com> - 2016-02-11 20:48 -0800
Re: YC on Rosetta Code Lars Brinkhoff <lars.spam@nocrew.org> - 2016-02-12 07:18 +0100
Re: YC on Rosetta Code humptydumpty <ouatubi@gmail.com> - 2016-02-11 22:58 -0800
Re: YC on Rosetta Code Lars Brinkhoff <lars.spam@nocrew.org> - 2016-02-12 08:22 +0100
Re: YC on Rosetta Code Albert van der Horst <albert@spenarnc.xs4all.nl> - 2016-02-12 11:07 +0000
Re: YC on Rosetta Code anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-02-12 12:51 +0000
Re: YC on Rosetta Code humptydumpty <ouatubi@gmail.com> - 2016-02-12 11:15 -0800
Re: YC on Rosetta Code humptydumpty <ouatubi@gmail.com> - 2016-02-14 08:19 -0800
Re: YC on Rosetta Code humptydumpty <ouatubi@gmail.com> - 2016-02-11 23:14 -0800
Re: YC on Rosetta Code Lars Brinkhoff <lars.spam@nocrew.org> - 2016-02-12 08:31 +0100
Re: YC on Rosetta Code humptydumpty <ouatubi@gmail.com> - 2016-02-12 00:39 -0800
Re: YC on Rosetta Code humptydumpty <ouatubi@gmail.com> - 2016-02-12 01:21 -0800
Re: YC on Rosetta Code "WJ" <w_a_x_man@yahoo.com> - 2016-02-14 21:48 +0000
csiph-web