ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Andre Caldas <andre.em.caldas@gmail.com>
To: ConTeXt users <ntg-context@ntg.nl>
Subject: OOP in Metafun.
Date: Sun, 9 Dec 2012 16:55:43 -0200	[thread overview]
Message-ID: <CADVh14UL9iGw6WyVyMG80hymiaxxhZfoc0nO_4+dR70KnOkn+A@mail.gmail.com> (raw)

Hello, list!

I am writing down a macro package for commutative diagrams using metafun.
This is my first try:
https://bitbucket.org/andrecaldas/math-video-classes/src/9a050eab20348c9a9c9e50740618173648979f45/src/environments/diagrams.tex?at=default

Used here:
https://bitbucket.org/andrecaldas/math-video-classes/src/9a050eab2034/src/products/assorted/open_mapping_theorem/notes/introduction.tex?at=default#cl-106

But I would like to use some "object oriented" like approach. That is,
I'd like the diagram data structure to be set up like this:

d = CD.new;
d.vertex("$X$"); d.arrow("$f$"); d.vertex("$Y$");
d.newline;
d.arrow("$\pi$"); d.arrow("$\pi$");
d.vertex("$A$"); d.arrow("$g$"); d.vertex("$B$");

or even in some "thelabel" similar fashion,

d = CD.new;
CD.vertex(d, "$X$"); CD.arrow(d, "$f$"); CD.vertex(d, "$Y$");
CD.newline(d);
CD.arrow(d, "$\pi$"); CD.arrow(d, "$\pi$");
CD.vertex(d, "$A$"); CD.arrow(d, "$g$"); CD.vertex(d, "$B$");


How do I do that in METAFUN/METAPOST?


Cheers,
André Caldas.
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

             reply	other threads:[~2012-12-09 18:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-09 18:55 Andre Caldas [this message]
2012-12-09 23:32 ` Andre Caldas
2012-12-10  9:56 ` Nicola
2012-12-11  2:11   ` Andre Caldas
2012-12-11 10:21     ` Nicola

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CADVh14UL9iGw6WyVyMG80hymiaxxhZfoc0nO_4+dR70KnOkn+A@mail.gmail.com \
    --to=andre.em.caldas@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).