Camp Water Budget
make-water-plan
water-plan
gallons->liters
1 Example
9.3

Camp Water Budget🔗ℹ

Camp Kitchen

 (require camp-water-budget) package: camp-water-budget

A small helper for planning the water for a camping trip: how many gallons to carry and how many times a tank of a given size has to be filled.

total gallons = people * days * gallons-per-person-per-day
tank fills    = ceiling(total gallons / tank gallons)

The default of 1 gallon per person per day is only a common planning starting point for drinking, cooking and washing up; set #:gallons-per-person-per-day for your climate, group and trip. The default tank size is 2 gallons, the same as the water tank in portable camp kitchens such as Camp Kitchen.

procedure

(make-water-plan people 
  days 
  [#:gallons-per-person-per-day gpp 
  #:tank-gallons tank]) 
 → water-plan?
  people : exact-positive-integer?
  days : exact-positive-integer?
  gpp : (and/c real? positive?) = 1
  tank : (and/c real? positive?) = 2
Returns a water-plan with the total gallons, the number of tank fills (at least 1) and the unused gallons in the last fill.

struct

(struct water-plan (people
    days
    total-gallons
    tank-fills
    unused-gallons)
    #:extra-constructor-name make-water-plan)
  people : exact-positive-integer?
  days : exact-positive-integer?
  total-gallons : real?
  tank-fills : exact-positive-integer?
  unused-gallons : real?
The result of make-water-plan.

procedure

(gallons->liters g) → real?

  g : real?
Converts US liquid gallons to liters (1 gallon = 3.785411784 L).

1 Example🔗ℹ

(require camp-water-budget)
(define p (make-water-plan 4 3))
(water-plan-total-gallons p) ; 12
(water-plan-tank-fills p)    ; 6 fills of a 2-gallon tank