Hi, I wanted to use a program from an older question from myself again and found the following strange thing:
The following code works fine:
m=3
le_relations = lambda P: [(a,b) if P.le(a,b) else (b,a) for a,b in P.comparability_graph().edges(labels=None)]
cover_relations = lambda P: [(a,b) if P.le(a,b) else (b,a) for a,b in P.hasse_diagram().edges(labels=None)]
format_pt = lambda k: "'x{0}'".format(k+1)
format_relations = lambda relations: [[format_pt(a),format_pt(b)] for a,b in relations]
format_pts = lambda P: [format_pt(a) for a in P]
format_poset = lambda P: [format_pts(P), format_relations(cover_relations(P)), format_relations(le_relations(P))]
what_you_want = lambda n: [format_poset(P) for P in [posets.BooleanLattice(m)]]
print(what_you_want(m))
The following code does not work:
m=3
le_relations = lambda P: [(a,b) if P.le(a,b) else (b,a) for a,b in P.comparability_graph().edges(labels=None)]
cover_relations = lambda P: [(a,b) if P.le(a,b) else (b,a) for a,b in P.hasse_diagram().edges(labels=None)]
format_pt = lambda k: "'x{0}'".format(k+1)
format_relations = lambda relations: [[format_pt(a),format_pt(b)] for a,b in relations]
format_pts = lambda P: [format_pt(a) for a in P]
format_poset = lambda P: [format_pts(P), format_relations(cover_relations(P)), format_relations(le_relations(P))]
what_you_want = lambda n: [format_poset(P) for P in posets.YoungsLattice(m)]
print(what_you_want(m))
The only difference between two codes is that in the second code I have
what_you_want = lambda n: [format_poset(P) for P in posets.YoungsLattice(m)]
instead of
what_you_want = lambda n: [format_poset(P) for P in [posets.BooleanLattice(m)]].
Entering the second code gives an error. I do not really understand why the first works and the second does not, so any help is welcome how to fix the error.