ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* OOP in Metafun.
@ 2012-12-09 18:55 Andre Caldas
  2012-12-09 23:32 ` Andre Caldas
  2012-12-10  9:56 ` Nicola
  0 siblings, 2 replies; 5+ messages in thread
From: Andre Caldas @ 2012-12-09 18:55 UTC (permalink / raw)
  To: ConTeXt users

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: OOP in Metafun.
  2012-12-09 18:55 OOP in Metafun Andre Caldas
@ 2012-12-09 23:32 ` Andre Caldas
  2012-12-10  9:56 ` Nicola
  1 sibling, 0 replies; 5+ messages in thread
From: Andre Caldas @ 2012-12-09 23:32 UTC (permalink / raw)
  To: ConTeXt users

> But I would like to use some "object oriented" like approach.

I have done some OOP like coding...
https://bitbucket.org/andrecaldas/math-video-classes/src/77036fe1001ede35e301305700943ac952089d32/src/environments/diagrams.tex?at=default

This is my first METAFUN experience. Comments are very welcome!


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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: OOP in Metafun.
  2012-12-09 18:55 OOP in Metafun Andre Caldas
  2012-12-09 23:32 ` Andre Caldas
@ 2012-12-10  9:56 ` Nicola
  2012-12-11  2:11   ` Andre Caldas
  1 sibling, 1 reply; 5+ messages in thread
From: Nicola @ 2012-12-10  9:56 UTC (permalink / raw)
  To: ntg-context

In article 
<CADVh14UL9iGw6WyVyMG80hymiaxxhZfoc0nO_4+dR70KnOkn+A@mail.gmail.com>,
 Andre Caldas <andre.em.caldas@gmail.com> wrote:

> 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/9a050eab20348c9a9c9e5
> 0740618173648979f45/src/environments/diagrams.tex?at=default
> 
> Used here:
> https://bitbucket.org/andrecaldas/math-video-classes/src/9a050eab2034/src/prod
> ucts/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?

You may want to take a look at my attempt:

http://users.dimi.uniud.it/~nicola.vitacolonna/home/content/metappeal

It is a library intended to provide a minimal framework for “oo-like” constructs.
It is a work in progress (actually, I have not worked on it for a while since I 
didn't receive any feedback) and the documentation is a bit messy, but the core 
is stable and well tested and should be compatible with MetaFun.

It is all based on a pair of macros that generalize MetaPost declarations, a 
first draft of which is shortly described here:

http://oldwww.gust.org.pl/projects/pearls/2011p/index_html

For the functionality you are describing, you may just need to grab the file 
metappeal.mp (and the files that it includes) and include it in your source.

Nicola

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: OOP in Metafun.
  2012-12-10  9:56 ` Nicola
@ 2012-12-11  2:11   ` Andre Caldas
  2012-12-11 10:21     ` Nicola
  0 siblings, 1 reply; 5+ messages in thread
From: Andre Caldas @ 2012-12-11  2:11 UTC (permalink / raw)
  To: mailing list for ConTeXt users

>> But I would like to use some "object oriented" like approach.
>> [...]
>> How do I do that in METAFUN/METAPOST?
>
> You may want to take a look at my attempt:
>
> http://users.dimi.uniud.it/~nicola.vitacolonna/home/content/metappeal

Looks nice! I didn't find any "license" explaining the licensing terms.


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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: OOP in Metafun.
  2012-12-11  2:11   ` Andre Caldas
@ 2012-12-11 10:21     ` Nicola
  0 siblings, 0 replies; 5+ messages in thread
From: Nicola @ 2012-12-11 10:21 UTC (permalink / raw)
  To: ntg-context

In article 
<CADVh14XYT3Mi6aPUOv4Py==_gjy=MAFEH-hQbmRVE=R_d-Tx_A@mail.gmail.com>,
 Andre Caldas <andre.em.caldas@gmail.com> wrote:

> >> But I would like to use some "object oriented" like approach.
> >> [...]
> >> How do I do that in METAFUN/METAPOST?
> >
> > You may want to take a look at my attempt:
> >
> > http://users.dimi.uniud.it/~nicola.vitacolonna/home/content/metappeal
> 
> Looks nice! I didn't find any "license" explaining the licensing terms.

In the documentation there is a Disclaimer. In short, do what you want with the 
code, but do not blame me ;)

Nicola

___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-12-11 10:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-09 18:55 OOP in Metafun Andre Caldas
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

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).