Skip to content

Wishlist: ppx shortcut to avoid code duplication for printable_fun #379

@erikmd

Description

@erikmd

Just a small note to suggest we could implement some ppx facility for the graders, to better follow the "DRY" principle :)

Motivation

Currently, when using test_function_against_solution or so to test a higher-order function with manual test cases involving teacher-provided closures, to avoid just printing <fun> in the report, we need to prepend these closures with printable_fun:

let p_even = printable_fun "(fun n -> n mod 2 = 0)" (fun n -> n mod 2 = 0)

Wish

It could be nice to only need to write something like this:

let p_even = [%printable: fun n -> n mod 2 = 0]

(@yurug @fpottier WDYT?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind: enhancementEnhancement to an existing user-facing feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions