Skip to content

Add define macro with first argument treated as this to enable chaining #121

Description

@dadhi

I want to be able chain the output produced by define macro, e.g.

define AppendCsv($strBuilder, $list, $itemStr) {
     for (var i = 0; i < $list.Count, ++i)
         (i == 0 ? strBuilder : strBuilder.Append(", "))
             .Append($itemStr($list[i]));
     return $strBuilder;
}

string Curly(string x) => "{"+x+"}";
s.Append("(").AppendCsv(args, Curly).Append(")");

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions