From 7e9cd45624ee0075a575ed48462b79a956290088 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Thu, 2 Feb 2017 16:39:56 -0800 Subject: [PATCH] simple-flat-file: factor out drop-comment word. --- basis/simple-flat-file/simple-flat-file.factor | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/basis/simple-flat-file/simple-flat-file.factor b/basis/simple-flat-file/simple-flat-file.factor index c8caaed651..ebcb9580ca 100644 --- a/basis/simple-flat-file/simple-flat-file.factor +++ b/basis/simple-flat-file/simple-flat-file.factor @@ -5,8 +5,11 @@ io.encodings.utf8 io.files kernel math.parser sequences sets splitting ; IN: simple-flat-file +: drop-comment ( line -- line' ) + dup [ "#@" member? ] find drop [ head ] when* ; + : drop-comments ( seq -- newseq ) - [ dup [ "#@" member? ] find drop [ head ] when* ] map harvest ; + [ drop-comment ] map harvest ; : split-column ( line -- columns ) " \t" split harvest 2 short head 2 f pad-tail ;