This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket/base | |
(require racket/contract | |
racket/undefined) | |
(provide ivar? | |
exn:fail:ivar? | |
make-ivar | |
(contract-out | |
[ivar-put! (-> ivar? any/c any)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket/base | |
(require racket/async-channel | |
racket/function) | |
(struct waiter (thd req-ch notify-ch)) | |
(define (make-waiter) | |
(define req-ch (make-channel)) | |
(define notify-ch (make-channel)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket/base | |
(require (for-syntax racket/base | |
racket/format | |
syntax/parse/lib/function-header) | |
(rename-in racket/base [raise base:raise]) | |
racket/stxparam | |
syntax/parse/define) | |
(begin-for-syntax |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket/base | |
(define (apples a-string) | |
(define string-size (string-length a-string)) | |
(define (once current count i) | |
(cond | |
[(= i string-size) | |
(if current | |
(list (cons current count)) | |
null)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket/base | |
(require racket/match) | |
(struct holder (thd req-ch)) | |
(define (make-holder initial-value) | |
(define req-ch (make-channel)) | |
(define thd | |
(thread |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
(require job-queue | |
racket/async-channel | |
threading) | |
(define ssh-bin (find-executable-path "ssh")) | |
;; adjust for your level of safety | |
(define ssh-args |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdint.h> | |
#include <stdlib.h> | |
void | |
get_numbers(int64_t *numbers, uint64_t size) | |
{ | |
for(int i=0; i < size; i++) { | |
numbers[i] = rand(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket/base | |
(require "defer.rkt") | |
(define (x) | |
(define f (open-input-file "/dev/random")) | |
(defer (begin (println "closing f") (close-input-port f))) | |
(displayln (bytes->list (read-bytes 32 f)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket/base | |
(module stack racket/base | |
(provide build-it) | |
(define (build-it n) | |
(if (zero? n) | |
null | |
(cons n (build-it (sub1 n)))))) | |
(module accumulate racket/base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket/base | |
(require ffi/unsafe | |
gir) | |
(define arrow-lib (gi-ffi "Arrow")) | |
(define (make-arrow-buffer buf size) | |
(arrow-lib 'Buffer 'new buf size)) |