// (vector-ref x index) Cell* op_vecref(Scheme *sc) { int index = long_value(second(sc->args)); if (index < 0 || index >= long_value(first(sc->args))) { return error_helper(sc, "vector-ref: out of bounds:", second(sc->args)); } return s_return_helper(sc, get_vector_item(first(sc->args), index)); }
void help_action(vector_t *arguments) { // basically I did a little hack where the hashmap // is the first argument on here map_t *commands = get_vector_item(arguments, 0); printf("%s\n", help_template); hashmap_iterate(commands, print_command, NULL); printf("\n"); }
vector_item getVectorTop(vector_t *vec) { return get_vector_item(vec, vec->size - 1); }