Overview Clamps Packages CM Dictionary Clamps Dictionary Fomus
Next: ensure-sfz-preset , Previous: E , Up: E , Home: Overview

Clamps Dictionary

ensure-prop

Macro

(ensure-prop proplist prop default)

Ensure that the property prop exists in proplist, otherwise set it to default. Return the value of prop.

Arguments

proplist Property list.
prop Keyword or Symbol denoting the property key to ensure.
default The value the property should get assigned to if not set.

Examples

(defvar *proplist* '(:a 10 :b hello :c "world"))

(ensure-prop *proplist* :d 5)
;; => 5

*proplist* ; => (:d 5 :a 10 :b hello :c "world")

;; As property :a already exists, don't change it and return its
;; current value:

(ensure-prop *proplist* :a 3)
;; => 10

*proplist* ; => (:d 5 :a 10 :b hello :c "world")

Author: Orm Finnendahl

Created: 2025-02-18 Di 12:58

Validate