write-ups-challenges-2021-2022/restrictive-racket/SOLUTION.md

68 lines
964 B
Markdown
Raw Permalink Normal View History

2021-12-02 23:33:26 +00:00
## Difficulty
- Free (5 punten)
## How To Solve
(lambda (a) (+ a 1))
## Flag
IGCTF{CongratulationsYouAreSane!}
-------
## Difficulty
- Easy (15 punten)
## How To Solve
(begin
(define (a b)
(if (= b 0)
#t
(if (= b 1)
#f
(a (- b 2)))))
a)
## Flag
IGCTF{FunThingsAreFun}
-------
## Difficulty
- Somewhat easy (30 punten)
## How To Solve
(begin
(define (a b)
(or (= b 0) (and (not (= b 1)) (a (- b 2)))))
a)
## Flag
IGCTF{ICantThinkOfGoodFlags}
-------
## Difficulty
- Average (50 punten)
## How To Solve
This solution uses a Y combinator, for example this works:
((lambda (e d)
(e d))
(lambda (c)
((lambda (b) (b b))
(lambda (b) (c (lambda (a) ((b b) a))))))
(lambda (c)
(lambda (b)
(if (= b 0)
#t
(if (= b 1)
#f
(c (- b 2)))))))
## Flag
IGCTF{LambdasArePrettyAwesome}
---------
## Difficulty
TODO
## How To Solve
## Flag