sequences: normalize all the "?set-nth" words, probably this should be a stdlib thing.
							parent
							
								
									b62444680b
								
							
						
					
					
						commit
						f8f5feed4a
					
				|  | @ -19,13 +19,18 @@ M: bit-set adjoin | ||||||
|     ! go in the set |     ! go in the set | ||||||
|     [ t ] 2dip table>> set-nth ; |     [ t ] 2dip table>> set-nth ; | ||||||
| 
 | 
 | ||||||
|  | <PRIVATE | ||||||
|  | 
 | ||||||
|  | : ?set-nth ( elt n seq -- ) | ||||||
|  |     2dup bounds-check? [ set-nth-unsafe ] [ 3drop ] if ; inline | ||||||
|  | 
 | ||||||
|  | PRIVATE> | ||||||
|  | 
 | ||||||
| M: bit-set delete | M: bit-set delete | ||||||
|     ! This isn't allowed to throw an error if the elt wasn't |     ! This isn't allowed to throw an error if the elt wasn't | ||||||
|     ! in the set |     ! in the set | ||||||
|     over integer? [ |     over integer? [ | ||||||
|         table>> 2dup bounds-check? [ |         [ f ] 2dip table>> ?set-nth | ||||||
|             [ f ] 2dip set-nth |  | ||||||
|         ] [ 2drop ] if |  | ||||||
|     ] [ 2drop ] if ; |     ] [ 2drop ] if ; | ||||||
| 
 | 
 | ||||||
| ! If you do binary set operations with a bit-set, it's expected | ! If you do binary set operations with a bit-set, it's expected | ||||||
|  |  | ||||||
|  | @ -177,8 +177,8 @@ CONSTANT: pov-values | ||||||
| 
 | 
 | ||||||
| HINTS: record-controller { controller-state alien } ; | HINTS: record-controller { controller-state alien } ; | ||||||
| 
 | 
 | ||||||
| : ?set-nth ( value nth seq -- ) | : ?set-nth ( elt n seq -- ) | ||||||
|     2dup bounds-check? [ set-nth-unsafe ] [ 3drop ] if ; |     2dup bounds-check? [ set-nth-unsafe ] [ 3drop ] if ; inline | ||||||
| 
 | 
 | ||||||
| : record-keyboard ( keyboard-state value -- ) | : record-keyboard ( keyboard-state value -- ) | ||||||
|     dup IOHIDValueGetElement dup keyboard-key? [ |     dup IOHIDValueGetElement dup keyboard-key? [ | ||||||
|  |  | ||||||
|  | @ -138,8 +138,8 @@ PRIVATE> | ||||||
| 
 | 
 | ||||||
| ! the maximum unicode char in the first 3 planes | ! the maximum unicode char in the first 3 planes | ||||||
| 
 | 
 | ||||||
| : ?set-nth ( val index seq -- ) | : ?set-nth ( elt n seq -- ) | ||||||
|     2dup bounds-check? [ set-nth ] [ 3drop ] if ; |     2dup bounds-check? [ set-nth-unsafe ] [ 3drop ] if ; inline | ||||||
| 
 | 
 | ||||||
| :: fill-ranges ( table -- table ) | :: fill-ranges ( table -- table ) | ||||||
|     name-map sort-values keys |     name-map sort-values keys | ||||||
|  |  | ||||||
|  | @ -10,8 +10,12 @@ SYMBOL: visited | ||||||
| 
 | 
 | ||||||
| : unvisited? ( cell -- ? ) first2 visited get ?nth ?nth ; | : unvisited? ( cell -- ? ) first2 visited get ?nth ?nth ; | ||||||
| 
 | 
 | ||||||
| : ?set-nth ( elt i seq -- ) | <PRIVATE | ||||||
|     2dup bounds-check? [ set-nth ] [ 3drop ] if ; | 
 | ||||||
|  | : ?set-nth ( elt n seq -- ) | ||||||
|  |     2dup bounds-check? [ set-nth-unsafe ] [ 3drop ] if ; inline | ||||||
|  | 
 | ||||||
|  | PRIVATE> | ||||||
| 
 | 
 | ||||||
| : visit ( cell -- ) f swap first2 visited get ?nth ?set-nth ; | : visit ( cell -- ) f swap first2 visited get ?nth ?set-nth ; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue