Zero

Member

Last active 2 months ago

  1. 2 months ago
    Fri Dec 15 12:45:12 2017

    PEGjs syntax:

    sourceCode
    = ns:namespace* id:itemDef* _ { return { namespaces:ns, definitions:id }; }
    
    
    _
    = [ \t\r\n]*
    
    
    namespace
    = _ ns:namespaceId _ ":" _ '"' fp:filepath '"' { return { namespace: ns, filepath: fp }; }
    
    
    itemDef
    = _ id:localItemId _ "->" _ iv:itemValue { return { item:id, value:iv }; }
    
    
    namespaceId
    = c:normalChar* { return c.join('').trim(); }
    
    
    filepath
    = c:[^"\t\r\n]* { return c.join('').trim(); }
    
    
    itemValue
    = metadata / relationship / behavior
    
    
    localItemId
    = c:normalChar+ { return c.join('').trim(); }
    
    
    itemId
    = fns:namespaceId nns:nextItemPath* {
    
      var whole = [fns].concat(nns);
      var id = whole.pop();
      
      return { type:"item", id:id, path:whole };
    }
    
    
    nextItemPath
    = "/" ns:namespaceId { return ns; }
    
    
    metadata
    = _ "[" meta:metadataContent+ "|" data:metadataContent+ "]" {
    
    	return { type:"meta/data", content:{ meta:meta, data:data } };
    }
    
    
    relationship
    = _ ri:relationshipId _ "{" _ sd:slotDef* _ "}" {
    
    	return { type:"relation", name:ri, content:sd };
    }
    
    
    behavior
    = _ "(" fb:behaviorContent nb:nextBehaviorContent* ")" {
    
    	return { type:"behavior", content:[fb].concat(nb)};
    }
    
    
    metadataContent
    = itemValue
    / textContent
    
    
    textContent
    = c:normalChar+ { return { type:"text", content:c.join('') }; }
    
    
    relationshipId
    = c:normalChar+ { return c.join('').trim(); }
    
    
    slotDef
    = _ si:slotId _ ":" _ fi:slotValue _ ni:nextSlotValue* _ ";" {
    
        return { slot:si, value:[fi].concat(ni) };
    }
    
    
    behaviorContent
    = itemValue / itemId
    
    
    nextBehaviorContent
    = _ "," _ b:behaviorContent { return b; }
    
    
    slotId
    = c:normalChar+ { return c.join('').trim(); }
    
    
    slotValue
    = itemId / itemValue
    
    
    nextSlotValue
    = _ "," _ v:slotValue { return v; }
    
    
    normalChar
    = c:[^\-\<\>\{\}\[\]\(\)\:\/\,\;\|\\] { return c; }
    / "-" c:[^>] { return "-"+c; }
    / "\\" c:. { return c; }
  2. Tue Dec 12 12:59:42 2017
    namespace prefix : "filepath"

    This is the namespace format. It allows the declaration of a namespace for importing and using definitions from other files, without name conflict.

    If another file containing a foo -> [meta|data] item is imported here with bar: "another file.txt", then we can access foo from here with bar/foo . The slash separates namespaces and the item identifier.

  3. Tue Dec 12 12:23:16 2017
    item name -> ( behavior node, ... , ... )

    This is the behavior format. Syntactically, it is equivalent to s-expression, except elements are separated be commas instead of white spaces.

    Its purpose is to describe task trees, as used in video games, where tree nodes represent either atomic tasks, or control flow for sub-tasks.

  4. Tue Dec 12 11:03:53 2017
    item name -> relation type { slot1: item1, item2, ... ; slot2: item3; }

    This is the relationship format. The relation type identifies the kind of relationship we're using, and slots are roles that items play in this relation. Several items can have the same role.

    It looks a bit like CSS at first. In fact, it's a simple way to link things together, with a possibility to link links themselves.

  5. Tue Dec 12 10:58:49 2017
    item name -> [ meta | data ]

    This is the semi-structured data format. The meta part contains meta-information about the data part.

    In XML, the equivalent of the meta part would be the attributes of an element. In XML, attributes are merely associative arrays. But here, the meta part can be a tree containing other nested meta|data boxes.

  6. Tue Dec 12 10:19:33 2017
    Zero started the conversation Mind structures declarative language.
       namespace prefix : "filename"
    
       item name -> [ meta | data ]
    
       item name -> relation type { slot1: item1, item2, ... ; slot2: item3; }
    
       item name -> ( behavior node, ... , ... )
    
    
    
    
    
       EBNF
    
       (proposed ISO/IEC 14977 standard, by R. S. Scowen)
    
       Usage             Notation
       -----             --------
       definition        =
       concatenation     ,
       termination       ;
       alternation       |
       optional          [ ... ]
       repetition        { ... }
       grouping          ( ... )
       terminal string   " ... "
       terminal string   ' ... '
       comment           (* ... *)
       special sequence  ? ... ?
       exception         -
    
    
    (* White spaces are not shown here. They're allowed anywhere. *)
    
    
    source file =
    { namespace declaration } , { item definition } ;
    
    
    item identifier =
    text where special characters are escaped ;
    
    
    namespace declaration =
    item identifier , ":" , '"' , filename , '"' ;
    
    
    item definition =
    item identifier { "/" item identifier } , arrow , item value ;
    
    
    arrow =
    "->" ;
    
    
    item value =
    meta/data | relation | behavior ;
    
    
    meta/data =
    "[" , { meta/data content } , "|" , { meta/data content } , "]" ;
    
    
    meta/data content =
    text where special characters are escaped | item value ;
    
    
    relation =
    relation type , "{" , { slot description } , "}" ;
    
    
    relation type
    = text where special characters are escaped ;
    
    
    slot description
    = slot name , ":" , slot value , { additional slot value } , ";" ;
    
    
    slot name
    = text where special characters are escaped ;
    
    
    slot value
    = item identifier | item value ;
    
    
    additional slot value
    = "," , slot value ;
    
    
    behavior
    = "(" , atomic EventAct , { additional behavior content } , ")" ;
    
    
    atomic EventAct
    = text where special characters are escaped ;
    
    
    additional behavior content
    = "," , behavior content ;
    
    
    behavior content
    = behavior | item identifier | item value ;
  7. Tue Dec 12 09:49:15 2017
    Zero started the conversation Topic tree.
    state
       type of thoughts
          concept
             abstract
             concrete
             instance
          conjecture
          decision
             alternative
             evaluative criteria
             criteria priority
             alternative attraction weight
          definition
             term
             meaning
             synonym
                nuance
                context
             antonym
                nuance
                context
          explanation
             fact
             cause
             consequence
             context
          hypothesis
          idea
          logical argument
          logical assertion
          mental image
          percept
             perceptual component
          proposition
          syllogism
             premise
             conclusion
             validity
          thought experiment
       content of thoughts
          argument
          belief
             certainty
             probability
             bayesian network
          data
          information
          knowledge
             theoretical
                cause consequence chain
             practical
                know how to
          schema
       memory
          implicit
             procedural
             perceptual
          explicit
             episodic
             semantic
       goal
          requirement
          subgoal
          goal-to-current path
             state event state
             path criteria
       association
       plan
          step
       language
          vocabulary
          grammar
       emotion
          attraction
          repulsion
          empathy
       thought frames
          active frame
          suspended frame
    process
       thought frame handling
       generalizing
          pattern recognition
          pattern label creation
       associating
       focusing
          unexpected event noticing
       reasoning
          abductive reasoning
          analogical reasoning
          deductive reasoning
             premises selection
             conclusion deduction
          inductive reasoning
          moral reasoning
          probabilistic reasoning
       volition
          decision making
             flipism
             satisficing
                finding first acceptable alternative
             optimizing
                objectives importance ranking
                alternatives analysis
                   alternatives weighing
                alternatives ranking
          acting
          problem solving
       planning
       learning
       percepting
       interpreting
          context targeting
          choosing role set
          role dispatching
       imagining
          scene space creation
          scene element evocation
          scene evolution
       memorizing
       remembering
       comparing
    eventact
       frame
          open thought frame
          switch thought frame
          close thought frame
       goal
          find goal-to-current path
       percept
          link new percept to set of percepts
  8. 6 months ago
    Mon Aug 7 20:58:10 2017
    Zero started the conversation Lazy spreadsheet.

    The whole thing is going to be a network of cells, where each cell holds values that depend on values from other cells. We'll use the observer pattern to propagate value modifications: each cell maintains a list of its dependents, called observers, and notifies them automatically of any state changes.

    A cell contains a bag. Values of the cells it observes are transfered to its bag, so the cell's value is calculated. When it's done, the cell is flagged up-to-date.

    It works like a spreadsheet. But we don't want values to be calculated automatically, because it would be a huge waste of energy. What we want is a lazy spreadsheet.

    When an observed cell changes its value, instead of propagating its new value, it just emits a need refresh message. When cells receive this message, they set their up-to-date flag to false and propagate the same message to all their observers, if it has not be done already.

    The system tends to be standing by. When a particular value, on a specific cell, is needed, if this cell's up-to-date flag is true, we get the value instantly. If it's false, the cell sends a calculate now message to the cells it observes, to get the new value.

    When a cell receives a calculate now message, if its value is up-to-date, it returns it, else it propagates the calculate now message to the cells it observes.

    So, we have two types of messages: the need refresh message, flowing from observed to observers, and the calculate now message, flowing from observers to observed.

    A "function" is no longer linear, but rather automatically determined to produce a value when needed, depending on what's already known and what's not yet. In this context, "calling" a function consists of: setting some cell's values (these are the parameters), sending a calculate now message to a target cell (this is the function call), and getting the target cell's value (the "return" value).

  9. Sat Aug 5 16:06:56 2017
    Zero posted in Bags.
    var log = function(x) { console.log(JSON.stringify(x,null,4));};
    
    var functionList = {
    
        sum: function(arg) {
            var result = 0;
    
            for (a in arg) {
                n = parseFloat(arg[a].value);
                if (!isNaN(n) && isFinite(n)) result += n;
            }
            return result;
        },
    
        avg: function(arg) {
            var result = 0;
            for (a in arg) {
                n = parseFloat(arg[a].value);
                if (!isNaN(n) && isFinite(n)) result += n;
            }
            return result/arg.length;
        },
    
        max: function(arg) {
            var result = null;
            for (a in arg) {
                n = parseFloat(arg[a].value);
                if (!result) result = n;
                else if (!isNaN(n) && isFinite(n) && (result<n))
                    result = n;
            }
            return result;
        },
    
        min: function(arg) {
            var result = null;
            for (a in arg) {
                n = parseFloat(arg[a].value);
                if (!result) result = n;
                else if (!isNaN(n) && isFinite(n) && (result>n))
                    result = n;
            }
            return result;
        }
    
    }
    
    
    var functionOrder = [
        "sum",
        "avg",
        "max",
        "min"
    ]
    
    
    var testBag = [
        {type:"number", value:5},
        {type:"function", value:"max"},
        {type:"number", value:8},
        {type:"number", value:6},
        {type:"function", value:"avg"},
        {type:"number", value:2},
        {type:"number", value:4},
        {type:"number", value:1}
    ]
    
    
    
    function highestRankFunction(bag) {
    
        var highest = functionOrder.length+1;
    
        for (var b in bag) {
            if ((bag[b].type=="function")
            && (functionOrder.indexOf(bag[b].value)>-1))
               if (functionOrder.indexOf(bag[b].value)<highest)
                    highest = functionOrder.indexOf(bag[b].value);
        }
        return functionOrder[highest];
    }
    
    
    function solveBag(bag) {
    
        var fun = highestRankFunction(bag);
    
        return functionList[fun].call(null,bag)
    }
    
    
    
    log("Result: "+solveBag(testBag));
    
    log('done');
    
  10. Thu Aug 3 14:58:32 2017
    Zero started the conversation Bags.

    If you put in a bag a number seven 7, a number two 2, a plus sign +, and a number three 3, a human mind would instantly know what can be done with these. We have an operator, three operands... we can sum the numbers, and get 12.

    Computers don't like bags. A typical programming language needs a particular syntax. For example (+ 7 2 3), or +(7, 2, 3), or 7 + 2 + 3. If you don't follow the syntax, you get a syntax error.

    Let's do bags. Let's get rid of syntax.

    It's quite easy to do if you're sure you have only one operator, and the right operands. But if we put a string in our first bag, how do we add numbers and strings? And if we put a second operator, for example *, should we sum numbers or multiply them? Our bag seems unusable in these situations.

    To solve the several operators issue, we need ordering.

    Imagine we have 50 possible functions. If we order them, we can choose what to do when there are several functions in a bag. Our 50 functions list looks like:

    1. sum
    2. multiply
    3. max
    4. min
    5. ...etc.

    If there are several functions in a bag, the highest rank function is selected. Problem solved.

    Now what if we put strings in a bag that's about to multiply things. Well we can just ignore them. Problem solved.

    What good are bags anyway?

    They're good at connecting things without relying on a pre-existing infrastructure.

View more