On 2010-02-05, Helge Kruse wrote:
> I found a lilypond script on a programmer's website. It shall print
> piano keys. But this gives only errors when I compile it with
> lilypond. Would it be really possible to achieve what is requested
> or is it just a joke?
> 
> Here is the link: http://kuerzer.de/DpMHSdKCO

Sure!  That's quite interesting.

Attached is the "unobfuscated" code that compiles just fine.  I'm not
entirely sure what's wrong with the original, but it might be that
there is too *little* whitespace somewhere.  :-)

Here is some example output:

  $ echo A 7 | lilypond obfuscated.ly 2>/dev/null 
  ##  ###   |   ###  ###   |   ###  ##
  ##  ###   |   ###  ###   |   ###  ##
  ##  ###   |   ###  ###   |   ###  ##
  ##  ###   |   ###  ###   |   ###  ##
  ##  ###   |   ###  ###   |   ###  ##
  |    |    |    |    |    |    |    |
  |    |    |    |    |    |    |    |
  |    |    |    |    |    |    |    |
  |____|____|____|____|____|____|____|


-Patrick
\version "2.12.1"

x = #ly:string-substitute

u = #(x "*" "###  " "|   *** |   ** ")

"q" =#read-char

t = #(x "###" " | " u)

z = #(q)

v = #(if (eq? (q) #\#) 1 0)

y = #(iota (+ (* (read) 5) 1 v))

#(format #t "~{~{~a~}\n~}"
   (map
     (lambda (s)
       (map
         (lambda (i)
           (string-ref s (modulo (+ (* (char->integer z) 5) i (* v 4)) 35)))
         y))
     (list u u u u u t t t (x " " "_" t))))
_______________________________________________
lilypond-user mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to