Re: [stack] A small example of a (possibly concatenative) language for primitive recursive functions of one variable.
Michael Nedzelsky <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
On Wed, 2 May 2007 06:34 am, William Tanksley, Jr wrote:
> I'm glad you're here. This is providing some definitional rigor I
> certainly needed. Thank you for putting the thought into this.
You are welcome. :)
I also find this discussion very useful for me.
> I would need to understand more about "iteration".
I hope the following explanation will be useful:
let f ba a function from natural numbers into natural numbers. Define the
function g as follows:
g (0 ) = 0
g( 1 ) = f(0) # one f
g( 2 ) =f (f(0)) # two f
g (3 ) = f (f f(0))) # three f
...
g (n) = f ( ....f(0)...) # n times f
...
That g is the iteration of f.
Examples (here % means \lambda):
1) if f = %x. 0 then g = %x. 0
2) if f = %x. 1 then g = %x. sgn(x), i.e. g(x)=(if x=0 then 0 else 1)
3) if f = %x. (x+1) then g = %x. x
g(0) =0, g(1) = f(0)=0+1=1, g(2)=f(f(0))=1+1=2 ...
Michael Nedzelsky
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/concatenative/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/concatenative/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[email protected]
mailto:[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/