fibonacci#

fibonacci($n_or_pdl) – Fibonacci sequence constructor.

Mirrors upstream PDL::fibonacci (Primitive.pd pp_def 'fibonacci', Pars => 'i(n); [o]x(n)'). The engine op pdl_run_fibonacci(i, x) writes x[k] = x1+x2 with x1=1, x2=0 initially and the standard carry { x2=x1; x1=x[k] } from k>0, producing 1,1,2,3,5,8,13,....

Two call forms, mirroring upstream’s PDL::fibonacci wrapper:

  • fibonacci(N) — scalar integer → N-element pdl

  • $pdl->fibonacci — fills $pdl in-place (inplace flag)

The connector prepares the i input pdl (a sequence of counter values, shape-match the desired output) and lets the engine do the actual recurrence.