Pangram checker: Difference between revisions
Content added Content deleted
Line 1,490: | Line 1,490: | ||
=={{header|NewLISP}}== |
=={{header|NewLISP}}== |
||
<lang newlisp> |
<lang newlisp> |
||
(context 'PGR) |
(context 'PGR) ;; Switch to context (namespace) PGR |
||
(define (is-pangram? str) |
(define (is-pangram? str) |
||
(setf chars (explode (upper-case str))) |
(setf chars (explode (upper-case str))) ;; Uppercase + convert string into a list of chars |
||
(setf is-pangram-status true) |
(setf is-pangram-status true) ;; Default value |
||
(for (c (char "A") (char "Z") 1 (nil? is-pangram-status)) ;; For loop with break condition |
(for (c (char "A") (char "Z") 1 (nil? is-pangram-status)) ;; For loop with break condition |
||
(if (not (find (char c) chars)) |
(if (not (find (char c) chars)) ;; If char not found in list, "is-pangram-status" become "nil" |
||
(setf is-pangram-status nil) |
(setf is-pangram-status nil) |
||
) |
) |
||
) |
) |
||
is-pangram-status |
is-pangram-status ;; Return current value if symbol "is-pangram-status" |
||
) |
) |
||
(context 'MAIN) |
(context 'MAIN) |
||
Line 1,505: | Line 1,505: | ||
;; - - - - - - - - - - |
;; - - - - - - - - - - |
||
(println (PGR:is-pangram? "abcdefghijklmnopqrstuvwxyz")) ;; |
(println (PGR:is-pangram? "abcdefghijklmnopqrstuvwxyz")) ;; Print true |
||
(println (PGR:is-pangram? "abcdef")) ;; |
(println (PGR:is-pangram? "abcdef")) ;; Print nil |
||
(exit) |
(exit) |
||
</lang> |
</lang> |