Bug in isub/4?

This is a great way to deal with it. goal_expansion can also figure out if the third argument is true or false and then provide the proper options so that compatibility with the old isub/4 is provided (and unify the fourth argument with the resulting similarity).

I’ll work on it, but it may take me a while.

1 Like

Ok, here is the new version supporting backward compatibility, the new options (normalize,zero_to_one and substring_threshold) and using goal_expansion to provide for speed.

isub.log (12.2 KB)

Sorry for the delay. Merged. Did two changes: add a runtime implementation and changed the plain options to boolean options for consistency. Hope it makes you happy. This surely solves some problems.

1 Like

Thanks for the update, it taught me a technique that I did not think about before: optimize a predicate at compile time, while allowing a runtime version also if compile-time optimization is not possible.

This just keeps confirming that constant thought that I have that prolog is, for most tasks (with the exception of number crunching) the most productive language (once you learn it well).