encode(ctx, encode) {
    const {marktype, channels} = encode,
          fn = ctx.functions,
          swap = marktype === 'group'
              || marktype === 'image'
              || marktype === 'rect';

    return (item, _) => {
      const datum = item.datum;
      let m = 0, v;

      for (const name in channels) {
        v = interpret(channels[name].ast, fn, _, datum, undefined, item);
        if (item[name] !== v) {
          item[name] = v;
          m = 1;
        }
      }

      if (marktype !== 'rule') {
        adjustSpatial(item, channels, swap);
      }
      return m;
    };
  }
Parse an expression that performs visual encoding.