Last active
December 15, 2015 23:19
-
-
Save Denommus/5339087 to your computer and use it in GitHub Desktop.
Solution for the Code Jam's problem of Alien Language ( https://code.google.com/codejam/contest/90101/dashboard#s=p0 ), in Common Lisp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/sbcl --script | |
| (load (merge-pathnames "quicklisp/setup.lisp" (user-homedir-pathname))) | |
| (require 'cl-ppcre) | |
| (with-open-file (in (car (last *posix-argv*))) | |
| (let* ((l (read in)) | |
| (d (read in)) | |
| (n (read in)) | |
| (words (loop repeat d | |
| collect (read-line in)))) | |
| (with-open-file (out "A.out" :direction :output :if-exists :supersede) | |
| (loop for i from 1 to n | |
| for test = (substitute #\] #\) (substitute #\[ #\( (read-line in))) do | |
| (format out "Case #~D: ~D~%" i | |
| (count test words :test #'ppcre:scan)))))) |
stassats
commented
Apr 8, 2013
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment