Jump to content

UNFOLD strategie example


Recommended Posts

This short example demonstrates how powerful and flexible the UNFOLD function is, especially when working with short patterns.

The entire process is very compact and requires only a few lines of code.
 

Source:

(progn
  (setf
   mat1 '((h. eb4 pp q g3 -e q gs4 mf -s a5 p tie)
          (e. a5 -e q bb4 mf -s q cs5 p -s q. e5 mf -e.)
          (q cs5 p h. d5 mf -q c5 pp tie)
          (h c5 pp h. gs3 -e a4 p<)
          (h. fs5 mp q bb3 c5 p e4 mf tie)
          (h e4 -e q cs4 mp h d5 p e f4))
   
   mat2 '((q d4 pp s eb4 < leg g4 < leg bb4 < leg a4 q. cs5 mf -e  
             3q gs5 > leg fs5 > leg c5 > b4 > leg f4 leg e4)
          (t d4 < leg eb4 < leg g4 < leg bb4 q. a4 marc
             t fs4 mf leg gs4 leg e. c5 e b4 t f5 leg e5 leg d5 leg eb5
             3q bb5 > a4 > bb5 > e a4 pp stacc -e))
   
   p01 (unfold 'eg '(t7 dyn) mat1)
   p02 (unfold 'eg '(t7 v? dyn ob) mat1)
   p03 (unfold 'eg '(v? ra dyn) mat1)
   p04 (unfold 'eg '(t-12 t-5 dyn v? raf hn) p03)
   p05 (unfold 'eg '(t-12 t-5 ld ra dyn bn) p02)
   
   p11 (assemble-seq (unfold 'eg '(t7 dyn) mat1) (unfold 'eg '(t7 dyn) mat2))
   p12 (assemble-seq (unfold 'eg '(t-12 v? dyn ob) mat1)
                     (unfold 'eg '(t-12 v? dyn ob) mat2))
   p13 (assemble-seq (unfold 'eg '(v? raf dyn) mat1) (unfold 'eg '(v? dyn)  mat2))
   p14 (unfold 'eg '(t-12 t-5 dyn v? raf dyn hn) p13)
   p15 (unfold 'eg '(t-12 t-5 ld ra dyn bn) p12))
  
  (ps 'gm :w5 (list
               (assemble-seq p01 p11)
               (assemble-seq p02 p12)
               (assemble-seq p03 p13)
               (assemble-seq p04 p14)
               (assemble-seq p05 p15))))

 

Output:

image.png

 

Best, JP

Link to post
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