Prolog is a must. Any other language of a different paradigm would be a good start. Prolog is of a logical paradigm. Another great yet very different language is Scheme. It is of the functional language family.
Here a few sample of a Palindrome validator.
EDIT: Someone mentionned that the code I wrote is unimpressive and discouraging. Here's a few simplified examples:
Scheme factorial
(define (fact n)
(if (= n 0)
1
(* n (fact (- n 1)))))
Prolog factorial
factorial(0,1).
factorial(N,F) :-
N>0,
N1 is N-1,
factorial(N1,F1),
F is N * F1.
And my original examples:
Prolog sample:
:- set_prolog_flag(toplevel_print_options, [quoted(true), portray(true), max_depth(0), attributes(portray)]).
readline(Line) :-
get0(Ch),
readline(Ch, Line),
!.
readline(10, []).
readline(Ch, [LowerCasedCh | RestOfLine]) :-
is_alpha(Ch),
name(N, [Ch]),
downcase_atom(N, LowerCasedN),
%Drops element down to lowercase
name( LowerCasedN, [LowerCasedCh]),
get0(NextCh ),
readline(NextCh, RestOfLine).
%Character Trimming
readline(Ch, RestOfLine) :-
\+is_alpha(Ch),
get0(NextCh ),
readline(NextCh, RestOfLine).
palindrome:-
readline(List),
sarahPalindrome(List).
sarahPalindrome(List):-
reverse( List, ReversedList),
List = ReversedList.
Here's a solution in scheme for the same problem!
(define palindrome
(lambda (x)
(equal? (filter-non-char-alpha (reverse (string->list x))) (filter-non-char-alpha (string->list x))
)
)
)
(define filter-non-char-alpha
(lambda (x)
(if (equal? x '()) #t
(if (char-alphabetic? (car x))
(cons (char-downcase (car x)) (filter-non-char-alpha (cdr x)))
(filter-non-char-alpha (cdr x))
)
)
)
)