guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: User-Friendlyness of Guix and non-scaryness, printing messages


From: Danny Milosavljevic
Subject: Re: User-Friendlyness of Guix and non-scaryness, printing messages
Date: Sun, 28 May 2017 22:35:17 +0200

And the spinner implementation:

(define p
  (let ((index 0)
        (spinner-chars "|\\-/"))
    (define (spin)
      (set! index (+ index 1))
      (if (>= index (string-length spinner-chars))
        (set! index 0))
      (display (array-ref spinner-chars index))
      (display "\b"))
    (make-soft-port
           (vector
            (lambda (c) (if (char=? c #\newline) (spin) (write c))) ; putc
            (lambda (s) (if (string-contains s "\n") (spin))) ; puts
            (lambda () #t) ; flush
            (lambda () #f) ; getc
            (lambda () #t)) ; close
           "w")))

(define (f)
  (display "\n" p)
  (f))

(f)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]