changeset 342:884cd5d54c0f

Bugfix to array find:withDefault and a small optimization to array map
author Michael Pavone <pavone@retrodev.com>
date Sun, 05 Apr 2015 22:49:40 -0700
parents 6871e72b6db2
children 21e20c9bb2ba
files modules/array.tp
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/modules/array.tp	Sun Apr 05 22:48:59 2015 -0700
+++ b/modules/array.tp	Sun Apr 05 22:49:40 2015 -0700
@@ -98,6 +98,7 @@
 
 	map <- :fun {
 		new <- #[]
+		new resize: length
 		foreach: self :idx el {
 			new append: (fun: el)
 		}
@@ -126,6 +127,8 @@
 					value <- v
 				}
 				idx <- l
+			} else: {
+				idx <- idx + 1
 			}
 		}
 		ret
@@ -189,6 +192,7 @@
 				self set: index val
 			}
 		}
+		self
 	}
 
 	join <- :sep {