Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

raku fibonacci

# lazy infinite sequence that contains fibonacci numbers
# * consumes one variable and so * + * the next term would eval to 0 + 1, afterwards consuming the next top 2. 
# [^100] indexes the list from 0 to 99 and will grab those indices.
# >>. is a map operator on the list and using the function say to print them
# beware >> may not always work in correct order if the function has side effects, you can always use @A.map(*.say) or .say for @A

(0, 1, * + * ... *)[^100]>>.say
 
PREVIOUS NEXT
Tagged: #raku #fibonacci
ADD COMMENT
Topic
Name
5+9 =