2008-01-29 16:04:26 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								USING: arrays bit-arrays help.markup help.syntax kernel
							 | 
						
					
						
							
								
									
										
										
										
											2008-07-02 16:57:38 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								combinators ;
							 | 
						
					
						
							
								
									
										
										
										
											2008-01-29 16:04:26 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								IN: bit-vectors
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								ARTICLE: "bit-vectors" "Bit vectors"
							 | 
						
					
						
							
								
									
										
										
										
											2008-04-23 03:46:35 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								"A bit vector is a resizable mutable sequence of bits. Bit vector words are found in the " { $vocab-link "bit-vectors" } " vocabulary."
							 | 
						
					
						
							
								
									
										
										
										
											2008-01-29 16:04:26 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								$nl
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								"Bit vectors form a class:"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{ $subsection bit-vector }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{ $subsection bit-vector? }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								"Creating bit vectors:"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{ $subsection >bit-vector }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{ $subsection <bit-vector> }
							 | 
						
					
						
							
								
									
										
										
										
											2008-04-19 23:56:28 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								"Literal syntax:"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{ $subsection POSTPONE: ?V{ }
							 | 
						
					
						
							
								
									
										
										
										
											2008-01-29 16:04:26 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								"If you don't care about initial capacity, a more elegant way to create a new bit vector is to write:"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{ $code "?V{ } clone" } ;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								ABOUT: "bit-vectors"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								HELP: bit-vector
							 | 
						
					
						
							
								
									
										
										
										
											2008-04-23 03:46:35 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{ $description "The class of resizable bit vectors. See " { $link "bit-vectors" } " for information." } ;
							 | 
						
					
						
							
								
									
										
										
										
											2008-01-29 16:04:26 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								HELP: <bit-vector>
							 | 
						
					
						
							
								
									
										
										
										
											2009-07-07 15:34:08 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{ $values { "capacity" "a positive integer specifying initial capacity" } { "vector" bit-vector } }
							 | 
						
					
						
							
								
									
										
										
										
											2008-01-29 16:04:26 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{ $description "Creates a new bit vector that can hold " { $snippet "n" } " bits before resizing." } ;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2008-01-30 02:10:58 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								HELP: >bit-vector
							 | 
						
					
						
							
								
									
										
										
										
											2009-07-07 15:34:08 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{ $values { "seq" "a sequence" } { "vector" bit-vector } }
							 | 
						
					
						
							
								
									
										
										
										
											2008-01-29 16:04:26 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{ $description "Outputs a freshly-allocated bit vector with the same elements as a given sequence." } ;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2008-04-19 23:56:28 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								HELP: ?V{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{ $syntax "?V{ elements... }" }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{ $values { "elements" "a list of booleans" } }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{ $description "Marks the beginning of a literal bit vector. Literal bit vectors are terminated by " { $link POSTPONE: } } "." } 
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{ $examples { $code "?V{ t f t }" } } ;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 |