Mathematica Assert[]

I’ve been using my own Assert[] function in Mathematica for quite some time. In Mathematica version 8, it was implemented as a built-in. I skipped version 8, but recently installed version 9.

When I first used the new Assert, I was confused: Assert[True] returned unevaluated! I quickly discovered that you need to enable the Assert function through evaluating

    On@Assert

I found nothing on Google; maybe this note will save you 5 minutes!

Oh, since you’re here, I might as well tell you: When you install Mathematica on a Mac, the scheme paclet: is registered in Mac OS X. If you access a URL beginning with that scheme, such as paclet:ref/Assert, an event will be sent to Mathematica, which will take the appropriate action – in this example, opening the Documentation Center to the entry for Assert. Try it!

Copyright © 2013-04-11 20:40
Charles Poynton