Read a specific line from a file
Without an argument, the lines
function reads filenames from the command line, or defaults to standard input. It then returns a lazy list, which we subscript to get the 7th element. Assuming this code is in a program called line7
:
This works even on infinite files because lists are lazy:
Last updated