This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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)) |
This file contains hidden or 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) | |
| (define-logger counter) | |
| (struct waiter (threshold ch) #:transparent) | |
| (struct counter (add-ch incr-ch thread)) | |
| (define (make-counter) |
This file contains hidden or 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) | |
| (define-cstruct _csc | |
| ([nzmax _int] ; ///< maximum number of entries | |
| [m _int] ; ///< number of rows | |
| [n _int] ; ///< number of columns | |
| [p* _pointer] ; ///< column pointers (size n+1); col indices (size nzmax) | |
| ; start from 0 when using triplet format (direct KKT |