[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LOGO-L> logic pizzle



let me add an attempt to solve olga's puzzle.

i translated the problem into set langaubne
(well, almost)

[j 5] istjapan 5th century
and then the search becomes:
among all possible pairs find a pair which 
has exactly one match withh all the pairs
given by the experts.

then i do some hopefully nice stuff
with the high order
functions 
map and filter to find the solution.

my code definitely needs refinement to deal
more intelligently with 
not statments coming from the xperts,
possibly the experts options shpould be 
reprteented not as pairs,
but as sets of pairs
and then the check would become
does the experts set contain an element with
exactly one match with a "data point"

i just wanted to show
that this is a way
different from the solutions
published so far on the list.

to all.poss
output (crossmap [se ?1 ?2] [j c] [3 4 5])
end

to check.experts :l :data
output [1 1 1] = map [n.matches ? :data] :l
end

to experts
output [[c 5] [j 3] [j 4]]
end

to n.matches :x :y
if emptyp :x [output 0]
if (first :x) = (first :y) [output 1 + n.matches bf :x bf :y]
output n.matches bf :x bf :y
end

to solve
output filter [check.experts experts ?] all.poss
end



-- 
Email: neuwirth@smc.univie.ac.at
Computer Supported Didactics Working Group, University of Vienna  
PGP-key at http://www.smc.univie.ac.at/PGP-Keys/neuwirth.asc
Visit our SunSITE Austria at http://sunsite.univie.ac.at

---------------------------------------------------------------
Please post messages to the Logo forum to logo-l@gsn.org.  Mail
questions about the list administration to logofdn@gsn.org.  To
unsubscribe send    unsubscribe logo-l    to majordomo@gsn.org.



Global SchoolNet Foundation - Linking Kids Around the World!
Copyright GSN - All Rights Reserved - Comments & Questions
Visit GSN's Global Schoolhouse for more exciting learning resources!
Search our Site - Home