math toy collection

Thinking About Functions

calculator of tomorrow
Shot and shell piled under the walls of Fortress Monroe (Harper’s Weekly, June 29, 1861, public domain)

In [8]: {{1,2}, {2,1}, {1,1}, {0,0}}

Traceback (most recent call last):

File “<ipython-input-13–4088db72ab8c>”, line 1, in <module>

{{1,2}, {2,1}, {1,1}, {0,0}}

TypeError: unhashable type: ‘set’

In [9]: it = map(frozenset, ({1,2}, {2,1}, {1,1}, {0,0}))

In [10]: {it for it in it} # maybe not best practice but it works

Out[10]: {frozenset({1}), frozenset({0}), frozenset({1, 2})}

In [11]: it = map(frozenset, ({1,2}, {2,1}, {1,1}, {0,0}))

In [12]: {elem for elem in it} # better

Out[12]: {frozenset({1}), frozenset({0}), frozenset({1, 2})}

from Martian Math




Lots online.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Rusty Shorts — Scoping ( allocation and de-allocation )

Spark Applications Running on Yarn — in a nutshell

Now Hiring: Senior Front-End Developer

Learn how to welcome Drupal 9 in the next 3 months!

Five Reasons to run IBM Istio Helm chart for your service mesh

Knative journey EP2: the classic example of Hello World and the webhook

VMware VCAP-DCV Design Certification | Exam Tips


Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Kirby Urner

Kirby Urner

Lots online.

More from Medium

Recapping a Thread in Synergetics

Fun Problem: Two unit squares have the same center. Show their intersection area is at least 3/4.

It didn’t belong to Pythagoras

The Perfect Matching