source-academy / py-slang

Python sublanguage for SICP
Apache License 2.0
0 stars 0 forks source link

Module import not working properly? #34

Closed martin-henz closed 2 months ago

martin-henz commented 2 months ago

This works in Source §1:

import { play_wave } from "sound";
const pi = math_PI;
play_wave(t => math_sin(2 * pi * t * 440), 1);

But this does not work in Python

from sound import play_wave
pi = 3.141592653589794626
play_wave(lambda t: math_sin(2 * pi * t * 440), 1)

The error:

Line 5: Error: play is expecting sound, but encountered t => t >= duration ? 0 : wave(t),1
martin-henz commented 2 months ago

This turned out to be a bug in the sound module.