#homesteading book draft 2:
* wrote 3,000 words (12 pages)
* revised 14,000 words (48 pages)
* book is now > 500,000 words (1,667 pages)
* on schedule for completion on 28 Feb
the day of the week the "key" and we can call the number the "value". These are in fact the standard terms for the two parts of a "hash", the data type of sections. "Key" must be unique across the entire hash, but "value" can be repeated. Monday: 12 Tuesday: 12 but we can't >
-
-
have "Monday" in there twice. So, back to the mini function. The syntax { |k, v| ... } says "define a mini function which takes two arguments on each invocation; first one is the key, second one is the value" so http://sections.select { | k, v| <minifunc> } ...
-
* passes in k = Monday, v = 12 * evaluates the minifunc * gets either boolean true or false as a result * based on that, chooses or does not choose the pair k/v to put in the output bad_sections = http://sections.select { |k, v| k.count(":") + 1 != v } sets bad_sections
- Show replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.