Future Dream? -> Functional Programming extension for C2

0 favourites
  • 10 posts
From the Asset Store
Piano dreams
$6.95 USD
A beautiful and romantic background piano track. Together with awesome strings it makes a perfect track for your game.
  • Hi (@Ashley)

    For player data collection/instrumentation I have an elaborate data structure of dictionaries included in other dictionaries, yielding plenty of hierarchical json. I notice that it requires a lot of loop programming.

    It would be great if C2 would have a functional programming extension that would allow applying function to Arrays and Dictionaries, and/or more specifically a map reduce extension.

    Is my requirement common? If yes, could this be done?

  • There is a 3rd party HashTable plugin that does what you want. I suggest using that for nesting data groups.

  • Thanks. Looks interesting, but its just a first step towards what i am looking for.

    What i need, essentially, is a the application of a select function, to generate selected entries (recursively, if needed), and then an apply function that applies to all results another function. The functions could be C2 functions with parameters, and perhaps a special parameter called "this" if needed.

  • You can use strings with tokenat() in dictionaries, or arrays.

    Its not keypair, more like csv.

  • I know where your coming from, from wanting nested json hierarchies so I wrote that in an ES myself. It's a pain. However I don't get what your saying what you want. Could you please try again maybe with a diagram of some sort. Maybe there is a storage plugin that does as you want. Maybe someone can offer an alternative as newt provided.

    From what I understand is that you want to start one function to look through the entire storage, and then when finding an entry to call a callback function?

  • grossd, I run into this problem a lot, where construct's primitive (flat) data structures aren't adequate to express many many things. Thankfully we have the SDK.

    What I usually end up doing is use the SDK to create a plugin or behavior that hides the data structures, as well as any functions required (push, pop, map/reduce, splice).

    Those objects are usually not documented, niche and/or too complex for general use, so I don't release them to the public.

  • Or Yann 's JSON plugin. It is more completed then mine.

  • Hopefully this will all be sorted when we have a more extensible IDE

    I'd love to integrate something like this directly in the editor.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Fimbul

    I so agree. I feel with major features with C2 winding down or impossible for C2; that it's time to start laying out the ground work for C3. As Ashley said. r200 will just be like any other release.

    Thanks Rex. I like Yans plugin.

  • All

    I think that the C2 programming "language" and environment is fantastic.

    It's even driven paradigm, and its include sheets, allows programming constructions that are hard to accomplish in "traditional" languages, including Java and the like. It would be great if C3 could build on its strength and selectively (and carefully) add some "software engineering" constructs, to make larger code more maintainable.

    This could include native support for state machines, making functions a first class entity, rather than string only, support and perhaps even named approaches to define, reuse, adapt (inherit?) event expressions.

    I dream of a general purpose web programming environment build on a C3 type of paradigm. Its no-nonsense, and much easier to use than, say, Javascript, with its numerous programming idioms.

    I think a good example to think about is Wolfram's Mathematica, It's a functional language with which you can process list and recursive structures in a very elegant way.

    Instead of say ("procedural code):

    for each (ArrayA): ArrayA.currentValue>5, ArrayB.push(Array.currentValue)

    you write (in functional pseudo code):

    Push(ArrayB ,Select(x >5, ArrayA), ArrayB))

    Or, sometimes, like this (using a pipe function "=>"):

    Select(x >5, ArrayA) => Push(ArrayB)

    Javascript, btw, does support functional programming to some good extent.

    Thanks, the json plugin sounds very promising, to help with a path oriented approach to navigating to relevant data in hierarchical json structures.

    Dan

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)