Files
ioccc/2006/hamre
Landon Curt Noll f29b37e49a improve HTML menus, add social.html, prep for IOCCC28 winners
Prepare for the winners of **IOCCC28**.

> However these are not the 2024 droids you are looking for.  :-)

The HTML menu (both JavaScript and non-JavaScript) has been updated.

The `Status -> Rules and guidelines' have been replaced with two
separate menus `Status -> IOCCC rules` and `Status -> IOCCC guidelines`.

Added a new top level `social.html` page: built from a new `social.md`.

Sorted rules for building specific web pages in the top level `Makefile`.
Added `make social` to make the `social.html` page from `social.md`.

The `bin/gen-top-html.sh` now is able to process a argument of **social**
to process the new top level `social.html` page.

Changed `bin/gen-top-html.sh` VERSION from "2.0.0 2025-03-13"
to "2.0.1 2025-07-25".

Below `About -> Home page` a new `About -> IOCCC social media` menu item
as added.

Because the menu change touched every HTML file, we changed the general
copyright date range for HTML files from "1984-2024" to "1984-2025"
due to the extensive changes made for **IOCCC28**.

Those markdown files that were modified in 2025 had their copyright date
range also changed from "1984-2024" to "1984-2025".

Rebuilt tarballs and sitemap due to the extensive HTML rebuilding.

Ran `make update` to perform the above.
2025-07-26 13:06:29 -07:00
..
2024-05-30 10:50:29 -07:00
2023-07-06 21:49:38 -07:00
2024-07-19 00:18:41 -07:00

To build:

    make

Bugs and (Mis)features:

The current status of this entry is:

STATUS: INABIAF - please DO NOT fix

For more detailed information see 2006/hamre in bugs.html.

To use:

    ./hamre math_expression_string

Try:

    ./try.sh

Judges' remarks:

An irrationally coded source presents rational things!

A rational person might want to attempt the irrational task of supporting a new operator by way of an existing macro in the source. And can you determine which macro this is and understand the purpose of its arguments?

Author's remarks:

This is a calculator for rational numbers. Believe it or not, that is a useful tool to have around, and I haven't found a useful version, much less an obfuscated one.

It is rather feature complete as rational calculators go. The supported operators are: +, - (binary and unary), *, / and (). Run it by supplying an expression as the first argument, and the normalized result will be written to stdout.

    ./hamre '-1+4/3*(2+1/(3/2*(7/2-7/3+1/6)))/2'
    2/3

If you do not supply an argument, the calculator will crash. Other arguments are ignored. Supplying more arguments may further limit the number of nested operators supported.

Remember that 1/0 is not a rational number. You will not get any answer if you divide by zero.

By default, only 31 nested levels of operators are supported.

The code is well documented, even with an example. In fact this documentation accounts for 100% of the source. Personally I find preprocessing or re-indenting the program counterproductive when it comes to understanding the source. The preprocessed source becomes rather verbose.

IOCCC entries are often loaded with all kinds of hard-coded numbers. I have restricted myself to mostly use sensible numbers (<= 7) as smaller numbers are much easier to remember. Also the macros really help hide most of the uses of these numbers away. All macros and variables are easy-to-remember single character abbreviations, from some language, meaningful to the purpose(s) of the macro, I hope.