Re: Coroutine produces segmentation fault

2024-06-02 Thread Alexander Burger
Hi František,

> I wrote a small script to generate and print the values of sine wave, as
> follows:
> ...
> (for N 44100 (printsp (co 'masterOut T)))
> ...
> 
> wave. However, when I increase the number on the next-to-last row tenfold
> (from 44100 to 441000), the script produces a segmentation fault (after
> printing lots of "(" parentheses) on line 13 (the "for" loop). What am I
> doing wrong?

It looks all good so far. Also, it runs fine here with 441000.

What version of Pil are you using?

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:[email protected]?subject=Unsubscribe


Coroutine produces segmentation fault

2024-06-02 Thread František Fuka
Hello, Picolisp beginner here.

I wrote a small script to generate and print the values of sine wave, as
follows:

#!/usr/bin/picolisp /usr/lib/picolisp/lib.l

(load "@lib/math.l")
(def 'pi2 (+ pi pi))

(co 'masterOut
(let (Step 0.001 Position 0)
(loop
(yield (sin (*/ pi2 Position 1.0)))
(inc 'Position Step)
(setq Position (% Position 1.0)

(for N 44100 (printsp (co 'masterOut T)))

(bye)

This script runs correctly and prints the first 44100 values of the sine
wave. However, when I increase the number on the next-to-last row tenfold
(from 44100 to 441000), the script produces a segmentation fault (after
printing lots of "(" parentheses) on line 13 (the "for" loop). What am I
doing wrong?

Thanks.

--
-- František Fuka