nudge 0.2.6 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/instructions/bool/bool_and.rb +8 -0
- data/lib/instructions/bool/bool_define.rb +9 -0
- data/lib/instructions/bool/bool_depth.rb +5 -0
- data/lib/instructions/bool/bool_duplicate.rb +7 -0
- data/lib/instructions/bool/bool_equal_q.rb +8 -0
- data/lib/instructions/bool/bool_flush.rb +3 -0
- data/lib/instructions/bool/bool_not.rb +8 -0
- data/lib/instructions/bool/bool_or.rb +8 -0
- data/lib/instructions/bool/bool_pop.rb +3 -0
- data/lib/instructions/bool/bool_random.rb +3 -0
- data/lib/instructions/bool/bool_rotate.rb +11 -0
- data/lib/instructions/bool/bool_shove.rb +14 -0
- data/lib/instructions/bool/bool_swap.rb +3 -0
- data/lib/instructions/bool/bool_xor.rb +8 -0
- data/lib/instructions/bool/bool_yank.rb +12 -0
- data/lib/instructions/bool/bool_yankdup.rb +12 -0
- data/lib/instructions/code/code_atom_q.rb +9 -0
- data/lib/instructions/code/code_backbone_points.rb +17 -0
- data/lib/instructions/code/code_car.rb +15 -0
- data/lib/instructions/code/code_cdr.rb +13 -1
- data/lib/instructions/code/code_concatenate.rb +20 -0
- data/lib/instructions/code/code_cons.rb +22 -1
- data/lib/instructions/code/code_container.rb +21 -2
- data/lib/instructions/code/code_contains_q.rb +11 -0
- data/lib/instructions/code/code_define.rb +9 -0
- data/lib/instructions/code/code_depth.rb +5 -0
- data/lib/instructions/code/code_discrepancy.rb +13 -7
- data/lib/instructions/code/code_do_count.rb +21 -1
- data/lib/instructions/code/code_do_range.rb +44 -3
- data/lib/instructions/code/code_do_times.rb +39 -1
- data/lib/instructions/code/code_duplicate.rb +7 -0
- data/lib/instructions/code/code_equal_q.rb +9 -0
- data/lib/instructions/code/code_execute.rb +7 -0
- data/lib/instructions/code/code_execute_then_pop.rb +9 -0
- data/lib/instructions/code/code_flush.rb +3 -0
- data/lib/instructions/code/code_gsub.rb +11 -3
- data/lib/instructions/code/code_if.rb +8 -0
- data/lib/instructions/code/code_instructions.rb +12 -0
- data/lib/instructions/code/code_list.rb +10 -0
- data/lib/instructions/code/code_member_q.rb +14 -0
- data/lib/instructions/code/code_name_lookup.rb +10 -0
- data/lib/instructions/code/code_noop.rb +3 -0
- data/lib/instructions/code/code_nth.rb +12 -0
- data/lib/instructions/code/code_nth_cdr.rb +14 -2
- data/lib/instructions/code/code_nth_point.rb +15 -0
- data/lib/instructions/code/code_null_q.rb +11 -0
- data/lib/instructions/code/code_parses_q.rb +8 -0
- data/lib/instructions/code/code_points.rb +8 -0
- data/lib/instructions/code/code_pop.rb +3 -0
- data/lib/instructions/code/code_position.rb +11 -0
- data/lib/instructions/code/code_quote.rb +11 -0
- data/lib/instructions/code/code_replace_nth_point.rb +11 -0
- data/lib/instructions/code/code_rotate.rb +11 -0
- data/lib/instructions/code/code_shove.rb +14 -0
- data/lib/instructions/code/code_swap.rb +3 -0
- data/lib/instructions/code/code_yank.rb +12 -0
- data/lib/instructions/code/code_yankdup.rb +12 -0
- data/lib/instructions/conversion/bool_from_float.rb +9 -0
- data/lib/instructions/conversion/bool_from_int.rb +9 -0
- data/lib/instructions/conversion/code_from_bool.rb +9 -1
- data/lib/instructions/conversion/code_from_float.rb +10 -1
- data/lib/instructions/conversion/code_from_int.rb +10 -1
- data/lib/instructions/conversion/code_from_name.rb +10 -1
- data/lib/instructions/conversion/float_from_bool.rb +9 -0
- data/lib/instructions/conversion/float_from_int.rb +9 -0
- data/lib/instructions/conversion/int_from_bool.rb +9 -0
- data/lib/instructions/conversion/int_from_float.rb +9 -0
- data/lib/instructions/exec/exec_define.rb +9 -0
- data/lib/instructions/exec/exec_depth.rb +5 -0
- data/lib/instructions/exec/exec_do_count.rb +22 -0
- data/lib/instructions/exec/exec_do_range.rb +43 -0
- data/lib/instructions/exec/exec_do_times.rb +40 -0
- data/lib/instructions/exec/exec_duplicate.rb +7 -0
- data/lib/instructions/exec/exec_equal_q.rb +9 -0
- data/lib/instructions/exec/exec_flush.rb +5 -0
- data/lib/instructions/exec/exec_if.rb +8 -0
- data/lib/instructions/exec/exec_k.rb +4 -0
- data/lib/instructions/exec/exec_pop.rb +3 -0
- data/lib/instructions/exec/exec_rotate.rb +11 -0
- data/lib/instructions/exec/exec_s.rb +11 -0
- data/lib/instructions/exec/exec_shove.rb +14 -0
- data/lib/instructions/exec/exec_swap.rb +3 -0
- data/lib/instructions/exec/exec_y.rb +18 -0
- data/lib/instructions/exec/exec_yank.rb +12 -0
- data/lib/instructions/exec/exec_yankdup.rb +12 -0
- data/lib/instructions/float/float_abs.rb +8 -0
- data/lib/instructions/float/float_add.rb +8 -0
- data/lib/instructions/float/float_cosine.rb +8 -0
- data/lib/instructions/float/float_define.rb +9 -0
- data/lib/instructions/float/float_depth.rb +5 -0
- data/lib/instructions/float/float_divide.rb +12 -0
- data/lib/instructions/float/float_duplicate.rb +7 -0
- data/lib/instructions/float/float_equal_q.rb +8 -0
- data/lib/instructions/float/float_flush.rb +3 -0
- data/lib/instructions/float/float_greater_than_q.rb +9 -0
- data/lib/instructions/float/float_if.rb +8 -0
- data/lib/instructions/float/float_less_than_q.rb +9 -0
- data/lib/instructions/float/float_max.rb +8 -0
- data/lib/instructions/float/float_min.rb +8 -0
- data/lib/instructions/float/float_modulo.rb +12 -0
- data/lib/instructions/float/float_multiply.rb +8 -0
- data/lib/instructions/float/float_negative.rb +8 -0
- data/lib/instructions/float/float_pop.rb +3 -0
- data/lib/instructions/float/float_power.rb +12 -0
- data/lib/instructions/float/float_random.rb +3 -0
- data/lib/instructions/float/float_rotate.rb +11 -0
- data/lib/instructions/float/float_shove.rb +14 -0
- data/lib/instructions/float/float_sine.rb +8 -0
- data/lib/instructions/float/float_sqrt.rb +10 -0
- data/lib/instructions/float/float_subtract.rb +10 -0
- data/lib/instructions/float/float_swap.rb +3 -0
- data/lib/instructions/float/float_tangent.rb +8 -0
- data/lib/instructions/float/float_yank.rb +12 -0
- data/lib/instructions/float/float_yankdup.rb +12 -0
- data/lib/instructions/int/int_abs.rb +9 -1
- data/lib/instructions/int/int_add.rb +8 -0
- data/lib/instructions/int/int_define.rb +10 -1
- data/lib/instructions/int/int_depth.rb +5 -0
- data/lib/instructions/int/int_divide.rb +12 -0
- data/lib/instructions/int/int_duplicate.rb +7 -0
- data/lib/instructions/int/int_equal_q.rb +8 -0
- data/lib/instructions/int/int_flush.rb +3 -0
- data/lib/instructions/int/int_greater_than_q.rb +9 -0
- data/lib/instructions/int/int_if.rb +8 -0
- data/lib/instructions/int/int_less_than_q.rb +9 -0
- data/lib/instructions/int/int_max.rb +8 -0
- data/lib/instructions/int/int_min.rb +8 -0
- data/lib/instructions/int/int_modulo.rb +12 -0
- data/lib/instructions/int/int_multiply.rb +8 -0
- data/lib/instructions/int/int_negative.rb +8 -0
- data/lib/instructions/int/int_pop.rb +3 -0
- data/lib/instructions/int/int_power.rb +12 -0
- data/lib/instructions/int/int_random.rb +3 -0
- data/lib/instructions/int/int_rotate.rb +11 -0
- data/lib/instructions/int/int_shove.rb +14 -0
- data/lib/instructions/int/int_subtract.rb +10 -0
- data/lib/instructions/int/int_swap.rb +3 -0
- data/lib/instructions/int/int_yank.rb +14 -0
- data/lib/instructions/int/int_yankdup.rb +14 -0
- data/lib/instructions/name/name_depth.rb +5 -0
- data/lib/instructions/name/name_disable_lookup.rb +11 -0
- data/lib/instructions/name/name_duplicate.rb +7 -0
- data/lib/instructions/name/name_equal_q.rb +8 -0
- data/lib/instructions/name/name_flush.rb +3 -0
- data/lib/instructions/name/name_next.rb +7 -0
- data/lib/instructions/name/name_pop.rb +3 -0
- data/lib/instructions/name/name_random_bound.rb +9 -0
- data/lib/instructions/name/name_rotate.rb +11 -0
- data/lib/instructions/name/name_shove.rb +14 -0
- data/lib/instructions/name/name_swap.rb +3 -0
- data/lib/instructions/name/name_unbind.rb +7 -0
- data/lib/instructions/name/name_yank.rb +12 -0
- data/lib/instructions/name/name_yankdup.rb +12 -0
- data/spec/instructions/code/code_nth_cdr_spec.rb +10 -2
- metadata +3 -3
@@ -1,3 +1,11 @@
|
|
1
|
+
# pops the top 2 items of the +:exec+ stack, and one +:bool+;
|
2
|
+
# returns the top +:exec+ item if the +:bool+ is +false+, the second one if +true+
|
3
|
+
#
|
4
|
+
# *needs:* 2 +:exec+, 1 +:bool+
|
5
|
+
#
|
6
|
+
# *pushes:* 1 +:exec+
|
7
|
+
#
|
8
|
+
|
1
9
|
class ExecIfInstruction < Instruction
|
2
10
|
|
3
11
|
include IfInstruction
|
@@ -1,3 +1,14 @@
|
|
1
|
+
# pops the top 3 items of the +:exec+ stack;
|
2
|
+
# pushes them back in _rotated_ order
|
3
|
+
#
|
4
|
+
# If they were A, B and C (with C originally at the top of the stack)
|
5
|
+
# the result will be B, C, A (with A at the top)
|
6
|
+
#
|
7
|
+
# *needs:* 3 +:exec+
|
8
|
+
#
|
9
|
+
# *pushes:* 3 +:exec+
|
10
|
+
#
|
11
|
+
|
1
12
|
class ExecRotateInstruction < Instruction
|
2
13
|
include RotateInstruction
|
3
14
|
def initialize(context)
|
@@ -1,3 +1,14 @@
|
|
1
|
+
# Implements the S Combinator on the +:exec+ stack:
|
2
|
+
# if the top three items on the stack are A, B, C (in top-to-bottom order), this pushes
|
3
|
+
# 1. a CodeBlock containing B and C (in that order)
|
4
|
+
# 2. C
|
5
|
+
# 3. A
|
6
|
+
#
|
7
|
+
# *needs:* 3 +:exec+ items
|
8
|
+
#
|
9
|
+
# *pushes:* 3 +:exec+ items
|
10
|
+
#
|
11
|
+
|
1
12
|
class ExecSInstruction < Instruction
|
2
13
|
def preconditions?
|
3
14
|
needs :exec, 3
|
@@ -1,3 +1,17 @@
|
|
1
|
+
# pops the top items of the +:exec+ and +:int+ stacks;
|
2
|
+
# pushes the +:exec+ down "into" the stack, at a level determined by the +:int+ "destination" value.
|
3
|
+
#
|
4
|
+
# If the destination value is negative or 0, the item stays on top;
|
5
|
+
# if the destination value is greater than or equal to the depth of the stack, the item goes to the bottom;
|
6
|
+
# otherwise, the item is inserted farther from the stack's top as the destination value increases.
|
7
|
+
#
|
8
|
+
# note: the destination depth is calculated after the items have been popped
|
9
|
+
#
|
10
|
+
# *needs:* 1 +:exec+, 1 +:int+
|
11
|
+
#
|
12
|
+
# *pushes:* 1 +:exec+ (sortof)
|
13
|
+
#
|
14
|
+
|
1
15
|
class ExecShoveInstruction < Instruction
|
2
16
|
include ShoveInstruction
|
3
17
|
def initialize(context)
|
@@ -1,3 +1,21 @@
|
|
1
|
+
# Implements the Y Combinator on the +:exec+ stack:
|
2
|
+
# pops the top item from the +:exec+ stack, then
|
3
|
+
# pushes:
|
4
|
+
# * a CodeBlockPoint with the following macro:
|
5
|
+
# block {
|
6
|
+
# do exec_y
|
7
|
+
# popped_item
|
8
|
+
# }
|
9
|
+
# * the +popped_item+ (again)
|
10
|
+
#
|
11
|
+
# The result is an (arguably infinite) recursive call of the +popped_item+; it will run once, then
|
12
|
+
# the macro will be encountered and the process will repeat.
|
13
|
+
#
|
14
|
+
# *needs:* 1 +:exec+ item
|
15
|
+
#
|
16
|
+
# *pushes:* 2 +:exec+ items
|
17
|
+
|
18
|
+
|
1
19
|
class ExecYInstruction < Instruction
|
2
20
|
def preconditions?
|
3
21
|
needs :exec, 1
|
@@ -1,3 +1,15 @@
|
|
1
|
+
# pops the top item of the +:int+ stack (the "index");
|
2
|
+
# then repositions an item from down "inside" the +:exec+ stack to its top.
|
3
|
+
#
|
4
|
+
# If the index value is negative or 0, the bottom item on the stack is moved;
|
5
|
+
# if the index value is greater than or equal to the depth of the stack, there is no change;
|
6
|
+
# otherwise, the index value refers to the bottom-to-top order of stack items.
|
7
|
+
#
|
8
|
+
# *needs:* 1 +:int+, 1 +:exec+
|
9
|
+
#
|
10
|
+
# *pushes:* 1 +:exec+ (sortof)
|
11
|
+
#
|
12
|
+
|
1
13
|
class ExecYankInstruction < Instruction
|
2
14
|
include YankInstruction
|
3
15
|
def initialize(context)
|
@@ -1,3 +1,15 @@
|
|
1
|
+
# pops the top item of the +:int+ stack (the "index");
|
2
|
+
# pushes a duplicate of an item from down "inside" the +:exec+ stack to its top.
|
3
|
+
#
|
4
|
+
# If the index value is negative or 0, the bottom item on the stack is copied;
|
5
|
+
# if the index value is greater than or equal to the depth of the stack, the top item is copied;
|
6
|
+
# otherwise, the index value refers to the bottom-to-top order of stack items.
|
7
|
+
#
|
8
|
+
# *needs:* 1 +:int+, 1 +:exec+
|
9
|
+
#
|
10
|
+
# *pushes:* 1 +:exec+ (sortof)
|
11
|
+
#
|
12
|
+
|
1
13
|
class ExecYankdupInstruction < Instruction
|
2
14
|
include YankdupInstruction
|
3
15
|
def initialize(context)
|
@@ -1,3 +1,11 @@
|
|
1
|
+
# pops the top item of the +:float+ stack;
|
2
|
+
# pushes a ValuePoint with its absolute value onto the +:float+ stack
|
3
|
+
#
|
4
|
+
# *needs:* 1 +:float+
|
5
|
+
#
|
6
|
+
# *pushes:* 1 +:float+
|
7
|
+
#
|
8
|
+
|
1
9
|
class FloatAbsInstruction < Instruction
|
2
10
|
def preconditions?
|
3
11
|
needs :float, 1
|
@@ -1,3 +1,12 @@
|
|
1
|
+
# pops the top item of the +:float+ stack and the +:name+ stack;
|
2
|
+
# if the name string is not a bound variable (as opposed to a local name),
|
3
|
+
# it binds the name to the +:float+ ValuePoint
|
4
|
+
#
|
5
|
+
# *needs:* 1 +:float+, 1 +:name+
|
6
|
+
#
|
7
|
+
# *pushes:* nothing
|
8
|
+
#
|
9
|
+
|
1
10
|
class FloatDefineInstruction < Instruction
|
2
11
|
include DefineInstruction
|
3
12
|
def initialize(context)
|
@@ -1,3 +1,15 @@
|
|
1
|
+
# pops the top 2 items of the +:float+ stack;
|
2
|
+
# pushes a ValuePoint with their (floating point) quotient onto the +:float+ stack
|
3
|
+
#
|
4
|
+
# note: the top item is the denominator, the second item is the numerator
|
5
|
+
#
|
6
|
+
# note: will push an +:error+ ValuePoint instead of an +:int+ if the numerator is 0.0
|
7
|
+
#
|
8
|
+
# *needs:* 2 +:float+
|
9
|
+
#
|
10
|
+
# *pushes:* 1 +:float+
|
11
|
+
#
|
12
|
+
|
1
13
|
class FloatDivideInstruction < Instruction
|
2
14
|
def preconditions?
|
3
15
|
needs :float, 2
|
@@ -1,3 +1,11 @@
|
|
1
|
+
# pops the top 2 items of the +:float+ stack;
|
2
|
+
# pushes a new ValuePoint onto the +:bool+ stack, with its value +true+ if the popped values are identical
|
3
|
+
#
|
4
|
+
# *needs:* 2 +:float+
|
5
|
+
#
|
6
|
+
# *pushes:* 1 +:bool+
|
7
|
+
#
|
8
|
+
|
1
9
|
class FloatEqualQInstruction < Instruction
|
2
10
|
def preconditions?
|
3
11
|
needs :float, 2
|
@@ -1,3 +1,12 @@
|
|
1
|
+
# pops the top 2 items of the +:float+ stack;
|
2
|
+
# pushes a new ValuePoint onto the +:bool+ stack,
|
3
|
+
# with value +true+ if the second one is strictly greater than the top one
|
4
|
+
#
|
5
|
+
# *needs:* 2 +:float+
|
6
|
+
#
|
7
|
+
# *pushes:* 1 +:bool+
|
8
|
+
#
|
9
|
+
|
1
10
|
class FloatGreaterThanQInstruction < Instruction
|
2
11
|
def preconditions?
|
3
12
|
needs :float, 2
|
@@ -1,3 +1,11 @@
|
|
1
|
+
# pops the top 2 items of the +:float+ stack, and one +:bool+;
|
2
|
+
# returns the top +:float+ item if the +:bool+ is +false+, the second one if +true+
|
3
|
+
#
|
4
|
+
# *needs:* 2 +:float+, 1 +:bool+
|
5
|
+
#
|
6
|
+
# *pushes:* 1 +:float+
|
7
|
+
#
|
8
|
+
|
1
9
|
class FloatIfInstruction < Instruction
|
2
10
|
|
3
11
|
include IfInstruction
|
@@ -1,3 +1,12 @@
|
|
1
|
+
# pops the top 2 items of the +:float+ stack;
|
2
|
+
# pushes a new ValuePoint onto the +:bool+ stack,
|
3
|
+
# with value +true+ if the second one is strictly less than the top one
|
4
|
+
#
|
5
|
+
# *needs:* 2 +:float+
|
6
|
+
#
|
7
|
+
# *pushes:* 1 +:bool+
|
8
|
+
#
|
9
|
+
|
1
10
|
class FloatLessThanQInstruction < Instruction
|
2
11
|
def preconditions?
|
3
12
|
needs :float, 2
|
@@ -1,3 +1,11 @@
|
|
1
|
+
# pops the top 2 items of the +:float+ stack;
|
2
|
+
# pushes a new ValuePoint onto the +:float+ stack with the largest of the two values
|
3
|
+
#
|
4
|
+
# *needs:* 2 +:float+
|
5
|
+
#
|
6
|
+
# *pushes:* 1 +:float+
|
7
|
+
#
|
8
|
+
|
1
9
|
class FloatMaxInstruction < Instruction
|
2
10
|
def preconditions?
|
3
11
|
needs :float, 2
|
@@ -1,3 +1,11 @@
|
|
1
|
+
# pops the top 2 items of the +:float+ stack;
|
2
|
+
# pushes a new ValuePoint onto the +:float+ stack with the smallest of the two values
|
3
|
+
#
|
4
|
+
# *needs:* 2 +:float+
|
5
|
+
#
|
6
|
+
# *pushes:* 1 +:float+
|
7
|
+
#
|
8
|
+
|
1
9
|
class FloatMinInstruction < Instruction
|
2
10
|
def preconditions?
|
3
11
|
needs :float, 2
|
@@ -1,3 +1,15 @@
|
|
1
|
+
# pops the top 2 items of the +:float+ stack;
|
2
|
+
# pushes a ValuePoint with the remainder after dividing the second into the first onto the +:float+ stack
|
3
|
+
#
|
4
|
+
# note: the top item is the denominator, the second item is the numerator
|
5
|
+
#
|
6
|
+
# note: will push an +:error+ ValuePoint instead of a +:float+ if the numerator is 0.0
|
7
|
+
#
|
8
|
+
# *needs:* 2 +:float+
|
9
|
+
#
|
10
|
+
# *pushes:* 1 +:float+
|
11
|
+
#
|
12
|
+
|
1
13
|
class FloatModuloInstruction < Instruction
|
2
14
|
def preconditions?
|
3
15
|
needs :float, 2
|
@@ -1,3 +1,11 @@
|
|
1
|
+
# pops the top 2 items of the +:float+ stack;
|
2
|
+
# pushes a ValuePoint with their product onto the +:float+ stack
|
3
|
+
#
|
4
|
+
# *needs:* 2 +:float+
|
5
|
+
#
|
6
|
+
# *pushes:* 1 +:float+
|
7
|
+
#
|
8
|
+
|
1
9
|
class FloatMultiplyInstruction < Instruction
|
2
10
|
def preconditions?
|
3
11
|
needs :float, 2
|
@@ -1,3 +1,11 @@
|
|
1
|
+
# pops the top item of the +:float+ stack;
|
2
|
+
# pushes a ValuePoint with the value negated onto the +:float+ stack
|
3
|
+
#
|
4
|
+
# *needs:* 1 +:float+
|
5
|
+
#
|
6
|
+
# *pushes:* 1 +:float+
|
7
|
+
#
|
8
|
+
|
1
9
|
class FloatNegativeInstruction < Instruction
|
2
10
|
def preconditions?
|
3
11
|
needs :float, 1
|
@@ -1,3 +1,15 @@
|
|
1
|
+
# pops the top 2 items of the +:float+ stack;
|
2
|
+
# pushes a ValuePoint with value x**y, where x is the second stack item, y the top one
|
3
|
+
#
|
4
|
+
# note: the top item is the exponent, the second item is the base
|
5
|
+
#
|
6
|
+
# note: will push an +:error+ ValuePoint instead of a +:float+ if the operation doesn't return a float
|
7
|
+
#
|
8
|
+
# *needs:* 2 +:float+
|
9
|
+
#
|
10
|
+
# *pushes:* 1 +:float+
|
11
|
+
#
|
12
|
+
|
1
13
|
class FloatPowerInstruction < Instruction
|
2
14
|
def preconditions?
|
3
15
|
needs :float, 2
|
@@ -1,3 +1,14 @@
|
|
1
|
+
# pops the top 3 items of the +:float+ stack;
|
2
|
+
# pushes them back in _rotated_ order
|
3
|
+
#
|
4
|
+
# If they were A, B and C (with C originally at the top of the stack)
|
5
|
+
# the result will be B, C, A (with A at the top)
|
6
|
+
#
|
7
|
+
# *needs:* 3 +:float+
|
8
|
+
#
|
9
|
+
# *pushes:* 3 +:float+
|
10
|
+
#
|
11
|
+
|
1
12
|
class FloatRotateInstruction < Instruction
|
2
13
|
include RotateInstruction
|
3
14
|
def initialize(context)
|
@@ -1,3 +1,17 @@
|
|
1
|
+
# pops the top items of the +:float+ and +:int+ stacks;
|
2
|
+
# pushes the +:float+ down "into" the stack, at a level determined by the +:int+ "destination" value.
|
3
|
+
#
|
4
|
+
# If the destination value is negative or 0, the item stays on top;
|
5
|
+
# if the destination value is greater than or equal to the depth of the stack, the item goes to the bottom;
|
6
|
+
# otherwise, the item is inserted farther from the stack's top as the destination value increases.
|
7
|
+
#
|
8
|
+
# note: the destination depth is calculated after the items have been popped
|
9
|
+
#
|
10
|
+
# *needs:* 1 +:float+, 1 +:int+
|
11
|
+
#
|
12
|
+
# *pushes:* 1 +:float+ (sortof)
|
13
|
+
#
|
14
|
+
|
1
15
|
class FloatShoveInstruction < Instruction
|
2
16
|
include ShoveInstruction
|
3
17
|
def initialize(context)
|