[racket] Is there a tcl-expect like module in racket?

From: Neil Van Dyke (neil at neilvandyke.org)
Date: Mon Jan 9 11:54:05 EST 2012

Not that I know of.  I always handcraft instead.  One example was 
programmatically using a REPL of a statistics system from Racket.  I 
usually use "sync" and block reads into my own buffers, and then doing 
the matching on the buffers, while keeping buffer indexes for what's 
been read.

If you're handcrafting, a couple more notes... If you're using indexes, 
but going to do regexps on the buffers, sometimes you might need to 
shift the bytes within the buffers anyway, so you can fit the entire 
bytes to match.  You can also try to match a preferred read block size 
of the device you're talking with, and also take this block size into 
account when sizing your buffer.  Efficient I/O usually looks and feels 
like systems programming.

An "expect"-like library in Racket would be a fun thing for someone to 
write.  You might be able to do more efficient I/O than most languages 
could, through the power of Racket syntactic extension.


Posted on the users mailing list.