[Haskell-beginners] Wrapping random
Andrew Sackville-West
andrew at swclan.homelinux.org
Sat Nov 29 12:02:23 EST 2008
On Fri, Nov 28, 2008 at 10:53:32PM +0100, Torsten Otto wrote:
> Hi all,
>
> I teach a high school class in Computer Science. The current programming
> goal is to implement chat-bots, and we're using Haskell of course. Now
> one of my students had the seemingly easy idea of having the bot answer
> with a random sentence if it doesn't have "good" answer.
Perhaps instead of using a random number, you could simulate
randomness with some other technique. For example, if there is no good
response in a particular situation, you could hash the input and map
it to some predetermined responses. This would keep you in the IO
monad (I think. I'm a total rookie at this). You could then useit as a
vehicle to teach some other stuff such as the meaning of random in a
computer environment (vs true randomness) and concepts of hashing
(even looking into collisions in a simple way because the students
will see that different situations reliably give rise to the same
outout).
.02
A
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/beginners/attachments/20081129/21f097d8/attachment.bin
More information about the Beginners
mailing list