Welcome to the CHICKEN Scheme pasting service

Proper way to return multiple float values from C? added by jacius on Fri Feb 14 23:10:05 2020

(import (chicken format))

(define return-flonum-values
  (foreign-primitive
   ()
   "C_word* ab = C_alloc(C_SIZEOF_FLONUM * 4), *a = ab;"
   "C_word av[2 + 4] = {"
   "   C_SCHEME_UNDEFINED, C_k,"
   "   C_flonum(&a, 0.25),"
   "   C_flonum(&a, 0.5),"
   "   C_flonum(&a, 0.75),"
   "   C_flonum(&a, 1.0)"
   "};"
   "C_values(2 + 4, av);"))

(let-values (((r g b a) (return-flonum-values)))
  (printf "~A ~A ~A ~A~N" r g b a))

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Which egg provides `take-right'?
Visually impaired? Let me spell it for you (wav file) download WAV