Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
"""Reduce the Lean `Aeneas.Std.Error` enum to the cases that behave differently.
The Lean library models Rust failures with a 7-constructor `Error` enum. Every one
of `integerOverflow`, `divisionByZero`, `arrayOutOfBounds`, `maximumSizeExceeded`
and `assertionFailure` is just a Rust panic, so they are all collapsed into
`panic`, leaving only the genuine distinction between a panic and UB:
inductive Error where
| panic: Error
/*
* @description: A code snippet that mimics the popular Select * SQL syntax in force.com's Apex language.
*/
// Initialize setup variables
String objectName = 'Contact'; // modify as needed
String query = 'SELECT';
Map<String, Schema.SObjectField> objectFields = Schema.getGlobalDescribe().get(objectName).getDescribe().fields.getMap();
// Grab the fields from the describe method and append them to the queryString one by one.