Skip to content

Issues with condp #1137

Closed
Closed
@chrisrink10

Description

There are a few different issues with Basilisp's implementation of condp:

  • It does not throw any exception if there is no default clause, as it does in Clojure:
(condp = :a :b true :c true)  ;;=> nil
  • If a result expression is nil, it throws an exception during macroexpansion:
basilisp.user=> (condp = "a"
                                "b" :b
                                "a" nil
                                "c" :c
                                :a)

  exception: <class 'basilisp.lang.exception.ExceptionInfo'> from <class 'basilisp.lang.compiler.exception.CompilerException'>
      phase: :macroexpansion
    message: error occurred during macroexpansion: expected result expression {:test "a"}
       form: (basilisp.core/condp = "a" "a" nil "c" :c :a)
   location: <REPL Input>:NO_SOURCE_LINE

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions