(+ 1 2 (- 3 5))The classic "Hallo world!" program is:
(begin (display "Hallo world!") (newline))It is possible to define functions with the Lambda operator:
(define twice (lambda (x) (+ x x )))It supports a powerful macro-system similar to Lisp, based on quotations and quasiquotations:
(define ignore (macro (x) `(quote ,x)))It can operate on high-order functions:
(map (lambda (x) (+ x 2)) '(1 2 3 4))
(begin (load "vuzcsnd.scm") (csound-initialize CSOUNDINIT_NO_ATEXIT) (define cs (csound-create)) (define orc "sr=44100\nksmps=32\nnchnls=2\n0dbfs=1\n\ninstr 1\naout vco2 0.5, 440\nouts aout, aout\nendin") (define sco "i1 0 1") (csound-send cs 'set-option "-odac") (csound-send cs 'compile-orc orc) (csound-send cs 'read-score sco) (csound-send cs 'start) (csound-send cs 'perform) (csound-destroy cs) )The following example shows how to create a simple UI and assign actions to the created controls by means of a callback lambda function:
(begin (load "vuztk.scm") (define window (fl-make-widget 'window 0 0 395 180 "FLTK")) (define slider1 (fl-make-widget 'hor-value-slider 5 5 380 30 "Sl1")) (define slider2 (fl-make-widget 'hor-value-slider 5 65 380 30 "Sl2")) (define slider3 (fl-make-widget 'hor-fill-slider 5 125 380 30 "(Sl3 - connected to Sl1)")) (fl-send slider3 'set_output) (define (cback1 caller) (define v (fl-send caller 'value)) (display "Sl1 value = ") (display v) (newline) (fl-send slider3 'value! v)) (define (cback2 caller) (define v (fl-send caller 'value)) (display "Sl2 value = ") (display v) (newline)) (fl-send slider1 'callback cback1) (fl-send slider2 'callback cback2) (fl-send slider3 'color 127) (fl-send window 'end) (fl-send window 'show) (fl-run) )