Beatles Bench · The ten functions
find picks one from many.
find reads every line together and picks the one that answers the question. Each line sees the others. An answer can depend on the whole set.
Run it
find picks Love Me Do.these_songs="These are songs by the Beatles."
question="$these_songs Which one did they release first?"
cat <<'EOF' |
She Loves You
I Saw Her Standing There
From Me to You
All My Loving
Love Me Do
I Want to Hold Your Hand
Please Please Me
Can't Buy Me Love
A Hard Day's Night
I Feel Fine
EOF
thinkthen find "$question" \
--replay recordingOutput
Love Me Do
exit 0: a line came back
The lesson
Love Me Do came out first, and the pick is right.
Without --none, find always names a line. Check its picks on records you know before you trust it.
On GitHub: github.com/botassembly/beatles-bench/tree/main/examples/find