Skip to content

How to limit the invention to have a full function form? #182

Description

@citceae

Tested on Stitch API Python3.11.5

**_programs = [
"(str.substr $0 0 (+ -1 1))",
"(str.substr $0 0 5)",
"(str.substr $0 0 9)",
]

from stitch_core import compress

res = compress(programs, iterations=1, max_arity=3, silent = False)_**

The invention would be fn_0 arity=1: (str.substr #0 0), and the programs rewritted would be

(str.substr $0 0 (+ -1 1))---------(fn_0 $0 (+ -1 1))
(str.substr $0 0 5)---------(fn_0 $0 5)
(str.substr $0 0 9)---------(fn_0 $0 9)

There is an utility of 101.

However, the operator str.substr requires three parameters. To make the invention become a legal function, the correct form should be fn_0 arity=2: (str.substr #0 0 #1). The utility should be 0.

Is there a way to limit the invention to be a legal function instead of a function fragment?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions