Skip to main content
2 of 4
deleted 48 characters in body
coredump
  • 6.8k
  • 24
  • 47

Common Lisp, 488 420

(lambda(z)(dotimes(r 3)(map()(lambda(c)(do((i 0(+ 17 i))n)((or(and(> i 918)(setf n 146))(=(char-code c)(ldb(byte 8 9)(setf n(ldb(byte 17 i)#36R1G82YLCJU3YUURSA2A36SXGDRXAQCX0WCXKXEBGT5GCMKUH3SUIICNXBQXJV9PUCN61AEE2O0VKPHU88EXAHSEW0P3V2H3Q6OYZ1Y18QMZPNG8ZSK6ORMIYWVG5E65YRLPAV2G4XEETBGYXLJ2RGXICOG2TPNALXEH84W6SFZZD0KHS0Z6)))))(loop for v from(* 3 r)for d across"!_!"do(format t"~:[ ~;~A~]"(logbitp v n)d)))))z)(terpri)))

Example

With "abcdefg'hijlKnopqrstuz", prints:

 _           _  _  _   !             _        _  _     _        _ 
!_!!_  _  _!!_ !_ !     !_   !  !!   _  _  _ !_!!_! _ !_ !_     _!
! !!_!!_ !_!!_ !  !_!   ! !  !!_!!_  _ ! !!_!!    !!   _!!_ !_!!_ 

Remarks

Characters and their representations are encoded in this number in base 36:

#36R1G82YLCJU3YUURSA2A36SXGDRXAQCX0WCXKXEBGT5GCMKUH3SUIICNXBQXJV9PUCN61AEE2O0VKPHU88EXAHSEW0P3V2H3Q6OYZ1Y18QMZPNG8ZSK6ORMIYWVG5E65YRLPAV2G4XEETBGYXLJ2RGXICOG2TPNALXEH84W6SFZZD0KHS0Z6

The binary representation of this digit is divided in groups of 17 bits.

For example, the last group of 17 bits is 110000111101010, which is decomposed here in two parts:

  1. 110000, the char-code of character 0

  2. 111101010, an encoding of the drawing, best represented as follows:

     010 (bits 0-2)         _ 
     101 (bits 3-5)   =>   ! !
     111 (bits 6-8)        !_!
    

    Bits in first and last "column" are for ! characters, the ones in the middle column for the _ character. When necessary, both uppercase and downcase versions of a character are stored.

The function iterates three times over the input string, one for each line of output, searches for a matching character in the table (or defaults to 146, a.k.a. three bars), and prints the representation at current row.

coredump
  • 6.8k
  • 24
  • 47