diff options
Diffstat (limited to 'src/stem.c')
-rw-r--r-- | src/stem.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -39,15 +39,15 @@ void array_append(array_t *a, value_t *v) { a->size++; } -void array_curry(array_t *a, value_t *v) { +void array_add(array_t *a, value_t *v, int index) { if (a->size >= a->capacity - 3) { a->capacity = a->capacity * 2; a->items = realloc(a->items, a->capacity * sizeof(value_t *)); } - for (int i = a->size - 1; i >= 0; i--) { + for (int i = a->size - 1; i >= index; i--) { a->items[i + 1] = a->items[i]; } - a->items[0] = v; + a->items[index] = v; a->size++; } |