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
(defparameter *is-logged-in* nil) | |
(defparameter *users* '((golo secret) | |
(jones anothersecret))) | |
(defun user-by-login (login) | |
(assoc login *users*)) | |
(defun password-of (user) | |
(cadr user)) |
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
(defun lottery () | |
(flet ((shuffle (list) | |
(let ((len (length list))) | |
(loop repeat len | |
do | |
(rotatef | |
(nth (random len) list) | |
(nth (random len) list)) | |
finally | |
(return 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
'use strict'; | |
var net = require('net'); | |
net.createServer(function (socket) { | |
socket.resume(); | |
socket.once('end', function () { | |
socket.removeAllListeners(); | |
}); | |
}).listen(3000); |
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
package main | |
import ( | |
"net" | |
"os" | |
"time" | |
) | |
func main() { | |
host := os.Args[1] + ":" + os.Args[2] |
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
npm info it worked if it ends with ok | |
npm verb cli [ 'node', | |
npm verb cli '/Users/golo/.nvm/versions/node/v0.12.0/bin/npm', | |
npm verb cli 'install', | |
npm verb cli 'myorg/myrepo', | |
npm verb cli '--loglevel=silly' ] | |
npm info using npm@2.5.1 | |
npm info using node@v0.12.0 | |
npm sill cache add args [ 'myorg/myrepo', null ] | |
npm verb cache add spec myorg/myrepo |
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
(defun play (a b) | |
(cond ((equal a b) 'tie) | |
((or (and (equal a 'rock) (equal b 'scissors)) | |
(and (equal a 'scissors) (equal b 'paper)) | |
(and (equal a 'paper) (equal b 'rock))) '(first wins)) | |
(t '(second wins)))) |
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
(defun rank (card) | |
(car card)) | |
(defun suit (card) | |
(cadr card)) | |
(setf my-hand '((3 hearts) | |
(5 clubs) | |
(2 diamonds) | |
(4 diamonds) |
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
(defun anyoddp (l) | |
(cond ((null l) nil) | |
((oddp (car l)) t) | |
(t (anyoddp (cdr l))))) | |
(defun fact (n) | |
(cond ((zerop n) 1) | |
(t (* n (fact (1- n)))))) | |
(defun laugh (n) |
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
(defun cookie-monster () | |
(format t "~&Give me cookie!!!") | |
(format t "~&Cookie? ") | |
(let ((x (read))) | |
(cond ((eq x 'cookie) | |
(format t "~&Thank you!...Munch munch munch...BURP")) | |
(t | |
(format t "~&No want ~S..." x) | |
(cookie-monster))))) |
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
(defun launch (n) | |
(do ((cnt n (- cnt 1))) | |
((zerop cnt) (format t "Blast off!")) | |
(format t "~S..." cnt))) |
OlderNewer