Jump to content
View in the app

A better way to browse. Learn more.

Opusmodus

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

hi all

 

i would like to code a NAND gate with more then two input-items (as extension to AND etc...). here is a simple version of the NAND function with two inputs, but i don't know how to exapnd it to n-inputs without putting the the inputs to in a list (like lisp-internal AND / OR)...

 

https://en.wikipedia.org/wiki/NAND_gate

 

i dont't want it:

(nand '(t t t nil))

 but like to have

(nand t nil nil t t t)

 

when i get a solution for that i will code an XOR, NOR etc....

 

 

 

so the "problem" is: how to manage in DEFUN more then two inputs (don't work with &optional, i think) i tried it and failed)...

any ideas, lisp-nerds? 🙂 thanx! andré

 

;;; easy with a specific number of input-items - that works! 

(defun nand (a b)
  (not (and a b)))

(nand t t)
=> nil
(nand nil nil)
=> t
(nand nil t)
=> t


;;; i like to have an input perhaps like that - with any number of input-items, like lisp's AND / OR

(nand t t t t)
(nand nil t t t nil t t t nil)
...

 

Is this what you are looking for:
 

(defun nand (&rest rest)
  (flet ((every-truep (x)
           (equal x t)))
    (not (every #'every-truep rest))))

(nand t t)
=> nil

(nand t t t t nil t)
=> t

(nand nil t t t nil t)
=> t

 

  • Author

exactly... thanks for the solution! 

i will try to CODE some XOR, NOR.... based on it! i was in trouble with the "input-format" (when it's not a list) 🤔

Few more function which could be useful for you (part of the system):
 

(contain-itemp 'inv '(c 7b9s11 inv 1 chord))
=> t

(contain-itemp '= '(e f d s))
=> nil
(contain-itemsp '(9 8) '(0 1 11 8 10 9))
=> t
(contain-sequencep '(11 8) '(0 1 11 8 10 9))
=> t

JP

  • Author

👍

Create an account or sign in to comment


Copyright © 2014-2026 Opusmodus™ Ltd. All rights reserved.
Product features, specifications, system requirements and availability are subject to change without notice.
Opusmodus, the Opusmodus logo, and other Opusmodus trademarks are either registered trademarks or trademarks of Opusmodus Ltd.
All other trademarks contained herein are the property of their respective owners.

Powered by Invision Community

Important Information

Terms of Use Privacy Policy

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.