It's not technically declarative, but in the limited circumstances for which it makes sense, it feels declarative as you're thinking in terms of what needs to be there without worrying at all about the current state.
While we're analogizing, it's like stocking up your fridge to an exact state. Recipe A is:
* Check shelf for residue, clean if exists
* For each existing egg, if egg is off, throw out
* If egg carton contains yolk from broken egg, obtain new carton, transfer each egg
* While egg count less than 12, purchase and add eggs
However, if we just throw out the entire old fridge and buy a new one, we get the recipe:
* Purchase a dozen eggs. Place on shelf.
If you can afford a new fridge each time you go shopping, I don't think it's a bad algorithm.
It's not technically declarative, but in the limited circumstances for which it makes sense, it feels declarative as you're thinking in terms of what needs to be there without worrying at all about the current state.
While we're analogizing, it's like stocking up your fridge to an exact state. Recipe A is:
* Check shelf for residue, clean if exists
* For each existing egg, if egg is off, throw out
* If egg carton contains yolk from broken egg, obtain new carton, transfer each egg
* While egg count less than 12, purchase and add eggs
However, if we just throw out the entire old fridge and buy a new one, we get the recipe:
* Purchase a dozen eggs. Place on shelf.
If you can afford a new fridge each time you go shopping, I don't think it's a bad algorithm.