dhh1128 / intent

the intent formal language
https://intentlang.org
2 stars 1 forks source link

provide clean, one-line impl of pattern that checks dict and then inserts #89

Open dhh1128 opened 9 years ago

dhh1128 commented 9 years ago

Consider this python code:

if cat in stats.response_counts_by_category:
    stats.response_counts_by_category[cat] += 1
else:
    stats.response_counts_by_category[cat] = 1

We should be able to do something much cleaner, along the lines of:

dict.Increment or set(key, incr, initial value)