How about :
\version "2.19.82"
#(set-default-paper-size "a6")
#(define counter-alist '())
#(define-markup-command (counter layout props name) (string?)
"Increases and prints out the value of the given counter named @var{name}.
If the counter does not yet exist, it is initialized with 1."
(let* ((oldval (assoc-ref counter-alist name))
(newval (if (number? oldval) (+ oldval 1) 1)))
(set! counter-alist (assoc-set! counter-alist name newval))
(interpret-markup layout props
(markup (number->string (round newval))))))
\markup {
\column {
"counter :"
\fill-line {
\counter #"counter" \counter #"counter" \counter #"counter"
\counter #"counter" \counter #"counter" \counter #"counter"
\counter #"counter"
}
\null
"\pattern :"
\fill-line { \pattern #7 #X #7 \counter #"pattern" }
\null
"\fill-with-pattern :"
\fill-with-pattern #7 #RIGHT \counter #"fill-with-pattern" \null \null
}
}