Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
66
Task/Padovan-sequence/Quackery/padovan-sequence.quackery
Normal file
66
Task/Padovan-sequence/Quackery/padovan-sequence.quackery
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
( --------------------- Recurrence -------------------- )
|
||||
|
||||
[ dup 0 = iff
|
||||
[ drop ' [ ] ] done
|
||||
dup 1 = iff
|
||||
[ drop ' [ 1 ] ] done
|
||||
dip [ [] 0 1 1 ]
|
||||
2 - times
|
||||
[ dip [ 2dup + ] swap
|
||||
3 pack dip join
|
||||
unpack ]
|
||||
3 times join behead drop ] is padovan1 ( n --> [ )
|
||||
|
||||
say "With recurrence: " 20 padovan1 echo cr cr
|
||||
|
||||
|
||||
( ------------------- Floor Function ------------------ )
|
||||
|
||||
$ "bigrat.qky" loadfile
|
||||
|
||||
[ [ $ "1.324717957244746025960908854"
|
||||
$->v drop join ] constant
|
||||
do ] is p ( --> n/d )
|
||||
|
||||
[ [ $ "1.0453567932525329623"
|
||||
$->v drop join ] constant
|
||||
do ] is s ( --> n/d )
|
||||
|
||||
[ 1 -
|
||||
p rot v** s v/ 1 2 v+ / ] is padovan2 ( n --> n )
|
||||
|
||||
say "With floor function: "
|
||||
[]
|
||||
20 times [ i^ padovan2 join ]
|
||||
echo cr cr
|
||||
|
||||
|
||||
( ---------------------- L-System --------------------- )
|
||||
|
||||
[ $ "" swap witheach
|
||||
[ nested quackery join ] ] is expand ( $ --> $ )
|
||||
|
||||
[ $ "B" ] is A ( $ --> $ )
|
||||
|
||||
[ $ "C" ] is B ( $ --> $ )
|
||||
|
||||
[ $ "AB" ] is C ( $ --> $ )
|
||||
|
||||
$ "A"
|
||||
|
||||
say "First 10 L System strings: "
|
||||
9 times
|
||||
[ dup echo$ sp
|
||||
expand ]
|
||||
echo$ cr cr
|
||||
|
||||
[] $ "A"
|
||||
31 times
|
||||
[ dup size
|
||||
swap dip join
|
||||
expand ]
|
||||
size join
|
||||
|
||||
32 padovan1 = iff
|
||||
[ say "The first 32 recurrence terms and L System lengths are the same." ]
|
||||
else [ say "Oh no! It's all gone pear-shaped!" ]
|
||||
Loading…
Add table
Add a link
Reference in a new issue