Quick actions

cmd+k|ctrl+k

Navigation

Languages

Music

Snippet info

Language

Raku

Visibility

public

Author

fernando-correa

Created

2022-08-05T20:24:33.983928Z

Updated

2022-08-05T20:24:33.983928Z

class Note does Callable {
    has $.note;
    
    multi method CALL-ME(UInt $oct) {
        "$!note$oct"
    }
    
    multi method CALL-ME { self }
}

my &G = Note.new: :note<G>;
sub infix:<♯>(Note $note, UInt $oct) {
    $note.clone(:note($note.note ~ "#")).($oct)
}
sub infix:<♭>(Note $note, UInt $oct) {
    $note.clone(:note($note.note ~ "b")).($oct)
}

say G 4;
say G♯ 4;
say G♭ 4;

INFO