LUA Functions

Issue #734 duplicate
Jorn Lapon created an issue

Hi,

I'm not sure if this is the right place to submit these queries, but I have 2 questions: (running idp 3.3.0) 1/ Depending on whether I specify the structure in LUA or in IDP I get a different result for the functions when printing the structure. Similarly, in idp if I set Func = {}, I cannot change it's content using makefalse/true/unknown

vocabulary voc {
    type A
    type B
    type C
    Pred(A,B)
    Func(A,B):C
}

structure S : voc {
}
procedure main() {
    local struc = S
    struc[voc::A.type] = {"a1"}
    struc[voc::B.type] = {"b1"}
    struc[voc::C.type] = {"c1"}
    makeunknown(struc[voc::Pred],{"a1","b1"})
    maketrue(struc[voc::Pred],{"a1","b1"})

    makeunknown(struc[voc::Func].graph,{"a1","b1","c1"})
    maketrue(struc[voc::Func].graph,{"a1","b1","c1"})

    print(struc)
}

This results in

structure S : voc {
  A = { "a1" }
  B = { "b1" }
  C = { "c1" }
  Pred<ct> = { "a1","b1" }
  Pred<cf> = {  }
  Func = {  }
}

While setting local struc = newstructure(voc, "test") results in

structure test : voc {
  A = { "a1" }
  B = { "b1" }
  C = { "c1" }
  Pred<ct> = { "a1","b1" }
  Pred<cf> = {  }
  Func<ct> = { "a1","b1"->"c1" }
  Func<cf> = {  }
}

2/ Is it possible in lua to get as a result Func = {"a1","b1","b2"} instead of the ct and cf version. I don't want to have to specify all possible cf versions explicitly. Something like: struc[voc::Func].graph = {{"a1","b1","c1"}}

Regards,

Jorn

Comments (1)

  1. Log in to comment