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
(define (remove-factor x y) | |
(if (= 0 (modulo x y)) (remove-factor (/ x y) y) x)) | |
(define (loga x y) (/ (log x) (log y))) | |
(define (consa a b) (* (expt 2 a) (expt 3 b))) | |
(define (cara p) (inexact->exact (loga (remove-factor p 3) 2))) | |
(define (cdra p) (inexact->exact (loga (remove-factor p 2) 3))) |
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
<!-- | |
need to change code of lamer news so it accepts get data and fills the form with it | |
--> | |
<html> | |
<head><title>Lamer News Bookmarklet</title></head> | |
<body> | |
<h3>Drag link to bookmarks</h3> | |
<h2><a href="javascript:window.location='http://lamernews.com/submit?url='+encodeURIComponent(document.location)+'&title='+encodeURIComponent(document.title)">post to Lamer News</a></h2> | |
</body> | |
</html> |
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
(defun freach (fn x) | |
(cond ((null x) t) | |
(t (funcall fn (car x)) (freach fn (cdr x))))) |
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
(define (freach fn lst) | |
(cond ((null? lst) #t) | |
(else (fn (car lst)) (freach fn (cdr lst))))) |
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
(defun find-all (item sequence &rest keyword-args | |
&key (test #'eql) test-not &allow-other-keys) | |
"Find all thos elements of sequence that match item, | |
according to keywords. Doesn't alter sequence." | |
(if test-not | |
(apply #'remove item sequence | |
:test-not (complement test-not) keyword-args) | |
(apply #'remove item sequence | |
:test (complement test) keyword-args))) |
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
(define (same-parity x . w) | |
(define (inner-parity a b) | |
(cond | |
((null? b) b) | |
((or (and (even? a) (even? (car b))) | |
(and (odd? a) (odd? (car b)))) | |
(cons (car b) (inner-parity a (cdr b)))) | |
(else (inner-parity a (cdr b))))) | |
(inner-parity x w)) |
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
(defun pp (sentence) | |
(let ((cstring (format nil "~{ ~s~}." sentence))) | |
(format nil | |
(concatenate 'string "~@(" cstring "~)")))) |
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
(defun len-reduce (x) | |
(let ((len 0)) | |
(reduce (lambda (z w) (setf len (1+ len))) | |
(append x '(0))))) |
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
((lambda (x) | |
((lambda (y) | |
(+ x y)) | |
(* x x))) | |
6) |
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
(define (new-reverse ls1) | |
(define (rev-acc ls2 acc) | |
(if (null? ls2) | |
acc | |
(rev-acc (cdr ls2) (cons (car ls2) acc)))) | |
(rev-acc ls1 '())) |