#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 code inside those brackets is EFFECTIVELY a miniature function. It takes as input each "row" (in the spreadsheet analogy), and it evaluates it to a boolean - should this "row" be selected ? the rows in the spreadsheet analogy each have two elements in them we can call >>>
-
-
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> } ...
- 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.