Created
May 5, 2020 13:25
-
-
Save okram/fbcd03238f0375d9c5ee931aa0974e1e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******************************************* | |
A stream of polys or a poly of streams. | |
mm-ADT's match/case story | |
*********************************************/ | |
// There is one fundamental composite structure in mm-ADT: poly. | |
// Polys are used to create data structures (e.g. lists, maps, trees, graphs, etc.) | |
// Polys are used for branch-based data flow. | |
// -< (split) | |
// = (pair-wise compose) | |
// >- (merge) | |
mmlang> 5,'aba',0 // a stream of 3 objs | |
==>5 | |
==>'aba' | |
==>0 | |
mmlang> 5,'aba',0-<[bool|str|int[is>0]] // split each obj across each poly slot | |
==>[||5] | |
==>[|'aba'|] | |
==>[||] | |
mmlang> 5,'aba',0-<[bool|str|int[is>0]]=[_|+'ba'|*10] // pair-wise compose each poly slot | |
==>[||50] | |
==>[|'ababa'|] | |
==>[||] | |
mmlang> 5,'aba',0-<[bool|str|int[is>0]]=[_|+'ba'|*10]>- // merge the poly slots | |
==>50 | |
==>'ababa' | |
mmlang> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment