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


Groups > comp.lang.forth > #26102

Y combinator

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail
Newsgroups comp.lang.forth
Subject Y combinator
References <a4aljf$2q2$1@news.tuwien.ac.at>
From Lars Brinkhoff <lars.spam@nocrew.org>
Organization nocrew
Date Thu, 03 Oct 2013 09:57:52 +0200
Message-ID <85eh82hjlr.fsf@junk.nocrew.org> (permalink)
User-Agent Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)
Cancel-Lock sha1:n4NoO3io2VsqZ6pmkGdGNw8eLro=
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Lines 12
NNTP-Posting-Host 85.229.87.73
X-Trace news.sunsite.dk DXC=iAa_Xb5:ci04KInH<KUX42YSB=nbEKnk;:STM`K3>3j6nY:6X7^ZBN7I57e>YZ9SO;i6C];H\kJ`95oU@eTA=?M0KQ3odHmAcc8
X-Complaints-To staff@sunsite.dk
Xref csiph.com comp.lang.forth:26102

Show key headers only | View raw


> Defining Y in ANS Forth (no RECURSIVE) is left as an exercise to the
> reader:-)

I read, I exercised, I posted.

: y ( xt1 -- xt2 )   here tuck 2>r  1 cells allot
   :noname r> postpone literal postpone @ r> compile, postpone ;
   dup rot ! ;

\ Sample usage, factorial function:
:noname ( u1 xt -- u2 )   over ?dup if 1- swap execute * else 2drop 1 then ;
y 6 swap execute .

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


Thread

Y combinator Lars Brinkhoff <lars.spam@nocrew.org> - 2013-10-03 09:57 +0200
  Re: Y combinator anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-10-03 13:09 +0000
    Re: Y combinator Lars Brinkhoff <lars.spam@nocrew.org> - 2013-10-07 15:06 +0200

csiph-web