Class: Toy::Step
- Inherits:
-
Object
- Object
- Toy::Step
- Defined in:
- lib/toy/dev/toy_card.rb
Overview
One step in the algorithm body.
‘kind` discriminates how the renderer formats this step:
"bind" var ← expr_str (numbered)
"update" var ← expr_str (numbered; same as bind, semantically distinct)
"loop_open" for <expr_str> do (numbered; indents subsequent steps)
"loop_close" end for (numbered; outdents)
"return" return var (numbered)
"comment" ▷ note (un-numbered; for inline ▷ comments
attached to the previous step)
‘shape` is the right-side annotation (`e ∈ R^T×D` etc.); blank skips it. `note` is an inline ▷ comment appended after the step.
Instance Attribute Summary collapse
-
#expr_str ⇒ Object
Returns the value of attribute expr_str.
-
#kind ⇒ Object
Returns the value of attribute kind.
-
#note ⇒ Object
Returns the value of attribute note.
-
#shape ⇒ Object
Returns the value of attribute shape.
-
#var ⇒ Object
Returns the value of attribute var.
Instance Method Summary collapse
-
#initialize(kind, var, expr_str, shape, note) ⇒ Step
constructor
A new instance of Step.
Constructor Details
#initialize(kind, var, expr_str, shape, note) ⇒ Step
Returns a new instance of Step.
77 78 79 80 81 82 83 |
# File 'lib/toy/dev/toy_card.rb', line 77 def initialize(kind, var, expr_str, shape, note) @kind = kind @var = var @expr_str = expr_str @shape = shape @note = note end |
Instance Attribute Details
#expr_str ⇒ Object
Returns the value of attribute expr_str.
75 76 77 |
# File 'lib/toy/dev/toy_card.rb', line 75 def expr_str @expr_str end |
#kind ⇒ Object
Returns the value of attribute kind.
75 76 77 |
# File 'lib/toy/dev/toy_card.rb', line 75 def kind @kind end |
#note ⇒ Object
Returns the value of attribute note.
75 76 77 |
# File 'lib/toy/dev/toy_card.rb', line 75 def note @note end |
#shape ⇒ Object
Returns the value of attribute shape.
75 76 77 |
# File 'lib/toy/dev/toy_card.rb', line 75 def shape @shape end |
#var ⇒ Object
Returns the value of attribute var.
75 76 77 |
# File 'lib/toy/dev/toy_card.rb', line 75 def var @var end |