1
0
Fork 0
factor-puzzles/rosalind/fibd/fibd.factor

13 lines
432 B
Factor
Raw Normal View History

2020-11-29 08:22:10 +01:00
! Copyright (C) 2020 Bubbler.
! See http://factorcode.org/license.txt for BSD license.
USING: io.encodings.utf8 io.files kernel math math.parser
prettyprint sequences splitting ;
IN: rosalind.fibd
: fibd ( n m -- ans )
{ 1 } swap 0 pad-tail swap 1 - [ dup rest sum prefix but-last ] times sum ;
: fibd-main ( -- ) "datasets/rosalind/fibd.txt" utf8 file-contents
" " split [ string>number ] map first2 fibd . ;
MAIN: fibd-main