Sha256: 60c1215662797a6386221d055ac986709485b25253765a787af2e170a51e0456

Contents?: true

Size: 786 Bytes

Versions: 1

Compression:

Stored size: 786 Bytes

Contents

Rule Main
  output 'result.txt'
  param $NUM := 3
Flow
  rule Fib
  rule Result
End

Rule Fib0
  output 'fib0.txt'
Action
  echo -n '0' > fib0.txt
End

Rule Fib1
  output 'fib1.txt'
Action
  echo -n '1' > fib1.txt
End

Rule Fib
  output 'fib{$NUM}.txt'
  param $NUM
Flow
  case $NUM
  when 0
    rule Fib0
  when 1
    rule Fib1
  else
    $P1 := $NUM - 2
    $P2 := $NUM - 1
    rule Fib.params({NUM: $P1})
    rule Fib.params({NUM: $P2})
    rule Calc.params({NUM: $NUM, P1: $P1, P2: $P2})
  end
End

Rule Calc
  input 'fib{$P1}.txt'
  input 'fib{$P2}.txt'
  output 'fib{$NUM}.txt'
  param $NUM
  param $P1
  param $P2
Action
  expr `cat {$I[1]}` + `cat {$I[2]}` > {$O[1]}
End

Rule Result
  input 'fib{$NUM}.txt'
  output 'result.txt'
  param $NUM
Action
  cat {$I[1]} > {$O[1]}
End

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pione-0.1.0 example/Fib/Fib.pione