Coverage report: /home/runner/work/geb/geb/src/lambda/experimental/lambda.lisp
Kind | Covered | All | % |
expression | 69 | 86 | 80.2 |
branch | 2 | 4 | 50.0 |
Key
Not instrumented
Conditionalized out
Executed
Not executed
Both branches taken
One branch taken
Neither branch taken
1
(in-package #:geb.lambda.experimental)
3
;; Don't even bother to make data structures, just quote our forms
5
(named-readtables:in-readtable :fare-quasiquote)
7
(setf trivia:*arity-check-by-test-call* nil)
9
;; we are being lazy no need for defclass for something so short lived
11
(eval-when (:compile-toplevel :load-toplevel :execute)
13
(depth 0 :type fixnum)
14
(mapping (fset:map) :type fset:map))
17
(depth 0 :type fixnum)))
26
(-> curry-lambda (t) t)
27
(defun curry-lambda (term)
28
"Takes a lambda term and expands all the arguments"
30
(`(lambda ,param ,body)
31
(let ((body (curry-lambda body)))
32
(mvfoldr (lambda (param body)
33
(list 'lambda param body))
35
(list 'lambda (car (last param)) body))))
37
(cons (curry-lambda x)
41
(-> nameless (t &optional context) t)
42
(defun nameless (term &optional (context (make-context)))
44
(`(lambda ,param ,body)
45
(let* ((param-ty (when (consp param) (cadr param)))
46
(param (if (consp param)
49
(new-depth (1+ (context-depth context))))
55
:mapping (fset:with (context-mapping context)
59
(cons (nameless f context) (nameless xs context)))
60
;; we only care if it's in the map, if it isn't ignore it!
62
(let ((depth (fset:@ (context-mapping context) term)))
64
(make-index :depth (+ (context-depth context) depth))