exercism / exercism/common-lisp-representer

Symbols in package export are not matched against symbols in defuns

Open
#30 0 comments 0 reactions 0 assignees View on GitHub
x:action/improve x:knowledge/none x:module/representer
Dominant language
Common Lisp
Stars
2
Forks
7
PR merge metrics
No merged PRs in 30d

Description

For example as reported by exercism.lol the submission:

```lisp
(defpackage :socks-and-sexprs
(:use :cl)
(:export :lennys-favorite-food :lennys-secret-keyword
:is-an-atom-p :is-a-cons-p :first-thing :rest-of-it))

(in-package :socks-and-sexprs)

;; Evaluates to some symbol (not a keyword)
(defun lennys-favorite-food () 'wild)

;; Evaluates to some keyword
(defun lennys-secret-keyword () :stuff)

;; Evaluates to T if THING is an atom, NIL otherwise
(defun is-an-atom-p (thing) (atom thing))

;; Evaluates to T if THING is a cons, NIL otherwise
(defun is-a-cons-p (thing) (consp thing))

;; Evaluates to the first part of CONS
(defun first-thing (cons) (car cons))

;; Evaluates to the 'rest' of the CONS
(defun rest-of-it (cons) (cdr cons))
```

Is represented as:

```lisp
((DEFPACKAGE :SOCKS-AND-SEXPRS-0
(:EXPORT :SOCKS-AND-SEXPRS-1
:SOCKS-AND-SEXPRS-2
:SOCKS-AND-SEXPRS-3
:SOCKS-AND-SEXPRS-4
:SOCKS-AND-SEXPRS-5
:SOCKS-AND-SEXPRS-6)
(:USE :SOCKS-AND-SEXPRS-7))
(IN-PACKAGE :SOCKS-AND-SEXPRS-0)
(DEFUN :SOCKS-AND-SEXPRS-8
((:REQUIRED NIL) (:OPTIONAL NIL) (:REST NIL) (:KEYWORD NIL) (:AUX NIL)
(:ALLOW-OTHER-KEYS NIL))
(:DOCSTRING NIL)
(:DECLARE NIL)
('WILD))
(DEFUN :SOCKS-AND-SEXPRS-9
((:REQUIRED NIL) (:OPTIONAL NIL) (:REST NIL) (:KEYWORD NIL) (:AUX NIL)
(:ALLOW-OTHER-KEYS NIL))
(:DOCSTRING NIL)
(:DECLARE NIL)
(:STUFF))
(DEFUN :SOCKS-AND-SEXPRS-10
((:REQUIRED (:SOCKS-AND-SEXPRS-11)) (:OPTIONAL NIL) (:REST NIL)
(:KEYWORD NIL) (:AUX NIL) (:ALLOW-OTHER-KEYS NIL))
(:DOCSTRING NIL)
(:DECLARE NIL)
((ATOM :SOCKS-AND-SEXPRS-11)))
(DEFUN :SOCKS-AND-SEXPRS-12
((:REQUIRED (:SOCKS-AND-SEXPRS-11)) (:OPTIONAL NIL) (:REST NIL)
(:KEYWORD NIL) (:AUX NIL) (:ALLOW-OTHER-KEYS NIL))
(:DOCSTRING NIL)
(:DECLARE NIL)
((CONSP :SOCKS-AND-SEXPRS-11)))
(DEFUN :SOCKS-AND-SEXPRS-13
((:REQUIRED (:SOCKS-AND-SEXPRS-14)) (:OPTIONAL NIL) (:REST NIL)
(:KEYWORD NIL) (:AUX NIL) (:ALLOW-OTHER-KEYS NIL))
(:DOCSTRING NIL)
(:DECLARE NIL)
((CAR :SOCKS-AND-SEXPRS-14)))
(DEFUN :SOCKS-AND-SEXPRS-15
((:REQUIRED (:SOCKS-AND-SEXPRS-14)) (:OPTIONAL NIL) (:REST NIL)
(:KEYWORD NIL) (:AUX NIL) (:ALLOW-OTHER-KEYS NIL))
(:DOCSTRING NIL)
(:DECLARE NIL)
((CDR :SOCKS-AND-SEXPRS-14))))
```

Note the exported symbols in the DEFPACKAGE are not matching those in the DEFUNs below.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.