Question: I've been programming C++ for about 5 years now, and I now realize the value of knowing how to think "differently."

This question is for C++ programmers who tried out other programming languages and came across moments like:

* "Whaoo..this is sooo cool! I didnt know I can program like that."
* "Wow, I never thought a design problem could be solved that way!"

So, which language did that to you? I'm looking for maximum effect, so I dont think Java would fit the bill. =p I'm open to any suggestions, though!

Disclaimer: I ask this question primarily because I want to expand my mind. There is no intention to start **any** programming language war here!

Answer: 
I'll second Lisp/Scheme, and also suggest [Haskell](http://www.haskell.org/haskellwiki/Introduction) as a language that will challenge the way you think about programming. The O'Reilly book "Real World Haskell" is a pragmatic introduction, well illustrated with concrete use cases.
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)) 
                    )
        )
   )
)

```