jmvanel / semantic_forms

Form generators leveraging semantic web standards (RDF(S), OWL, SPARQL , ...
Other
75 stars 23 forks source link

Refactor abstract form generation: make it functional #170

Open jmvanel opened 7 years ago

jmvanel commented 7 years ago

In english

A follow-p of #169 The steps must be good algorithms in functional programming. That is to say a sequence of pure functions, one per sub-step:

EmptyInitialState.step1.step2

Concerned steps

Refactorings

En français

Il faut que les étapes​ soit des bons algorithmes​ en programmation fonctionnelle. C'est à dire un enchaînement de fonctions pures, une par sous étape:

EtatInitialVide.etape1.etape2
jmvanel commented 6 years ago

See the TODO's in code:

grep TODO abstract_syntax/src/main/scala/deductions/runtime/abstract_syntax/FormSyntaxFactory.scala

An idea is to use function chaining in Scala:

val pipeline = Function.chain(Seq( func1, func2 ))
pipeline(initFormSyntax)
// or
(func1 andThen func2)(initFormSyntax)

cf http://danielwestheide.com/blog/2013/01/23/the-neophytes-guide-to-scala-part-10-staying-dry-with-higher-order-functions.html