Sujet : Re: how
De : james.g.burns (at) *nospam* att.net (Jim Burns)
Groupes : sci.mathDate : 17. Jun 2024, 18:46:08
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <2f3894b7-df77-438a-b9fa-85011f01e9f6@att.net>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13
User-Agent : Mozilla Thunderbird
On 6/15/2024 2:01 AM, Chris M. Thomasson wrote:
On 5/2/2024 10:06 AM, Moebius wrote:
[...]
>
Fwiw,
here how I generally write my recursive functions.
Say the natural numbers, including zero here:
>
r[0] = 0
r[n + 1] = r[n] + 1
>
Lets expand that for a couple of iterations:
>
r[0] = 0
r[1] = r[0] + 1 = 1
r[2] = r[1] + 1 = 2
r[3] = r[2] + 1 = 3
...
>
[n] where n is an index
>
vs:
>
r_0 = 0
r_(n+1) = r_n + 1
>
Both seem okay to me, as in
I can understand both of them.
There are two Great Families of programming languages,
imperative languages and declarative languages.
https://en.wikipedia.org/wiki/Declarative_programming| Many languages that apply this [declarative] style
| attempt to minimize or eliminate side effects by
| describing what the program must accomplish in terms of
| the problem domain, rather than describing how to
| accomplish it as a sequence of the programming language
| primitives (the how being left up to the language's
| implementation). This is in contrast with imperative
| programming, which implements algorithms in
| explicit steps.
|
| Declarative programming often considers programs as
| theories of a formal logic, and computations as
| deductions in that logic space.
You seem to have there a little imperative programming
and a little declarative programming.
Personally, I find I need to _think differently_ when
I move from one to the other, more than _changing gears_
closer to _removing one engine and installing another_
I speculate that WM doesn't do declarative programming,
at all.
Being able to talk about _finite sequences_
allows us to define recursively, which allows us
quite a lot.
Define r[n] as the end of finite sequence SEQ
⟨ r[0] r[1] r[2] r[3] ... r[n] ⟩
such that
SEQ begins with 0 and
for each split F SEQ\F of ⟨ r[0] ... r[n] ⟩
exist i end if foresplit F and
j start of hindsplit SEQ\F
such that i+1 = j
In general, for
r(0,x) = f(x)
r(n+1,x) = g(n,r(n,x),x)
r(n,x) = y ⇔
∃SEQ:
⟨0,f(x)⟩ ≼ᴬ∈ SEQ ∋ᴬ≼ ⟨n,y⟩ ∧
∀F ⊆ SEQ: ∅ ≠ F ᴬ≺ᴬ SEQ\F ≠ ∅ ⇒
∃⟨i,u⟩ ≽ᴬ∈ F:
∃⟨j,v⟩ ≼ᴬ∈ SEQ\F:
v = g(i,u,x) ∧ j = i+1