Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,22 @@
:- use_module(library(ctypes)).
runtime_entry(start) :-
prompt(_, ''),
rot13.
rot13 :-
get0(Ch),
( is_endfile(Ch) ->
true
; rot13_char(Ch, Rot),
put(Rot),
rot13
).
rot13_char(Ch, Rot) :-
( is_alpha(Ch) ->
to_upper(Ch, Up),
Letter is Up - 0'A,
Rot is Ch + ((Letter + 13) mod 26) - Letter
; Rot = Ch
).

View file

@ -0,0 +1,7 @@
rot13(Str, SR) :-
maplist(rot, Str, Str1),
string_to_list(SR, Str1).
rot(C, C1) :-
( member(C, "abcdefghijklmABCDEFGHIJKLM") -> C1 is C+13;
( member(C, "nopqrstuvwxyzNOPQRSTUVWXYZ") -> C1 is C-13; C1 = C)).

View file

@ -0,0 +1,2 @@
?- rot13("The Quick Brown Fox Jumped Over The Lazy Dog!", SR).
SR = "Gur Dhvpx Oebja Sbk Whzcrq Bire Gur Ynml Qbt!".