Jump to content

Featured Replies

Posted
;;little function to make a transition by FIBONACCI-seq
;;i have seen this idea in "slippery chicken" (by michael edwards),
;;so here is a - "not so smart" but working - basic-function.

(defun transition-with-fibonacci (number-of-values value-a value-b) 
  (let ((fib-length) (fib-seq) (all-seq))
    (setq fib-length (loop
                       for cnt = 1 then (incf cnt)
                       collect (sum (fibonacci 2 cnt)) into bag
                       when (> (car (last bag)) number-of-values)
                       do (return (1- (length bag)))) 
          fib-seq (fibonacci 2 fib-length)
          all-seq (append (reverse fib-seq) (loop repeat (- number-of-values (sum fib-seq))
                                              collect 1)))
    (loop for i in all-seq 
      append (loop repeat i
               for cnt = 0 then (incf cnt)
               when (= cnt 0)
               collect value-b else collect value-a))))



;;example-1 => only the process
(transition-with-fibonacci 70 1 2)

;;example-2 => with context = sequence with 1 or 2 (before/after transition)
(list-plot
 (append  (gen-repeat 10 1) 
          (transition-with-fibonacci 32 1 2)
          (gen-repeat 10 2))
 :zero-based t
 :point-radius 2
 :join-points t)

 

Create an account or sign in to comment


Copyright © 2014-2025 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