[CM] patch to markov-analyze in snd/CM_patterns.scm

anders.vinjar at bek.no anders.vinjar at bek.no
Mon Jun 22 01:59:05 PDT 2015


markov-analyze inside snd/CM_patterns.scm includes a bug, or more
precisely the version of 'last i used (from snd/stuff.scm?) doesn't
alter its pair when passed to set-cdr!:

   => (define n '(1 2 3 4))
   (1 2 3 4)
   => (set-cdr! (last n) '(5))
   (5)
   => n
   (1 2 3 4)

   => (define n '(1 2 3 4))
   (1 2 3 4)
   => (set-cdr! (last-pair n) '(5))
   (5)
   => n
   (1 2 3 4 5)

Heres a patch:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: CM_patterns.patch
Type: text/x-patch
Size: 997 bytes
Desc: not available
URL: <https://cm-mail.stanford.edu/mailman/private/cmdist/attachments/20150622/9595182b/attachment.bin>
-------------- next part --------------

Not sure naming this 'last, 'tail or a 'last-pair is right here.
snd/stuff.scm has a 'last (mimicking CL's last, but not allowing
destructive operations on pairs?), CMs .scm uses 'tail, s7 seems to want
to stay close to guile (?), which uses 'last-pair.


More information about the Cmdist mailing list