Skip to content

Minor redundant code or possible bug in instruction (not (not %))? #267

@erp12

Description

@erp12

I can't be exactly sure what this instruction is meant to do based on its name alone, but something seems off. Seems wrong to have (not (not ...)) anywhere.

(define-registered 
  code_null
  ^{:stack-types [:code :boolean]}
  (fn [state]
    (if (not (empty? (:code state)))
      (push-item (let [item (first (:code state))]
                   (not (not (and (seq? item) (empty? item))))) ;; <-- Seems redundant.
                 :boolean
                 (pop-item :code state))
      state)))

Link to full code:
https://github.com/lspector/Clojush/blob/master/src/clojush/instructions/code.clj#L386

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions