Scheme error “except: misuse of unit import keyword”

拜拜、爱过 提交于 2019-12-25 06:51:09

问题


I'm writing a function that returns elements which appear in one list and not in another. For example,

(except '(a b c) '(a d b e f))

will return '(c). The first argument can be an atom, and both are assumed to be flat. Here's my code:

(define (except lm ln)
  (cond ((null? ln) lm)
        ((not (list? lm))
         (cond ((in? lm ln) '())
               (#t lm)))
        ((null? lm) '())
        ((in? (car lm) ln) (except (cdr lm) ln))
        (#t (cons (car lm) (except (cdr lm) ln)))))

Then an error returns saying "except: misuse of unit import keyword in: (except (cdr lm) ln)".

Why this is happening?


回答1:


Looks like you're running into some problem with the unit library which has an except keyword defined. But it should still be possible to use it as a name for your function, so I'm guessing that something else is wrong. It'll be possible to say more if you provide the complete code that you're trying to run.



来源:https://stackoverflow.com/questions/9338460/scheme-error-except-misuse-of-unit-import-keyword

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!