AlexEnrique / UFABC-Chaos-project

This repository is intended to the development of my numerical project of the discipline "Nonlinear dynamics and chaos", of the Physics course at Federal University of ABC (UFABC) - Brazil
MIT License
0 stars 0 forks source link

TODO #2

Open AlexEnrique opened 4 years ago

AlexEnrique commented 4 years ago

TODO list

AlexEnrique commented 4 years ago

That method was used to have access to the aliased lambda. One way to get access to the lambda is to define a function template to capture the same alias as

auto foo(alias f, ...)(Map!f map, ...) {
    \\ use 'f' here.
}
AlexEnrique commented 4 years ago
AlexEnrique commented 4 years ago
map!(x => dynamicFunc(x))
AlexEnrique commented 4 years ago

Is there an way to deal with run-time template values?

  • Possibly Voldemort Types returned by templates?

Yes! Look at this working example:

auto createLogisticMap(double a, real x = real.init) {
    class _LogisticMap : Map!(x => a * x * (1 - x)) {
        this() {}

        this(real x) {
            super(x);
        }
    }

    if (x != real.init) return new _LogisticMap(x);
    return new _LogisticMap;
}

auto rnd = Mt19937_64(unpredictableSeed!ulong);
auto map = createLogisticMap(a, rnd.uniform01);
AlexEnrique commented 4 years ago
if (x != real.init) return new _LogisticMap(x);
    return new _LogisticMap;
AlexEnrique commented 4 years ago