OK, reply in-line below On Wed, May 6, 2020 at 12:51 PM Alexander Gabriel <[email protected]> wrote:
> > Am Mittwoch, 6. Mai 2020 18:42:33 UTC+1 schrieb linas: >> >> I think you are mis-using the StateLink. The intent of the StateLink is >> to force an atomic one-and-only-one "membership", ever. Thus the example >> (State (Concept "traffic light") (Concept "red")) means that "traffic >> light" can only have one color at a time, whereas lots of things can be >> red. It's not symmetric -- only the first atom is the thing that has the >> state. (Its also atomic, and can be accessed in multiple threads in a >> consistent, thread-safe manner) >> > > I'm aware. Let's say you have two traffic lights, each can only have one > state/color at a time, but there are multiple traffic lights which can have > the same color. > (State (Concept "first traffic light") (Concept "red")) > (State (Concept "second traffic light") (Concept "green")) > > > You can count number of items in a link with ArityLink >> >> scheme@(guile-user)> (use-modules (opencog) (opencog exec)) >> scheme@(guile-user)> (cog-execute! (Arity (Set (Concept "A") (Concept >> "B")))) >> (NumberNode "2") >> >> (cog-evaluate! (GreaterThan (Arity (Set (Concept "A") (Concept "B"))) >> (Number 1))) >> (stv 1.000000 1.000000) >> > > > Good to know, but that wasn't the goal. I want to check whether a specific > traffic light is red. > I can get all the traffic lights that are red with a getlink, > ... or you can get just one of them: (Get (State (Concept "second traffic light")(Variable "x"))) but they'll be wrapped in a setlink, > It turns out that using SetLink for search results was a massive disaster. There is slow progress in fixing this. As of yesterday, MeetLink is the same as GetLink except it doesn't return a Set. Unfortunately, EqualLink doesn't yet know how to deal with this. I'll see if I can fix that today. .. one at a time. > so I can't compare the set of many against my one traffic light > node...unless I can check for something being an element of a setlink. > The Subset idea is a very interesting idea! Apparently, no one asked for this before :-/ but in retrospect, its obvious that it should have "just worked". I will try to fix this maybe today. By "fix", I mean make the following work: (cog-evaluate! (Subset (Set (Concept "A")) (Set (Concept "A") (Concept "B")))) and also (cog-evaluate! (Member (Concept "A") (Set (Concept "A") (Concept "B")))) getting this to run should be easy. -- Linas > > Best, > Alex > > -- > You received this message because you are subscribed to the Google Groups > "opencog" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/opencog/ed7a3675-7669-4cb1-95ca-d1382fd29a02%40googlegroups.com > <https://groups.google.com/d/msgid/opencog/ed7a3675-7669-4cb1-95ca-d1382fd29a02%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- cassette tapes - analog TV - film cameras - you -- You received this message because you are subscribed to the Google Groups "opencog" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/opencog/CAHrUA35%3DsrSepbxNZhmJNswDDnPyzG1AyuznCprb%3D6H%2Bb9Kd%2BA%40mail.gmail.com.
