Prolog Poetry

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

...

Who

...

says

...

computer

...

science

...

is

...

completely

...

left-brained?

...



A compilable haiku about eternity, which will take that long if you query ?-time(willEnd)

...

.

...

Read

...

the

...

:=

...

as

...

"when"

...

or

...

"if."

...

}
Code Block
time(is_eternal).
time(GoesOn) := time(GoesOn).
neverending(code).
{code}
\

--Mary

...



Another compilable haiku.

...

Again,

...

read

...

the

...

:=

...

as

...

"if."

...

Code Block
thought(nonexistent).
inPeace(Mind):-thought(Mind).
thought('only clear').
{code}
\

--Elena

...



A program which may be read artistically as a limerick. The program defines the natural numbers.

Wiki Markup
{div:class=prolog|style=font-family:Courier New;}

{code}
nat(X) :=
s(N, X), nat(N).
nat([]).
s(N, [Begin|Chase]) :=
N = Chase, N = Begin.
{code}
{div}

X

...

is

...

nat

...

if

...

there

...

is

...

some

...

N

...


such

...

that

...

s

...

N

...

X

...

and

...

nat

...

N

...

when

...


nill

...

is

...

nat

...

is

...

the

...

base

...


S

...

N

...

Be

...

gin

...

follow

...

Chase

...


N

...

is

...

Chase

...

and

...

N

...

is

...

Be

...

gin

...


--Mary

...



A compilable and runnable haiku that demonstrates the use of read()

...

and

...

write()

...

predicates.

...

}
Code Block
toSeeNumPrinted:-
                 read(Num), number(Num),
                 write('Ur num: '), write(Num).
{code}
\

--Elena

...

A

...

haiku

...

to

...

demonstrate

...

file

...

reading.

...

}
Code Block
read_from(TheBible):-
     see(TheBible), read(GodsWord),
     get(Glimpses_un), seen.
{code}
\

--Mary

...

The

...

following

...

haiku

...

pair

...

demonstrates

...

both

...

reading

...

and

...

writing

...

to

...

a

...

file.

...

}
Code Block
how_to_read(APlay):-
     see(APlay), skip(t), he(prologue),
     get(To_the_next), seen.
call_to(Rapunzel):-
     tell(Rapunzel), put(d), own(hair),
     she(ll_do_as_shes), told.

%extra facts to enable it to run
he(prologue).
own(hair).
she(ll_do_as_shes).
{code}
\

--Mary