James Hearon | 12 Jul 21:16 2015
Picon

scheme, snd, cm_patterns.scm

Hi,
Yes.  This is helpful, insightful.  I'm still trying to get used to scheme in snd.
Thanks,
Jim



>
> Message: 1
> Date: Sat, 11 Jul 2015 12:12:00 +0200
> From: anders.vinjar-N4abDuUB7xo@public.gmane.org
> To: cmdist-Q5CBQdYaXkCY9Qp+Rujo2eW1CriLhL8O@public.gmane.org
> Subject: Re: [CM] scheme, snd, cm_patterns.scm
> Message-ID: <87io9rf1fz.fsf-N4abDuUB7xo@public.gmane.org>
> Content-Type: text/plain
>
> Hi James.
>
> The beauty of the pattern-streams is they are 'streams', embodying a
> pattern (eg. a 'heap' in the above example) together with a promise to
> deliver the next item whenever you need it.
>
> Typically you set up a generator and store a pointer to that, just like
> you've done:
>
> (define aaa (make-heap '(160 600.345 1000 400)))
>
> After that,
>
> (next aaa)
>
> will return the next item from aaa anytime you want one.
>
> Using a slightly modified version of your example, you could do
> something like:
>
> (let ((aaa (make-heap '(160 600.345 1000 400)))) ;set up a stream
> (with-sound (:output "MyTest.wav" :srate 48000 :channels 2
> :header-type mus-riff :statistics #t)
> (do ((st 0 (+ st 0.25)))
> ((>= st 2))
> (examp1 st 0.25
> (next aaa) ; next item from aaa
> 0.5 48000))))
>
> You'll find a general doc about Ricks patterns here:
>
> http://commonmusic.sourceforge.net/cm/res/doc/cm.html#patterns
>
> Many files included with CMs docs, esp. "doc/patterns1.scm" and
> "doc/patterns2.scm" - provide examples of setting up patterns and
> using these.
>
> -anders
>
>
>
> ------------------------------
>
> _______________________________________________
> Cmdist mailing list
> Cmdist-l0SEpsmuUtBegcJQxxnBRDe48wsgrGvP@public.gmane.org
> https://cm-mail.stanford.edu/mailman/listinfo/cmdist
>
>
> End of Cmdist Digest, Vol 87, Issue 7
> *************************************
>
_______________________________________________
Cmdist mailing list
Cmdist@...
https://cm-mail.stanford.edu/mailman/listinfo/cmdist
Michael Winkler | 12 Jul 12:08 2015
Picon

how to set the working directory in grace?

Hi List

How can I set my working directory by code?

(set-working-directory! "/users/michael/Desktop") gives me an Error: 
set-working-directory! unbound variable

If I just open grace, there is no working directory by default, so I 
would like to make a load-file with, amongst others, this command.

best,
Michael

OSX 10.10.3, Common Music 3.9.0
James Hearon | 9 Jul 19:31 2015
Picon

scheme, snd, cm_patterns.scm

Hi,
re: finding myself s7 challenged for CM_patterns.scm in Snd without Grace process, sprout etc.

I've kept digging with this and got something working, but it's not very pretty.  It uses 'list-ref'
in with-sound (), but that could be improved, I'm sure.
Regards,
Jim


------------------
(load "snd/CM_patterns.scm")

(definstrument (examp1 start-time duration frequency amplitude sampling-rate)
  (let* ((beg (floor (* start-time sampling-rate)))
     (end (+ beg (floor (* duration sampling-rate))))
     (sine-wave (make-oscil :frequency frequency)))
     (do ((i beg (+ i 1)))
         ((= i end))
     (outa i (* amplitude (oscil sine-wave)))
     (outb i (* amplitude (oscil sine-wave)))
     )))

 (define xxx '(160.0  600.345  1000.0  400))
 (define aaa (make-heap xxx))
 (define bbb (next aaa #t))

(with-sound (:output "MyTest.wav" :srate 48000 :channels 2
             :header-type  mus-riff :statistics #t)
  (do (( i 0.0 (+ i 2.0)))
      ((>= i 2.0))
 (examp1   0        0.25    (list-ref bbb 0)    0.5 48000)
 (examp1   (+ i 1.0)    0.25    (list-ref bbb 2)    0.5 48000)
 (examp1   (+ i 2.0)    0.25    (list-ref bbb 3)    0.5 48000)
 (examp1   (+ i 3.0)    0.25    (list-ref bbb 1)    0.5 48000)
 ))
_______________________________________________
Cmdist mailing list
Cmdist@...
https://cm-mail.stanford.edu/mailman/listinfo/cmdist
James Hearon | 2 Jul 20:09 2015
Picon

s7, cm_patterns

Hi,
I'm finding myself  s7 challenged, trying to do an example using CM_patterns.scm in Snd using the listener. 

Seems that Snd doesn't have process, sprout etc. which Grace allows for working with patterns, so trying to figure out how to set up a control loop in with-sound in Snd using the patterns, but getting a bit confused.

I understand with-sound can use do for a control structure
(with-sound ( )
    (do ((k 0 (+ k 1)))
    ((= k 10))

But I'm confused about getting from the CM_patterns.scm prototype into a with-sound control loop.

 (define xxx '(100.0  22.345  3000.0  400))
 (define aaa (make-heap xxx))
 (next aaa #t)

I tried something like this just to test, but it prints everything, not just the heap pattern values.
(define (do-loop n)
 (do ((i 0 (+ i 1)))
  ((= i n))
 (next aaa #t)
  (display aaa))
(newline))

(for-each
(lambda (n) (do-loop n))
(list 10 20))

I'm wondering if anyone might have a simple working example to share?

Regards,
Jim
_______________________________________________
Cmdist mailing list
Cmdist@...
https://cm-mail.stanford.edu/mailman/listinfo/cmdist
ludger brümmer | 1 Jul 19:06 2015
Picon

snd15.7 on osx10.10

Dear Bill 

Thanks for the advice, fortunately on one machine the compilation went through !
on the other machine with the same OS version 10.10 I got a ld or linker error:
ld: library not found for -lXt
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [snd] Error 1

do you have any idea what I could check here?

all the best 
Ludger




the whole plot

wlan-private-226:snd-15.7 ludi$ ./configure CFLAGS="-I/sw/include -I/opt/X11/include" LDFLAGS="-L/sw/lib -lmx -bind_at_load" --with-motif --with-motif-prefix=/sw
configure: WARNING: unrecognized options: --with-motif-prefix
checking build system type... x86_64-apple-darwin14.3.0
checking host system type... x86_64-apple-darwin14.3.0
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for a BSD-compatible install... /usr/bin/install -c
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking whether byte ordering is bigendian... no
checking size of void *... 8
checking for pkg-config... no
checking for fftw3... checking for gsl... checking for X... no
checking for oggdec... no
checking for oggenc... no
checking for mpg123... no
checking for mpg321... no
checking for speexdec... no
checking for speexenc... no
checking for flac... no
checking for timidity... no
checking for ttaenc... no
checking for wavpack... no
checking for wvunpack... no
checking for audio system... MacOSX
configure: creating ./config.status
config.status: creating makefile
config.status: creating mus-config.h
config.status: mus-config.h is unchanged
configure: WARNING: unrecognized options: --with-motif-prefix

  Options selected
  -------------------------
  Snd version ...........: 15.7
  CFLAGS ................: -O2 -I. -I/sw/include -I/opt/X11/include
  LDFLAGS ...............:-L/sw/lib -lmx -bind_at_load
  LIBS...................: 
  prefix.................: /usr/local
  extension language.....: s7
  audio system...........: MacOSX
  graphics toolkit.......: Motif
  optional libraries.....:
  random features........:
  environs...............: x86_64-apple-darwin14.3.0 gcc

wlan-private-226:snd-15.7 ludi$ make
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      headers.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      audio.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      io.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      sound.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      clm.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      xen.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      vct.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      sndlib2xen.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      clm2xen.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      snd-io.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      snd-utils.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      snd-listener.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      snd-completion.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      snd-menu.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      snd-axis.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      snd-data.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      snd-fft.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      snd-marks.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      snd-file.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      snd-edits.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      snd-chn.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      snd-dac.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      snd-region.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      snd-select.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      snd-find.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      snd-snd.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      snd-help.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      snd-main.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      snd-print.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      snd-trans.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      snd-mix.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      snd.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      snd-env.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      snd-xen.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      snd-ladspa.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      snd-kbd.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      snd-sig.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      snd-draw.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      snd-gxbitmaps.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      snd-gxcolormaps.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      snd-motif.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include -I/opt/X11/include      xm.c
gcc -L/sw/lib -lmx -bind_at_load -O2 -I. -I/sw/include -I/opt/X11/include s7.o headers.o audio.o io.o sound.o clm.o xen.o vct.o sndlib2xen.o clm2xen.o snd-io.o snd-utils.o snd-listener.o snd-completion.o snd-menu.o snd-axis.o snd-data.o snd-fft.o snd-marks.o snd-file.o snd-edits.o snd-chn.o snd-dac.o snd-region.o snd-select.o snd-find.o snd-snd.o snd-help.o snd-main.o snd-print.o snd-trans.o snd-mix.o snd.o snd-env.o snd-xen.o snd-ladspa.o snd-kbd.o snd-sig.o snd-draw.o snd-gxbitmaps.o snd-gxcolormaps.o snd-motif.o xm.o  -o snd   -lXm -lXt -lX11  -lXext -lSM -lICE -lXpm   -framework CoreAudio -framework CoreFoundation -framework CoreMIDI    
ld: library not found for -lXt
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [snd] Error 1
wlan-private-226:snd-15.7 ludi$ 

_______________________________________________
Cmdist mailing list
Cmdist@...
https://cm-mail.stanford.edu/mailman/listinfo/cmdist
ludger bruemmer | 1 Jul 14:05 2015

compiling snd 15.7 on osx 10.10

Dear all, 

I tried to compile snd.15.7 on osx10.10
and found the error 

/sw/include/Xm/Xm.h:56:10: fatal error: 'X11/Intrinsic.h' file not found
#include <X11/Intrinsic.h>

since the configuration process went through ok I was wondering why I could not find any Intrinsic.h file. It seems that some elements are not installed. Does anyone have an idea which one?
see the configure and make call below

all the best
Ludger



macmusmp15:snd-15.7 ludi$ ./configure CFLAGS="-I/sw/include" LDFLAGS="-L/sw/lib -lmx -bind_at_load" --with-motif --with-motif-prefix=/sw
configure: WARNING: unrecognized options: --with-motif-prefix
checking build system type... x86_64-apple-darwin14.3.0
checking host system type... x86_64-apple-darwin14.3.0
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for a BSD-compatible install... /usr/bin/install -c
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking whether byte ordering is bigendian... no
checking size of void *... 8
checking for pkg-config... /sw/bin/pkg-config
checking for fftw3... no
checking for gsl... no
checking for X... libraries /usr/X11/lib, headers /usr/X11/include
checking whether -R must be followed by a space... neither works
checking for gethostbyname... yes
checking for connect... yes
checking for remove... yes
checking for shmat... yes
checking for IceConnectionNumber in -lICE... yes
checking for oggdec... no
checking for oggenc... no
checking for mpg123... no
checking for mpg321... no
checking for speexdec... no
checking for speexenc... no
checking for flac... no
checking for timidity... no
checking for ttaenc... no
checking for wavpack... no
checking for wvunpack... no
checking for audio system... MacOSX
configure: creating ./config.status
config.status: creating makefile
config.status: creating mus-config.h
configure: WARNING: unrecognized options: --with-motif-prefix

  Options selected
  -------------------------
  Snd version ...........: 15.7
  CFLAGS ................: -O2 -I. -I/sw/include
  LDFLAGS ...............:-L/sw/lib -lmx -bind_at_load
  LIBS...................: 
  prefix.................: /usr/local
  extension language.....: s7
  audio system...........: MacOSX
  graphics toolkit.......: Motif
  optional libraries.....:
  random features........:
  environs...............: x86_64-apple-darwin14.3.0 gcc

macmusmp15:snd-15.7 ludi$ make
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include      s7.c
gcc -c -DSCRIPTS_DIR=\"/usr/local/share/snd\"   -O2 -I. -I/sw/include      headers.c
In file included from headers.c:40:
In file included from ./snd.h:33:
In file included from ./snd-x0.h:4:
In file included from /sw/include/Xm/XmAll.h:46:
/sw/include/Xm/Xm.h:56:10: fatal error: 'X11/Intrinsic.h' file not found
#include <X11/Intrinsic.h>
         ^
1 error generated.
make: *** [headers.o] Error 1
-- 
Ludger Brümmer 
Leitung | Head of Department
Institut für Musik und Akustik | Institute for Music and Acoustics

///////  / |<  ||| | ZKM | Zentrum für Kunst und Medientechnologie Karlsruhe
///////  / |<  ||| | ZKM | Center for Art and Media Karlsruhe
///////  / |<  ||| | ZKM | Centre d'Art et de Technologie des Médias Karlsruhe

Lorenzstr. 19, D-76135 Karlsruhe
Tel +49-(0)721-8100-1601, Fax +49-(0)721-8100-1699
E-Mail: ludger.bruemmer-jw3SIX3GuAc@public.gmane.org
www.zkm.de



Eröffnungswochenende: 19. bis 21.06.2015

_______________________________________________
Cmdist mailing list
Cmdist@...
https://cm-mail.stanford.edu/mailman/listinfo/cmdist
Tito Latini | 29 Jun 12:49 2015
Picon

Fix sdif-import

Hello,

sdif-import fails, at least on GNU/Linux x86_64 with SDIF-3.11.4.
I have attached a patch to fix the bug. The logic to increment
bytesread follows the code of the tool `sdifextract':

  SdifFReadGeneralHeader(in);
  SdifFReadAllASCIIChunks(in);
  loop frames:
      SdifFReadFrameHeader(in);
      loop matrices:
          bytesread = SdifFReadMatrixHeader(in);
          loop rows:
              bytesread += SdifFReadOneRow(in);
          SdifFReadPadding(in, SdifFPaddingCalculate(in->Stream, bytesread));
      eof = SdifFGetSignature(in, &bytesread) == eEof;
diff -ur commonmusic-code-2159-trunk~/src/CmSupport.cpp commonmusic-code-2159-trunk/src/CmSupport.cpp
--- commonmusic-code-2159-trunk~/src/CmSupport.cpp	2015-06-29 12:04:03.677358890 +0200
+++ commonmusic-code-2159-trunk/src/CmSupport.cpp	2015-06-29 12:07:10.470010588 +0200
 <at>  <at>  -2211,7 +2211,7  <at>  <at> 

   while (!endoffile && SdifFLastError(sdiffile) == NULL)
   {
-    bytesread += SdifFReadFrameHeader(sdiffile);
+    SdifFReadFrameHeader(sdiffile);
     // optionally skip frames that dont match what we want
     if (sigmatch==eEmptySignature || SdifFCurrSignature(sdiffile) == sigmatch)
     {
 <at>  <at>  -2228,7 +2228,7  <at>  <at> 

       for (int m = 0; m < numarrays; m++)
       {
-        bytesread += SdifFReadMatrixHeader(sdiffile);
+        bytesread = SdifFReadMatrixHeader(sdiffile);
         SdifSignature arraysig  = SdifFCurrMatrixSignature (sdiffile);
         SdifInt4 numrows = SdifFCurrNbRow (sdiffile);
         SdifInt4 numcols = SdifFCurrNbCol (sdiffile);
 <at>  <at>  -2265,6 +2265,7  <at>  <at> 
         // add this matrix to end of frame
         s7_set_cdr(ftail, s7_cons(st->scheme, mhead, st->schemeNil));
         ftail=s7_cdr(ftail);
+        SdifFReadPadding(sdiffile, SdifFPaddingCalculate(sdiffile->Stream, bytesread));
       }
       // add this frame to end of results
       if (rhead == st->schemeNil)
_______________________________________________
Cmdist mailing list
Cmdist@...
https://cm-mail.stanford.edu/mailman/listinfo/cmdist
Dave Phillips | 25 Jun 17:42 2015
Picon

GRACE problems

Greetings,

I built the latest SVN update, have a problem with the audio device 
selection :

     Error when trying to open audio device!

     Could not open audio device "jack": Invalid argument (-22)

I also received similar errors when I selected any other device listed, 
including the default ALSA device. As far as I can tell, nothing else is 
using JACK.

I'm also having trouble with the SDIF support. I specify

   premake4 --with-sdif=/usr

and premake reports no problem, which it shouldn't because sdif.h is 
located at /usr/include. Make doesn't report a problem, but it doesn't 
build an SDIF-enabled GRACE. I had no issues with the FOMUS and oscpack 
support, and they are indicated in the GRACE window.

Any suggestions ?

Fedora 19 x86_64, with Planet CCRMA extensions.

Best,

dp
anders.vinjar | 22 Jun 10:59 2015
Picon

patch to markov-analyze in snd/CM_patterns.scm

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:

Attachment (CM_patterns.patch): text/x-patch, 997 bytes

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.
_______________________________________________
Cmdist mailing list
Cmdist@...
https://cm-mail.stanford.edu/mailman/listinfo/cmdist
anders.vinjar | 19 Jun 13:44 2015
Picon

snd arithmetics -> odd numbers - locale thing?

Hi Bill, others.

In snd/s7:

(/ 3 2.0)
=> 1,5.0

I suspect this has something to do my locale set to print decimal
numbers using comma?

I'd rather keep it like that, but it makes snd/s7 return some strange
things here.  Any cures?
Bill Schottstaedt | 15 Jun 01:25 2015
Picon

Snd 15.7

Snd 15.7:

added CM_patterns.scm thanks to Rick and Anders

removed s7 ~<~> format directive
changed bytevector* to byte-vector* (r7rs.scm has definitions of the old forms)

checked: gtk 3.17.2|3, sbcl 1.2.12

Thanks!:  Tito Latini, Kjetil Matheussen, Anders Vinjar

Gmane