Author: | jleija |
---|---|
Mode: | factor |
Date: | Sat, 19 Mar 2011 03:40:08 |
! Copyright (C) 2011 jleija. ! See http://factorcode.org/license.txt for BSD license. USING: kernel namespaces math io io.files io.encodings.ascii strings ; IN: text-fu SYMBOL: encoding ascii encoding set-global : current-encoding ( -- sym ) ! encoding encoding get ; GENERIC: wc-l ( file-object -- n ) M: string wc-l ( file -- n ) current-encoding [ 0 [ drop 1 + ] each-line ] with-file-reader ;