Table Of ContentAlmost Continuous Transformations of Software and
Higher-order Dataflow Programming
MichaelBukatin1andSteveMatthews2
1 NokiaCorporation
Burlington,Massachusetts,USA
[email protected]
6 2 DepartmentofComputerScience
1 UniversityofWarwick
0
Coventry,UK
2
[email protected]
n
a
J
Abstract. Weconsidertwoclassesofstream-basedcomputationswhichadmit
5
takinglinearcombinationsofexecutionruns:probabilisticsamplingandgeneral-
izedanimation.Thedataflowarchitectureisanaturalplatformforprogramming
]
L withstreams.Thepresenceoflinearcombinationsallowsustointroducetheno-
P tionofalmostcontinuoustransformationofdataflowgraphs.Weintroduceanew
approach to higher-order dataflow programming: a dynamic dataflow program
.
s is a stream of dataflow graphs evolving by almost continuous transformations.
c
[ Adynamicdataflowprogramwouldtypicallyrunwhileitevolves.Weintroduce
Fluid,anexperimentalopensourcesystemforprogrammingwithdataflowgraphs
1 andalmostcontinuoustransformations.
v
3
Keywords: Generalizedanimation,probabilisticprogramming,dataflowgraphs,
1
higher-orderprogramming,almostcontinuoustransformations
7
0
0
1 Introduction
.
1
0 Standardsoftwarearchitecturestendtobetoobrittle,andtypicalsoftwaresystemsare
6
ofdiscretenatureandnotsufficientlyrobustwithrespecttosmallchanges.
1
Theabilitytotakelinearcombinationsofexecutionrunsallowsonetochangesoft-
:
v ware in a continuous fashion. In this paper, we consider two classes of computations
i
X which admit taking linear combinations of execution runs: probabilistic sampling and
generalizedanimation.Becausethesetwoclassesarebothstream-based,dataflowpro-
r
a grammingisanaturalprogrammingparadigmforthissituation.
Dataflow paradigm develops since at least early 1960s [6]. Many dozens of text-
based and visual programming dataflow systems have been created since then. For a
veryextensiveandstillincompleteoverviewofstateofthefieldtenyearsagosee[5].
Many dataflow programming systems are in active use today, and new dataflow pro-
grammingsystemskeepemerging.
Thedescriptionsofdataflowformalismsandsyntaxofvisualdataflowprogramsare
sometimes centered around transformations of data streams. During our experiments
withprototypedataflowsystemsinthispaperwefoundthispracticetobeinconvenient.
Weexploredtwoalternatives.
Forthefirst-orderdataflowprogrammingwefounditconvenienttoconsiderafor-
malismbasedonbipartitedataflowgraphswithtwokindsofvertices:nodesrepresent-
ingdatastreamsandnodesrepresentingtransformations.Underthisapproach,thetwo
kindsofnodesareequallyimportant,andthereisoftenadualitybetweenthem.
For the higher-order dataflow programming, we found it convenient to be able to
copy subgraphs of a dataflow graph in meaningful ways, and for that it is convenient
to take an approach centered around target nodes. So the datastreams take the central
roleunderthisapproach,andtransformationsaremadesubordinatetothestreamsthey
produce.
What we have described so far is applicable to any dataflow programming situa-
tions. The ability to take linear combinations comes into play because it enables the
followingsequenceofreversibletransformations.Westartwiththefollowingtwosteps
we call benign discontinuities. First, we take a datastream node A and replace it with
nodes B andC connectedbyan identitytransformation.Node B inheritsfromnodeA
itsincominglinksandtheirtransformation.NodeC inheritsfromnodeAitsoutgoing
links. Second, we replaceC=Id(B), withC=(1−α)·B+α·D where α=0, so a
zeroweightlinkfromsomenodeDtoCisadded.Finally,wecancontinuouslyvaryα.
Wecallthisprocessofcontinuouslyvaryinglinearcoefficientsinadataflowgraph
punctuated by benign discontinuities at a discrete set of moments in time an almost
continuoustransformation.
The goal of this paper is to give a detailed informal overview of this approach to
dataflowgraphsandtodescribeFluid[3],anexperimentalopensourcesystemprovid-
ingfirst-orderandhigher-orderprototypeimplementations.AsystemlikeFluidshould
be applicable both to streams of probabilistic samples and streams of generalized im-
ages.Thecurrentprototypeworkswithstreamsofordinaryimages.
1.1 MotivationandPaperStructure
Itbecameapparentinourearlierwork[1]thathavinganabilitytoconsiderlinearcom-
binationsofexecutionrunsshouldbeconduciveforprogramlearninginthecontextof
geneticprogrammingandhigher-orderprobabilisticsampling.Italsobecameapparent
to us that two major classes of computations with the ability to take linear combina-
tions of execution runs, probabilistic sampling and generalized animations, are both
stream-based,andhenceitisnaturaltousedataflowarchitectureinthiscontext.
Moreover, dataflow architecture is convenient in the context of program learning,
becausesyntaxofdataflowdiagramstendstobetiedclosertotheirsemanticsthanthe
syntaxofprogramsinmoreconventionalsoftwarearchitectures.
Thispapercontributestheabilitytoalmostcontinuouslyevolvedataflowprograms
whiletheyarerunning.Thismakesitpossibletosamplealmostcontinuoustrajectories
inthespaceofdataflowprograms,inadditiontotheusualpracticeofsamplingthepro-
gramsyntaxtrees,thusenablingustotrynewevolutionaryandprobabilisticschemas
forprogramlearning.
The paper is structured as follows. Section 2 introduces both classes of stream-
basedcomputationsadmittinglinearcombinationsofexecutionruns.Thissectionalso
brieflydescribescontext:theabilitytotakelinearcombinationsshouldbequiteuseful,
if one wants to enrich genetic programming with mechanisms inspired by regulation
of levels of protein expression; there are recent interesting advances in probabilistic
programmingwithinthehigher-order“samplingthesamplers”paradigm;andthereare
deepconnections betweentheability tohave negativecoefficientsin linearmodelsof
computationsandvariousmathematicalmotiveswhichtogetherconstitutetheso-called
“partialinconsistencylandscape”[1].
Section3describesusingbipartitegraphsforthefirst-orderdataflowprogramming
andFluidimplementationofthisarchitecture.
Section 4 describes the notion of almost continuous transformations of dataflow
graphsandtheresultingstreamsofdataflowgraphs.TheFluidimplementationofthis
architectureisdiscussed.Animportantfeatureofthisimplementationisthatthedataflow
programinquestionisnormallyrunningasitchangesinalmostcontinuousfashion.
Wefindourselvesinasituationwhereinadditiontoordinarydatastreamsonehas
datastreamsofdataflowgraphsavailable.Thisopensavarietyofpossibilitiesforhigher-
orderdataflowprogramming,someofwhicharediscussedinSection5.
2 LinearModelsofComputationsandEvolutionaryProgramming
InthisSectionwearebrieflyreviewingtherelevantmaterialfrom[1].
2.1 ConvexLinearCombinations
Hereweareconsideringlinearcombinations(1−α)·A+α·B,where0≤α≤1.
Ageneralizedimageisasetofpoints,togetherwithanysecondarystructureonthis
set,andwithpointstakingrealvalues.Anordinarymonochromeimagecorrespondsto
thesituationwhenthissecondarystructureisacontinuousordiscreterectangle,andfor
thecolorimageonetypicallyconsiderstheCartesianproductofthisrectangleandthe
three-elementsetrepresentingcolors,{R,G,B}.
If two generalized images have the same secondary structure on their points, one
cantakeconvexlinearcombinationsofthoseimagespoint-wise.
Ageneralizedanimationisafunctionfromdiscreteorcontinuoustimetogeneral-
izedimageswiththesamesecondarystructure.
If two generalized animations have the same secondary structure for their images
andaresynchronizedtime-wise,onecantakeconvexlinearcombinationsofthosean-
imations by taking convex linear combinations of their images corresponding to the
samepointonthetimeaxis.
Iftwoprobabilisticsamplersproducepointsindependentlysampledfromdistribu-
tionsPandQattherateofonesampleperclocktick,onecanobtainasamplerfrom
theconvexlinearcombinationofthesedistributionsbytakingthelatestsamplefromP
withprobability(1−α)andthelatestsamplefromQotherwiseateachclocktick.
2.2 EvolutionaryProgrammingandRegulationofLevelsofGeneExpression
Toquotefrom[1]:”Biologicalsystemstendtobemuchmoreflexibleandadaptivewith
respect to variation. In particular, biological cells are capable of functioning at wide
rangesofthelevelofexpressionsofvariousproteins,whicharemachinesworkingin
parallel. Regulation of the level of expression of specific proteins is a key element of
flexibilityofbiologicalsystems.Itisarguedinevolutionarydevelopmentalbiologythat
the flexible architecture together with conservation of core mechanisms is crucial for
theobservedrateofbiologicalevolution[4,7].Itissuggestedthatmorphologyevolves
largelybyalteringtheexpressionoffunctionallyconservedproteins[2].”
Computational architectures which admit the notion of linear combination of exe-
cutionrunswithnon-negativecoefficientsareparticularlyattractiveinthissense.Then
onecanregulatethesystemsimplybycontrollingcoefficientsinalinearcombination
ofitscomponents,ascomputationalequivalentofthelevelofexpressionofaparticular
protein.
2.3 Samplingthesamplers
Theterm“higher-orderprobabilisticprogramming”usuallymeansahigher-orderfunc-
tionalprogramminglanguageimplementingsamplingsemantics.Wehaverecentlyseen
examples of research implementing higher-order sampling schemas in a more narrow
and focused sense of the word: samplers which generate other samplers, probabilistic
programssamplingthespaceofprobabilisticprograms.
Inparticular,oneshouldmentiontherecentworkonlearningprobabilisticprograms
by Yura Perov and Frank Wood [11] and recent advances in compositional concept
learning obtained by Brenden Lake [9] (see Section 3 of [1] for the brief overview of
thesetwosetsofresults).
We’ll return to these two possible ways to understand the notion of “higher-order
programming”forstream-basedprogramarchitecturesinSection5.
2.4 Negation
Theavailabilityofnegationisnotstrictlynecessaryforthematerialofthispaper.Nev-
ertheless,oneoftenfindsthatthepresenceofnegation(thatis,theabilitytohavenega-
tivecoefficientsinlinearcombinations)isveryusefulcomputationally.Foranimations,
onesimplysetszeroattheappropriategraylevelandusesthestandardcolorinversion
operationasnegation(weareusingthisoperationintheFluiddemoexamples).
For probabilistic sampling, one needs to use two sampling channels, positive and
negative, in order to implement negation. The formalism allowing negative probabili-
tiesisconvenientforthissituation.Theabilitytotakenegationisoftencloselylinked
withtheabilitytohandlepartialandgradedcontradictions(seethematerialin[1]and
referencesthereinformoredetails).
3 BipartiteGraphsandFirst-orderDataflow
Forastaticdataflowgraph,andassumingnoneedtomanagesubgraphsandmaketheir
copies,wefounditconvenienttouseabipartitedataflowgraphmodel:twomaintypes
of nodes are data steams (in this case, image streams) and transforms. Directed links
canonlygofromdatastreamstotransforms(thecaseofdatastreambeingasourcefor
a transform), or from transforms to data streams (target nodes for transforms). Links
fromdatastreamstodatastreams,orfromtransformstotransformsarenotallowed.
Inatypicalsituation,manydatastreamscanhavelinksintothesametransform,but
atransformonlygeneratesonedatastream.Exceptionsfromthistypicalsituationexist,
neverthelessthispointstoacertainkindofduality:inatypicalsituationadatastream
has one incoming graph edge and many outgoing graph edges, while a transform has
manyincominggraphedgesandoneoutgoinggraphedge.
Invoking neural analogies, a data stream is similar to an axon, and a transform is
similartoabodyofaneurontogetherwithitsdendrites.
Oneoftenwantstomodulatethetransformswiththecontrols.Onecanthinkabout
controlsasspecialkindsofdatastreams(inatypicalsituation,thevaluesstayconstant
until changed by a mouse click). Unlike images, the amount of data in a control is
usuallysmall.
Inthisstudy,mostdataflowcomputationsaresynchronousandarecoordinatedby
globalclock.Thestreamofvaluesofglobalclockisaspecialtypeofcontrol(itisnot
clickable,butjustadvancesataconstantrate).
3.1 FluidImplementation
Implementation of this architecture in Fluid is rather straightforward: under 300 lines
of code in Processing [12] + about 70 lines of code for each of the example dataflow
graphs(seemay 9 15 experimentsubdirectoryoftheFluidproject).
The object oriented design of this experiment is as follows. The program P is an
objectofMasterConfigclass,whichisbuiltduringtheinitialsetup.Theworkcycle
of the program at every clock tick is as follows. First, the system draws all images
registeredwithPasoutputs.Then,thesystemappliesalltransformsregisteredwithP
as transforms. Finally, the system shifts the target instances of images into the source
positionforalldatastreamsregisteredas(dynamic)datawithP.Inthisfashion,anew
frameisproducedforalldynamicdatastreamsoneachworkcycle.
Images/datastreamsareoftwotypes.DataRectangleobjectscontainconstantim-
ages,whichcanbeusedassourcesfortransforms(andvisualizedifdesired).Inprinci-
ple,nothingpreventsusfromaddinginputmovies,butwehavenotdonesoforthisex-
periment.TheobjectsofclassDataRectangleDynamicinheritfromDataRectangle,
and also provide the target instances of images for the transforms to write to, and the
abilitytoshiftthetargetandsourceimagesoneachstepoftheworkcycle.
Transforms all inherit from the abstract class Transform with the single method
apply. Three types of transforms turn out to be sufficient to provide rich behavior of
the demos. The negation transform reads the image on top of the source stream and
producesitscolorinversionontheoutput.Thesum-of-2transformreadsimageswhich
are on top of its two source streams and produces on the output their convex sum,
(1−α)∗A+α∗B where 0≤α≤1. The value of α is determined by the associated
instance of NumericControl, which tends to be located to the right of the drawing
fieldoftheimagestreamgeneratedbythesum-of-2transforminquestion.
CustomWaveTransformreadstheimageonthetopofthesourcestreamandpro-
ducesanimageontheoutputwhichcanbethoughtofasa“reflectioninasnapshotof
asyntheticwaterwave”.Theparametersofthissyntheticwavedependontheimplicit
global clock control frameCount built into Processing, and also on the values stored
in the associated CustomClickControl. Therefore, a wave transform takes an input
stream of images and produces a stream of the reflections of the input stream in the
movingwaves(nophysicalrealismisattempted).TheCustomClickControlassoci-
atedwiththewavesimplyusesthedrawingfieldoftheimagestreamgeneratedbythe
wavetransforminquestioninordertocatchclicks.
Uponclick,thewaveiseffectivelyrestartedinthepositionoftheclickasthenew
center,andtheframe count baseofthecontrolissettothecurrentframeCount(the
wavedynamicsdependsonlyonframeCount - frame count base).
All controls inherit from ClickControl class and need to be registered with the
programascontrolsinordertowork.
Two examples of a first-order dataflow program are included in the subdirectory
may 9 15 experiment, one is based on a directed acyclic graph, and one contains a
loop. A short video demonstrating work with the first of these examples is posted on
youtube.com(seethemainpageoftheFluidrepository[3]fordetails).
4 Almost Continuous Transformations and Streams of Dataflow
Graphs
Inthisstudy,wesupport“almostcontinuousevolution”ofdataflowgraphswhilethey
arerunningasprograms.Almostcontinuousevolutionofdataflowgraphsisunderstood
as continuous evolution of their coefficients punctuated by benign discontinuities at
discretemomentsoftime.
One type of benign discontinuity is creation of new dataflow circuits which don’t
have outgoing links to the currently existing and running dataflow circuits and thus
don’t affect the existing behavior (unless the outside environment provides feedback
based on the output of the program). We find it convenient to implement this type of
benigndiscontinuitynotbybuildingnewcircuitsvertexbyvertex,butbycopyingthe
intactdataflowgraphsandsubgraphs(seeLimiteddeepcopyinSection4.3below).
Itturnsoutthebipartitegraphapproachoftheprevioussectionmakesitdifficultto
correctly identify and copy subgraphs. Hence we adopt an entirely different architec-
ture,whichisgroupedaroundthenotionofdataflowvertex(alsoknownastargetnode),
withnecessarytransforms,controls,referencestosources,andassociateddatastreams
allbeingsubordinatetothetargetnodestheybelongto.
TwootherkindsofbenigndiscontinuitymentionedintheIntroductionarecombined
intoanS-insertoperation(seeSection4.4belowfordetailsanddiscussion).
Allbenigndiscontinuitiesdescribedherearereversible,anditseemslikelythatone
can almost continuously deform any dataflow graph into any other via these benign
discontinuities, their reversals, and continuous changes of coefficients, as long as one
typeofdatastreamsandafixedsetofbuilt-intransformoperationsisused.
4.1 DataflowPrograms,DataflowGraphs,andDataflowVertices
In this study, a dataflow program P is a finite collection of dataflow graphs, dataflow
vertices,anddataassociatedwithdataflowvertices.Thiscollectionvarieswithtimeand
isorganizedasfolllows.
A dataflow graph G in P consists of a finite, possibly empty collection V of
G
dataflowverticesinPcalledimmediatetargetnodesofGandafinite,possiblyempty
collectionS ofdataflowgraphsinPcalledimmediatesubgraphsofG.
G
ForeachV ∈V graphGiscalledaparentgraphofV.ForeachS∈S graphG
G G
iscalledaparentgraphofS.InthisstudywerequirethatforeveryvertexV inagiven
programPthereisoneandonlyoneparentgraphinP,andthatforeverydataflowgraph
GinagivenprogramPthereisnomorethanoneparentgraphinP.Adataflowgraph
GinPwhichdoesnothaveaparentgraphinPiscalledatop-levelgraphofP.
Typically,exactlyoneofthetop-levelgraphsofPiscalledthemaingraphofPand
isexecuted,whileitvariesintime.
AdataflowvertexV inPconsistsofafinite,possiblyemptycollectionofreferences
to other dataflow vertices in P (those references are called sources ofV), a structure
representingdataassociatedwithV,andareferencetoitsparentgraph.
Thesetofallverticesofadataflowgraphcanbeobtainedbyarecursivelydefined
flatteningoperation,F(G)=V ∪{F(S)|S∈S }.Thesetofallverticesofaprogram
G G
isF(P)=(cid:83){F(G)|Gisatop-levelgraphofP}.
In the software implementation of this study, dataflow programs, dataflow graphs,
and dataflow vertices are represented by classes ProgramEditor, DataFlowGraph,
andDataFlowVertexrespectively.
4.2 DataAssociatedwithDataflowVertices
AstructureDcalleddataassociatedwithadataflowvertexinPconsistsoftherefer-
encetotheuniquedataflowvertexV containingD,andthedataitself.Inthesoftware
implementationofthisstudy,dataassociatedwithadataflowvertexarerepresentedby
subclassesofclassVertexData.
In this study, the most important type of data associated with a dataflow vertex
is a stream of images, which comes in several varieties. Class VertexDataImage
and its subclass VertexDataImageDynamic correspond to classes DataRectangle
andDataRectangleDynamicfromSection3.1respectively.Thethreetypesoftrans-
forms described in Section 3.1 and their associated controls are now subclasses of
DataRectangleDynamic.
InSection5,wealsoconsiderstreamsofdataflowgraphsasdataassociatedwitha
dataflowvertex.
4.3 LimitedDeepCopy
Limited deep copy of a dataflow graph G in P, where G can be a top-level graph or
a subgraph, is a dataflow graph G(cid:48) in P constructed by the following algorithm in the
currentimplementation.G(cid:48) canbeaddedtoPasatop-levelgraphorasasubgraphto
anexistingdataflowgraphinP.
Step1.G(cid:48)iscreatedasarecursivecopyofG,byrecursivetraversalofG.Structures
fordataassociatedwithdataflowverticesofF(G)arecopied,becausethecorrespond-
ingdatastreamsinGandG(cid:48) mightdiffer,sotheyneedtobeabletounfoldindifferent
memory spaces. For each dataflow vertexV in F(G), a forward reference to the cor-
respondentV(cid:48) inF(G(cid:48))iscreated.ThesourcereferencesofV atthisstagearecopied
intactintoV(cid:48).
Step2.SourcereferencesofdataflowverticesofG(cid:48)areupdated,byrecursivetraver-
salofG(cid:48).IfavertexV(cid:48) inF(G(cid:48))hasasourcelinktovertexW,andifvertexW hasa
forwardreferencetovertexW(cid:48),thenthissourcelinkissettopointtoW(cid:48).
Step3.Theclean-upstep.ForwardreferencessetinStep1areresettonullvalues,
byrecursivetraversalofG.
The result is that the references to the sources external to G are preserved in the
newlycreatedcopies,theinternalstructureofGincludingdataflowvertices,references
tosourceswithinF(G),andthedataassociatedwiththedataflowverticesinF(G)are
subjecttotheusual“deepcopy”procedures,andnooutgoingexternallinksfromF(G(cid:48))
arecreated(inthecurrentimplementationthisisfacilitatedbythefactthatallexplicit
linksarefromtargetnodestotheirsources;ifadifferentimplementationweretorequire
explicitoutgoinglinks,onewouldthenneedtotakespecialcaretoonlyincludeinternal
outgoinglinksinthe“deepcopy”andtoomittheexternaloutgoinglinks).
4.4 S-insert
WehavedescribedthefollowingtwobenigndiscontinuitiesintheIntroduction.
First,onetakesadatastreamnodeAandreplacesitwithnodesBandCconnected
byanidentitytransformation.NodeBinheritsfromnodeAitsincominglinksandtheir
transformation. NodeC inherits from node A its outgoing links. Second, one replaces
C=Id(B),withC=(1−α)·B+α·Dwhereα=0,soazeroweightlinkfromsome
nodeDtoCisadded.
S-insert(softinsert/specialinsert)combinesthesetwostepswithoutgoingthrough
theintermediatestateofexplicitlyhavingC=Id(B)configuration.Thetwomainpa-
rameters of this operation are dataflow vertices target vertex and side vertex.
First a dataflow vertex new vertex is created and references to sources and to the
parentgrapharecopiedfromtarget vertextonew vertex.Thenvertexdataasso-
ciatedwithtarget vertexaremovedtonew vertex.Thentarget vertexobtains
twonewsources,new vertexandside vertex,insteadofitsoldsources.Thennew
vertexdatabasedonsum-of-2transformiscreatedfortarget vertexandthecoeffi-
cientsofthistransformaresetinsuchawaythat1correspondstonew vertexand0
correspondstoside vertex.
Ifthetimestepwereinfinitelysmall(asystemsimilartodifferentialequations),this
transformationwouldnothaveanyimmediateeffectonthedynamics,whichiswhywe
call it benign discontinuity. However, one should keep in mind that the replacement
of node A byC=Id(B) actually introduces time delay of one clock tick here in our
typical situation of discrete time. Normally one would expect the effect of this extra
timedelaynottobetoonoticeable,butcertainlytherearesomesituationswhenprecise
synchronizationmightmatter,andthentheoperationisnolongerinnocent.
The main effect of the S-insert operation is, however, that it enriches the space of
possibilitiestocontinuouslychangethesystem,byallowingustocontinuouslyvaryα.
4.5 AnExperimentalSetupinFluid
ImplementationofthisarchitectureinFluidisaround700linesofcodeinProcessing
(seejun 21 15 experimentsubdirectoryoftheFluidproject).
Thesetupofthisexperimentstartswiththeemptymaingraph(program)andtwo
small template top-level graphs, each consisting of two nodes, a constant image node
beingasourceforatransformnode(inonecase,thenegationtransformnode,inanother
case,thewavetransformnode).
4.6 ProgramExecutioninFluid
Theworkcycleateveryclocktickconsistsoftwosteps.Oneisexecutionofthework
cycle of the main graph (which is well defined even when the main graph is empty
and is similar to the work cycle described in Section 3.1), and another is an optional
transformation of a program by benign discontinuities (in this experiment, this trans-
formation is programmed in the tweak optionally method of the ProgramEditor
class,eventuallyoneshouldbeabletoalsoassociateaneditcontrolwiththegraphnode
containingtheprogramitself(seeSection5)).
In this particular experiment, a limited deep copy of a wave transform template is
added first, then while the program is running, a limited deep copy of the negation
transformtemplateisaddedatalaterpoint,andthenwhiletheprogramisrunning,the
S-insertisusedtolinktheoutputofthecopyofthewavetransformtemplatetotheinput
ofthecopyofnegationtransformtemplate.Section5describesafollow-upexperiment
visualizingthisprogramevolution(seeFig.1).
While the program is running, one can also change wave parameters and linear
coefficients by clicking on controls which are associated with the drawing fields of
the respective target nodes in this experiment. Those changes constitute more abrupt
discontinuities,sostrictlyspeakingwhenthosehappen,it’snotalmostcontinuousany-
more. But they only affect the parameters of the transformations, not the structure of
theprogram,sowestilltendtoconsiderthemtobewithinthisprogrammingparadigm
overall.
5 Higher-orderDataflowProgramming
Therearetwomajorclassesofapproachestohigher-orderstream-basedprogramming.
Oneapproachtakesstandardhigher-orderfunctionalprogrammingasastartingpoint,
and focuses on integrating stream-based programming into the standard higher-order
paradigm. The second approach takes the notion of streams of programs as its start-
ingpointanddevelopsfromthere.Thethirdapproachwhichmustbementionedisan
approachbasedonmultidimensionalstreams[13].
This second approach is the one we are pursuing in this paper. We have already
mentionedthedichotomybetweenthefirsttwoapproachesinSection2.3forthecase
ofprobabilisticprogramming.Thebodyofresearchonhigher-orderdataflowprogram-
ming based on streams of functions is modest. An early work which should be men-
tionedinconnectionwiththisisthepreprint[10]bythesecondauthor.Therearerecent
relatedpapersexploringvariousaspectsofthisapproach,forexample[8].
The previous section introduces streams of dataflow graphs which is the first step
towardsadoptingthisapproachtohigher-orderdataflowprogrammingforFluid.
Thenextstepistoincludesuchstreamsofdataflowgraphsasdatastreamscontained
in the nodes of other dataflow graphs (self-reference is, of course, possible and is a
naturalstartingpointaswe’llseeinamoment).
Pragmaticallyspeaking,oneneedstoaddthecapabilitiesforimagingadynamically
changingdataflowgraph,anditisdesirabletoenabletheuseofsuchanimageasanedit
controlcapableofeditingtheunderlyingdataflowprogramwhileitisrunning(justlike
weusedrawingfieldsofordinarymovingimagesascontrolsalteringtheirdynamicsin
theexamplesabove).Itiseasiertoachievethosegoalsifoneincludesanodecontaining
areferencetothemaingraphoftheprogramintothemaingraphitself.
Ourmostrecentexperimentrepresentsapartialstepinthisdirection.Anodecon-
taining a reference to the main graph of the program is included into the main graph
itself, but this setup is only used to provide visualization of a dynamically evolving
dataflow graph, there is no associated edit control yet (see jun 28 15 experiment
subdirectoryoftheFluidproject).
Onestartswiththemaingraphcontainingonlythenodecontainingareferenceto
the main graph itself, and then gradually adds functionality as in Section 4.6. A short
videodemonstratinggradualevolutionofthisdataflowprogramwhileitisrunningand
beingusedinaninteractivefashionispostedon youtube.com(seethemainpageof
the Fluid repository [3] for the link to the video and see the legend included with the
videofordetails;seeFig.1forascreenshot).
Fig.1.Screenshotfromjun 28 15 experiment