<commit_before><commit_msg>chez: 4.2.calling-out-of-scheme<commit_after>;;; 4.2. Calling out of Scheme

;; syntax: (foreign-procedure conv ... entry-exp (param-type ...) res-type) 
;; returns: a procedure 

(load-shared-object "libc.so.6")

(define c-sleep-block
	(foreign-procedure #f "sleep"
										 (unsigned) unsigned))

(time (c-sleep-block 3))

(foreign-entry? "sleep")


(define c-sleep-safe
	(foreign-procedure __collect_safe "sleep"
										 (unsigned) unsigned))

(time (c-sleep-safe 3))


(define c-getenv
	(foreign-procedure #f "getenv" (string) string))

(c-getenv "SHELL")



(compute-size (cons 0 0))

{'fraction_non_alphanumeric': 0.1723027375201288, 'fraction_numerical': 0.014492753623188406, 'mean_word_length': 3.6074074074074076, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '343431', 'n_tokens_mistral': 264, 'n_tokens_neox': 223, 'n_words': 53}