This file contains 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
;; See https://www.reddit.com/r/dailyprogrammer/comments/3d4fwj/20150713_challenge_223_easy_garland_words/ | |
;; | |
;; A Garland word is one that starts and ends with the same N letters in the same order, | |
;; for some N greater than 0, but less than the length of the word. | |
;; Eg. onion -> 2 | |
;; ceramic -> 1 | |
;; programmer -> 0 | |
;; alfalfa -> 4 | |
This file contains 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
;; Solution for Reddit Daily Programmer problem - | |
;; https://www.reddit.com/r/dailyprogrammer/comments/3ddpms/20150715_challenge_223_intermediate_eel_of_fortune/ | |
;; Elegant but incorrent solution - | |
;; | |
;; This is almost right except for the case when | |
;; checking for snond as a subword of mispronounced. | |
;; The naive understanding is that it should return t. However, | |
;; when looking at the sequence at which letters are called out | |
;; in EEL of Fortune, one never sees snond. Instead we see |
This file contains 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
;;; Magic Squares - https://www.reddit.com/r/dailyprogrammer/comments/4dccix/20160404_challenge_261_easy_verifying_3x3_magic/ | |
(defun magic-square? (square) | |
(let* ((dims (array-dimensions square)) | |
(size (car dims))) | |
(if (and (typep square 'simple-array) | |
(eq 2 (array-rank square)) | |
(eq size (cadr dims))) | |
(loop for i from 0 below size | |
for j from 0 below size |
This file contains 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
;; CL-PDF Hello World | |
;; | |
;; Use ASDF to load the CL-PDF library | |
;; | |
(asdf:operate 'asdf:load-op 'cl-pdf) | |
;; | |
;; Function to generate a Hello World pdf file. | |
;; On calling this function, you should see a pdf file |
This file contains 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
;; Print Multiplication Tables | |
;; | |
;; This demonstrates CL's format function and it's ability | |
;; to print out Roman Numerals, Numbers in Words etc.. | |
;; | |
;; Unlikely to be ever used! | |
(defun multiplication-table (number) | |
(loop for i from 1 below 12 | |
do (format t "~10<~@r~;times~> ~:d = ~r~%" i number (* i number)) |
This file contains 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
;; Easy Daily Programmer https://www.reddit.com/r/dailyprogrammer/comments/3e0hmh/20150720_challenge_224_easy_shuffling_a_list/ | |
(defun list-shuffler-recursive (input-list &optional accumulator) | |
"Shuffle a list using tail call recursion." | |
(if (eq input-list nil) | |
accumulator | |
(progn | |
(rotatef (car input-list) | |
(nth (random (length input-list)) input-list)) | |
(list-shuffler-recursive (cdr input-list) |
This file contains 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
; Short guide to UDP/IP Client/Server programming in Common Lisp using usockets | |
; | |
; The main reason for this guide is because there are very few examples that | |
; explain how to get started with socket programming with Common Lisp that I | |
; could understand. | |
; After working on a short example on TCP, I found the | |
; need for a UDP tutorial. So, here goes. | |
; As usual, we will use quicklisp to load usocket. |
This file contains 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
; Short guide to TCP/IP Client/Server programming in Common Lisp using usockets | |
; | |
; The main reason for this guide is because there are very few examples that | |
; explain how to get started with socket programming with Common Lisp that I | |
; could understand. After spending a day trying, I finally came up with a small | |
; bit of code that makes it easy to understand the basics. I've written this | |
; primarily for myself, but should help others get started as well. | |
; As usual, we will use quicklisp to load usocket. |