Browse Source

Sol Part 66: WE HADOOP NOW

Graham Northup 3 years ago
parent
commit
21e408441d
Signed by: Graham Northup <grissess@nexusg.org> GPG Key ID: 5D000E6F539376FB
2 changed files with 7 additions and 3 deletions
  1. 6
    2
      builtins.c
  2. 1
    1
      sol.h

+ 6
- 2
builtins.c View File

@@ -1403,9 +1403,11 @@ sol_object_t *sol_f_list_truncate(sol_state_t *state, sol_object_t *args) {
1403 1403
 }
1404 1404
 
1405 1405
 sol_object_t *sol_f_list_map(sol_state_t *state, sol_object_t *args) {
1406
-	sol_object_t *list = sol_list_get_index(state, args, 0), *func = sol_list_get_index(state, args, 1);
1406
+	sol_object_t *olist = sol_list_get_index(state, args, 0), *func = sol_list_get_index(state, args, 1);
1407
+	sol_object_t *list = sol_list_copy(state, olist);
1407 1408
 	sol_object_t *fargs = sol_new_list(state), *item;
1408 1409
 	int idx = 0, len = sol_list_len(state, list);
1410
+	sol_obj_free(olist);
1409 1411
 	sol_list_insert(state, fargs, 0, func);
1410 1412
 	while(idx < len) {
1411 1413
 		item = sol_list_get_index(state, list, idx);
@@ -1426,9 +1428,11 @@ sol_object_t *sol_f_list_map(sol_state_t *state, sol_object_t *args) {
1426 1428
 }
1427 1429
 
1428 1430
 sol_object_t *sol_f_list_filter(sol_state_t *state, sol_object_t *args) {
1429
-	sol_object_t *list = sol_list_get_index(state, args, 0), *func = sol_list_get_index(state, args, 1);
1431
+	sol_object_t *olist = sol_list_get_index(state, args, 0), *func = sol_list_get_index(state, args, 1);
1432
+	sol_object_t *list = sol_list_copy(state, olist);
1430 1433
 	sol_object_t *fargs = sol_new_list(state), *item, *ival;
1431 1434
 	int idx = 0, len = sol_list_len(state, list);
1435
+	sol_obj_free(olist);
1432 1436
 	sol_list_insert(state, fargs, 0, func);
1433 1437
 	while(idx < len) {
1434 1438
 		item = sol_list_get_index(state, list, idx);

+ 1
- 1
sol.h View File

@@ -10,7 +10,7 @@
10 10
 #include "dsl/dsl.h"
11 11
 
12 12
 /** The version of the project, as made available through `debug.version`. */
13
-#define SOL_VERSION "0.5a0"
13
+#define SOL_VERSION "0.5a1"
14 14
 /** The hexadecimal version of the project, formatted 0xAAIIRPP where:
15 15
  * 
16 16
  * - AA is the two-digit major version

Loading…
Cancel
Save