-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Joe Williamson
committed
Mar 18, 2019
1 parent
58ccb54
commit 86e8398
Showing
5 changed files
with
54 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#lang racket | ||
(define A | ||
(lambda ( n m) | ||
(cond | ||
((zero? n) ( add1 m)) | ||
((zero? m) (A (sub1 n) 1)) | ||
(else (A (sub1 n) | ||
(A n (sub1 m))))))) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#lang racket | ||
(define A | ||
(lambda (n m) | ||
(cond | ||
((zero? n) (add1 m)) | ||
((zero? m) (A (sub1 n) 1)) | ||
(else (A (sub1 n) | ||
(A n (sub1 m))))))) | ||
|
||
(A 2 1) ;5 | ||
(A 3 2) ;29 | ||
|
||
;(A 4 3) ;Keeps going; presumabley stops |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#lang racket | ||
(define exact-filters '(('type1 (cons '1 '2)) | ||
('type2 (cons '100 111) | ||
('type1 (cons '3 '4)) | ||
))) | ||
|
||
(define result (car (group-by (λ (type) (eq? type type)) exact-filters))) | ||
|
||
result |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#lang racket | ||
|
||
(define pick | ||
(lambda (pos lat) | ||
(cond | ||
((eq? pos 1)(car lat)) | ||
(else (pick (sub1 pos)(cdr lat)))))) | ||
|
||
(pick 1 '(a b c)) | ||
(pick 2 '(a b c)) | ||
|
||
(define looking | ||
(lambda (a choice lat) | ||
(keep-looking a (pick choice lat) lat))) | ||
|
||
(define keep-looking | ||
(lambda (a pos lat) | ||
(cond | ||
((eq? (pick pos lat) a) #t) | ||
(else (looking a pos lat))))) | ||
|
||
(looking 'caviar 1 '(6 2 3 caviar 5 7 3)) |
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