Jump to content

Recommended Posts

Are rewrite-lsystem and its friends based on L-Lisp by Knut Arild Erstad (Erstad, 2002; http://www.ii.uib.no/~knute/lsystems/llisp.html)

If not, they look and work surprisingly similar. For example, I can just use complex examples as the following from Erstad's documentation, and they work in OM.

 

;; Mycelis muralis (from ABoP, p. 87--90)
(defclass mycelis (l-system)
  ((axiom :initform '((I 20) Fa (A 0)))
   (ignore-list :initform '(+ /))
   (homomorphism-depth :initform 10)
   (frame-delay :initform 0.5)
   (frame-list :initform '((0 100)))
   (limits :initform '((-2 -1 -1) (2 14 1)))))

(defmethod l-productions ((ls mycelis))
  (choose-production ls
    ;; Growing apex
    ((A x)
     (with-lc (S) (--> (T 0)))
     (if (> x 0)
	 (--> (A (1- x)))
	 (--> [ (+ 30) Fb ] Fa (/ 180) (A 2))))
    ;; Stem segment: propagates signals
    (Fa
     (with-lc (S) (--> Fa S))
     (with-rc ((T c)) (--> (T (1+ c)) Fa)))
    ;; Undeveloped branch segment
    (Fb
     (with-lc ((T c) Fa) (--> (I (1- c)) Fa (A 3))))
    ;; Delayed signal
    ((I c)
     (if (zerop c)
	 (--> S)
	 (--> (I (1- c)))))
    ;; Signals disappers
    (S (--> nil))
    ((T c) (--> nil))
    ))


(rewrite-lsystem 'mycelis :depth 7)

 

If this is Erstad's code, then it would be appropriate to acknowledge this in the documentation etc., and helpful for users to point at the much more extensive documentation of the original software. There are very many more features of this generator that users cannot guess from the existing documentation.

 

Thanks!

 

Torsten

 

Erstad, K. A. (2002) L-systems, twining plants, Lisp. Master’s thesis thesis. University of Bergen. [online]. Available from: http://www.vcn.bc.ca/~griffink/lisp_lsystems.pdf (Accessed 21 December 2016).
Link to comment
Share on other sites

  • 11 months later...

Dear Janusz,

 

I presume that under each function there is a code that is hidden for the sake of elegance and for practical reasons.

Actually, when using Opusmodus built-in functions we are working in a "pseudo-code".

For example, last week André Meier wrote the code below, for tweaking lenghts. This could be transformed

 in a OM built-inl function, in a way that we could not see the entire code, only the call of the function.

I'm asking where can I see the entire lisp code of the built in functions in order to learn to code my own

 functions, like André and Torsten.

Best,

Julio

 

 

André Meier Function "lenght-staccato"

 

(defun length-staccato (n alist)
  (let ((newlengths)
        (new-omn (omn-merge-ties (flatten  alist)))
        (time-sign (get-time-signature alist)))
    (progn 
      (setf newlengths (loop for i in (omn :length new-omn)
                         when (> i 0)
                         append (if (= n i)
                                  (list i)
                                  (list n (* -1 (abs (- i n)))))
                         
                         else collect i))
      (if (omn-formp alist)
        (omn-to-time-signature (make-omn :length newlengths
                                         :pitch (omn :pitch new-omn)
                                         :velocity (omn :velocity new-omn)
                                         :articulation (omn :articulation new-omn))
                               time-sign)
        newlengths))))


(length-staccato 1/16 '(q -q q q))
(length-staccato 1/16 '(q e4 mp q tasto q -q q q))
(length-staccato 1/16 '((e. c4 eb4 fs4 a4 tie) (s a4 e. cs4 e4 g4 e bb4 tie) (e bb4 e. d4 f4 gs4 s b4)))
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

Terms of Use Privacy Policy