I have a list that I get from a lambda, and I want to create (and return) a list that contains an element of a list. Scheme doesn't let me do it.
#lang racket
(define omega
(lambda (n)
(if (= n 0) 'Φ
(cons (omega (- n 1)) '(omega (- n 1))))))
Here're 2 outputs:
> (omega 0)
'Φ
> (omega 1)
'(Φ omega (- n 1))
> (omega 2)
'((Φ omega (- n 1)) omega (- n 1))
The first output is correct, but I want that the second output will be:
'(Φ '(Φ))
and that (omega 2) will return
'(Φ '(Φ) '(Φ '(Φ)))
Actually, the result that I want to have, in mathematical notation, is:
ω(n) = If n=0 return ϕ, else, return ω(n-1)∪{ω(n-1)}