nosuchtim / keykit

KeyKit - an algorithmic MIDI scripting language and GUI system
Other
99 stars 7 forks source link

EDITINPLACE #3453

Closed unhandyandy closed 6 months ago

unhandyandy commented 6 months ago

I see this in cmds.k:

#define EDITINPLACE(p,expr) origt=p%(1).time;p.time-=origt;p.length=latest(p);p=expr;p.time+=origt

Is that a macro? I don't think you mentioned macros in the docs.

If so, why do you change certain values of p, and then just replace p by expr?

nosuchtim commented 6 months ago

define is described in the keykit language spec, doc/language.{html,pdf}

That macro applies a transformation (the expr) to a phrase, while preserving any blank space at the beginning of the phrase. It's a convenience macro just for lib/cmds.k, not useful elsewhere.

  ...Tim...

On Fri, May 17, 2024 at 3:04 PM unhandyandy @.***> wrote:

I see this in cmds.k:

define EDITINPLACE(p,expr)

origt=p%(1).time;p.time-=origt;p.length=latest(p);p=expr;p.time+=origt

Is that a macro? I don't think you mentioned macros in the docs.

If so, why do you change certain values of p, and then just replace p by expr?

unhandyandy commented 6 months ago

OK thanks, I missed it in language.html.

And I forgot that since it's a macro, expr isn't evaluated till runtime. I'm not a real programmer, but I think I get it now.

unhandyandy commented 6 months ago

Btw, let me repeat once again my appreciation and admiration for Keykit - I use it every day.