Git Product home page Git Product logo

Comments (3)

mverardo avatar mverardo commented on June 27, 2024

ExpandTemplate has an overload that accepts which of the ith expansions should be made.
For instance:

With[{k = 2, t = ColorBlindTemplate[2, 1.0]},
 ExpandTemplate[t, #] & /@ 
  Range[0, k^Length[TemplateCoreVars[t]] - 1]]

is equivalent to:

With[{k = 2, t = ColorBlindTemplate[2, 1.0]},
 ExpandTemplate[t]]

This means the user can partition the range any way he wants and perform any kind of side effect (dump into a file, for instance) as needed for each partition.

What we could do to make this easier is expose a function that gives you the upper bound of the expansion range so the user won't have to calculate it.

from catemplates.

mverardo avatar mverardo commented on June 27, 2024

Note that the user can also use a more imperative approach if he wants:

With[{k = 2, t = ColorBlindTemplate[2, 1.0]},
 For[i = 0, i < k^Length[TemplateCoreVars[t]], i++,
  e = ExpandTemplate[t, i];
  DumpToFile[e];]]

from catemplates.

PPBO avatar PPBO commented on June 27, 2024

This is certainly a good workaround, and we might be happy to stick to it for the moment.

But what I really had in mind is an iterative alternative, tha might allow the user to compute all expansions wanted, provided they would be willing to wait. This is what the IthTuple function in CAMaT allows; have a look.

from catemplates.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.