Fun with logical expressions 2: Electric boogaloo

tybalt89 discovered a bug in Fun with logical expressions:

$ echo IEabEba | perl
MOD: V~V~V~a~b;~V~~a~~b;;V~V~b~a;~V~~b~~a;;;
...> V~V~V~a~b;~Vab;;V~V~b~a;~Vba;;;
...> V~V~V~a~b;~Vab;;~V~b~a;~Vba;;
Not a tautology

(a equals b) implies (b equals a) is a tautology but the program fails to recognize it. With the fixed code below it generates this output instead:

Sydney-PM Tonight ! (April 14th)

Hosted by us at Broadbean. The address is Level 8, 9 Hunter Street, Sydney 2000.

The front doors close promptly at 6pm. If you arrive before 6pm, then walk straight in (there's no sign in process). When on the 8th floor, there's signs to say we're to the left. Come on in!

If you arrive after 6pm then please give Peter me a call. His number is 0414 331 769. Someone will then come and let you in.

Tonight Stuart Cooper will present a talk on using perl in a perl hostile environment. Ivan Wills will also present on a mystery topic. There will also be some house keeping discussions for the group to decide upon.

Test Driven Development

Test Driven Development is the topic of the night at MadMongers tomorrow night. If you’re in Madison, come, have a beer, and hear about TDD. 

[From my blog.]

Document, Document, Document

Some ideas on how to document your web applications and modules...

Functional fun with logical expressions

Here's a quickly thrown-together version of "Fun with logical expressions", written in Haskell:

Using Apache's Swiss Army Knife - mod_rewrite for RESTful APIs (part II)

Part II of a series on Apache's mod_rewrite.

A Marpa/Moops powered M4 implementation


The M4 language is a powerful macro processor, turing complete as well as a practical programming language. It is the core tool behind GNU Autoconf, in particular.

MarpaX::Languages::M4 package is a Marpa::R2/Moops powered implementation of it, 99% with the GNU M4 version ([1]) and have switches to alter its behaviour as wanted, so that one can have e.g. POSIX M4 as well.


MarpaX::Languages::M4 is distributed with an m4pp command-line, with all the GNU M4 implementation options, plus some other handy items, for example:

conversion to UNIX native end-of-line
comment start and end delimiters
string start and end delimiters

and some "advanced" options to alter the behaviour or extend M4 as you wish:

buffers unwrap order at the end (LIFO or FIFO)
any default can be altered on the command-line
unlimited number of bits for eval arithmetic (thanks to the really remarquable Bit::Vector package)
use perl or GNU Emacs regexps (via the new re::engine::GNU package)

Fun with logical expressions

Addendum 2: This set of rules is incomplete. See Fun with logical expressions 2 for an improved version.

Addendum: I've written a more or less equivalent Haskell version of this program.

Some programmers, when confronted with a boolean expression, think "I know, I'll use regular expressions". Now they have true problems.

This post was inspired by the TAUT exercise on SPOJ.

You're given a boolean expression consisting of variables (each being either true or false), a unary operator (not), and several binary operators (and, or, implies, equals). Your task is to determine whether the expression is a tautology, i.e. whether it evaluates to true for all possible variable values.

To make parsing easier, we're going to use a very simplified syntax:

About is a common blogging platform for the Perl community. Written in Perl and offering the modern features you’ve come to expect in blog platforms, the site is run by Dave Cross and Aaron Crane, with a design donated by Six Apart, Ltd.