Everything2
Near Matches
Ignore Exact
Full Text
Everything2

The Lord's Prayer: binary

created by Soberty

(thing) by Frank Grimes (1.5 y) (print)   ?   (I like it!) Thu Apr 11 2002 at 3:59:13

01001111 01110101 01110010 00100000 01100110 01100001 01110100
01101000 01100101 01110010 00101100 00100000 00001010 01110111
01101000 01101111 00100000 01100001 01110010 01110100 00100000
01101001 01101110 00100000 01101000 01100101 01100001 01110110
01100101 01101110 00101100 00100000 00001010 01101000 01100001
01101100 01101100 01101111 01110111 01100101 01100100 00100000
01100010 01111001 00100000 01010100 01101000 01111001 00100000
01101110 01100001 01101101 01100101 00101110 00100000 00001010
01010100 01101000 01111001 00100000 01101011 01101001 01101110
01100111 01100100 01101111 01101101 00100000 01100011 01101111
01101101 01100101 00101100 00100000 00001010 01110100 01101000
01111001 00100000 01110111 01101001 01101100 01101100 00100000
01100010 01100101 00100000 01100100 01101111 01101110 01100101
00100000 00001010 01101111 01101110 00100000 01100101 01100001
01110010 01110100 01101000 00100000 01100001 01110011 00100000
01101001 01110100 00100000 01101001 01110011 00100000 01101001
01101110 00100000 01101000 01100101 01100001 01110110 01100101
01101110 00101110 00100000 00001010 01000111 01101001 01110110
01100101 00100000 01110101 01110011 00100000 01110100 01101000
01101001 01110011 00100000 01100100 01100001 01111001 00100000
01101111 01110101 01110010 00100000 01100100 01100001 01101001
01101100 01111001 00100000 01100010 01110010 01100101 01100001
01100100 00101100 00100000 00001010 01100001 01101110 01100100
00100000 01100110 01101111 01110010 01100111 01101001 01110110
01100101 00100000 01110101 01110011 00100000 01101111 01110101
01110010 00100000 01110100 01110010 01100101 01110011 01110000
01100001 01110011 01110011 01100101 01110011 00101100 00100000
00001010 01100001 01110011 00100000 01110111 01100101 00100000
01100110 01101111 01110010 01100111 01101001 01110110 01100101
00100000 01110100 01101000 01101111 01110011 01100101 00100000
01110111 01101000 01101111 00100000 01110100 01110010 01100101
01110011 01110000 01100001 01110011 01110011 00100000 01100001
01100111 01100001 01101001 01101110 01110011 01110100 00100000
01110101 01110011 00101110 00100000 00001010 01001100 01100101
01100001 01100100 00100000 01110101 01110011 00100000 01101110
01101111 01110100 00100000 01101001 01101110 01110100 01101111
00100000 01110100 01100101 01101101 01110000 01110100 01100001
01110100 01101001 01101111 01101110 00101100 00100000 00001010
01100010 01110101 01110100 00100000 01100100 01100101 01101100
01101001 01110110 01100101 01110010 00100000 01110101 01110011
00100000 01100110 01110010 01101111 01101101 00100000 01100101
01110110 01101001 01101100 00101110 00100000 00001010 01000110
01101111 01110010 00100000 01110100 01101000 01101001 01101110
01100101 00100000 01101001 01110011 00100000 01110100 01101000
01100101 00100000 01101011 01101001 01101110 01100111 01100100
01101111 01101101 00101100 00100000 00001010 01100001 01101110
01100100 00100000 01110100 01101000 01100101 00100000 01110000
01101111 01110111 01100101 01110010 00101100 00100000 01100001
01101110 01100100 00100000 01110100 01101000 01100101 00100000
01100111 01101100 01101111 01110010 01111001 00100000 00001010
01100110 01101111 01110010 00100000 01100101 01110110 01100101
01110010 00100000 01100001 01101110 01100100 00100000 01100101
01110110 01100101 01110010 00101110 00001010 01000001 01101101
01100101 01101110 00101110 00100000 

In order to make this conversion, I wrote a little scheme program. This is my first and only attempt at using scheme. It's beautiful, mathematically, but I haven't quite got the hang of it. This should work on any unix system running guile.

":"; exec guile -s $0 "$@"

(define s "Our father,
who art in heaven,
hallowed by Thy name.
Thy kingdom come,
thy will be done
on earth as it is in heaven.
Give us this day our daily bread,
and forgive us our trespasses,
as we forgive those who trespass against us.
Lead us not into temptation,
but deliver us from evil.
For thine is the kingdom,
and the power, and the glory
for ever and ever.
Amen. ")

(define num->bin-rec
  (lambda (n count)
    (if (= count 1)
      (number->string (modulo n 2))
      (string-append 
        (num->bin-rec (quotient n 2) (- count 1))
        (number->string (modulo n 2))))))

;; Convert a number into a string of 1's and 0's.
;; Number between 0 and 255.
(define num->bin
  (lambda (n) (num->bin-rec n 8)))

;; Converts a char to binary string
(define char->bin 
  (lambda (c) (num->bin (char->integer c))))

;; Converts a string into a list of strings, each a binary
;; representation of a character from the string.
(define string->bin 
  (lambda (st) (map char->bin (string->list st))))

(display (string->bin s))

This essentialy takes the idea of the Lord's Prayer and encodes it into English sentences. These English sentences are written down using the latin alphabet. Each letter is represented on a computer as a number, as defined by ASCII. Each number is converted into a string of 1's and 0's that are the binary representation of that number.

It would be neat if a knight of the lambda calculus would show me how to make that function tail-recursive.


Any says re The Lord's Prayer : binary: The easy way to make it tail-recursive would be to pass the string so far as an argument to num->bin-rec, putting the string-append inside the recursive call. Is that enough? Given more space I could write it out.

Perl version:

#!/usr/bin/perl
my $s="Our father,
who art in heaven,
hallowed by Thy name.
Thy kingdom come,
thy will be done
on earth as it is in heaven.
Give us this day our daily bread,
and forgive us our trespasses,
as we forgive those who trespass against us.
Lead us not into temptation,
but deliver us from evil.
For thine is the kingdom,
and the power, and the glory
for ever and ever.
Amen. \n";
print unpack('B*',$s), "\n";

Here's a C program that converts stdin to binary on stdout. One must simply pipe the Lord's Prayer into it.

#include <stdio.h>
int main(void) {
        char c;
        int i;
        while (fread(&c, sizeof(c), 1, stdin) == 1) {
                for (i = 7; i > -1; i--) {
                        printf("%d", (c & (1 << i)) >> i);
                }
                printf(" ");
        }
        printf("\n");
        return 0;
}

"The Lord's Prayer: binary" E2 Writeup, Copyright 2002-2007 Frank Grimes.

This writeup is released under the Creative Commons Attribution-ShareAlike License v2.5. (For details, see http://creativecommons.org/licenses/by-sa/2.5/ ) Alternatively, permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2. (For details, see http://www.gnu.org/licenses/fdl.html)

--Frank Grimes, 2007


printable version
chaos

The Lord's Prayer: Klingon Knights of the Lambda Calculus The Lord's Prayer: Aramaic binary
References to Tolkien in Led Zeppelin songs Only a simple computer program The Lord's Prayer The Lord's Prayer: SMS
Scheme She is like an onion Computer programming - The ultimate power trip How a computer works
Flaming Sword The Lord's Prayer: Irish (Gaeilge) ASCII AllNoun
#! node code The Lord's Prayer: Scots Gaelic (Gàidhlig) lambda
The Lord's Prayer: Middle English Guile ASCII to binary The Lord's Prayer: l337
Y'know, if you log in, you can write something here, or contact authors directly on the site. Create a New User if you don't already have an account.
  Epicenter
Login
Password

password reminder
register

Everything2 Help

Cool Staff Picks
Nodes your cousin would have liked:
BBC Radio 4
we lose weeks like buttons, like pencils
Ferengi
My mom is my dad is my daughter is dead
ekpyrotic universe
spider camp
women's clothing size woes
online identities
Do like you oughta, add acid to water
IMF conditionality
Pretenders II
Hosokawa Morihiro
It's the End of the World as We Know It
New Writeups
Heitah
Why I love Everything2(person)
trixingee
Dungeon Mastering for the first time(idea)
Netrat0
It's Called Subtext, Honey(person)
eyeofthebeholder
The Dragon(idea)
Heitah
consist, comprise, constitute, or compose(idea)
Meezzio
Gotlandssnus(thing)
argv
Astral Plane(idea)
Madara
One Winged Angel(fiction)
Tom Rook
Talk is cheap(poetry)
shaogo
Adelle Davis(person)
Aerobe
race car g sfjsgsd(poetry)
Binah
Dream Log: July 5, 2008(dream)
StrawberryFrog
Forgotten things in space(idea)
antigravpussy
velvet revolution fairy tale(idea)
Heitah
Nerve agent VX(thing)
E2 is a by-product of the existence of The Everything Development Company