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 curly-fn racket/base | |
| (require data/bit-vector) | |
| (define (((make-hash-func init mult) size) key) | |
| (modulo | |
| (+ init | |
| (for/sum ([char key]) (* mult (char->integer char)))) | |
| size)) | |
| (define (make-bloom-filter make-hash-functions 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
| (define (^ a n) | |
| (cond | |
| [(= 0 n) 1] | |
| [(positive-integer? n) (apply * (make-list n a))] | |
| [(negative-integer? n) (/ 1 (^ a (- n)))] | |
| [(and (rational? n) (= 1 (numerator n))) | |
| (let loop ([answer 1]) | |
| (define ans^n (^ answer (denominator n))) | |
| (cond | |
| [(< (abs (- ans^n a)) 0.001) answer] |
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 rhombus | |
| 1+1 | |
| val x :: Integer : 1 | |
| x+1 | |
| val mutable ha: 1 | |
| ha := 2 | |
| ha | |
| begin: |
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 <stdio.h> | |
| void swap(int *x, int *y) { | |
| long tmp = *x; | |
| *x = *y; | |
| *y = tmp; | |
| } | |
| void insertion_sort(int s[], int len) { | |
| for (int i = 1; i < len; i++) { |
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 | |
| (define object-weight second) | |
| (define object-price third) | |
| (define c (make-hash)) | |
| (define (knapsack pool w) | |
| (for ([obj pool] | |
| [n (length pool)]) | |
| (for ([w (range 1 (add1 w))]) |
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 | |
| 1/11 | |
| (exact->inexact 1/11) | |
| (define (recurring-decimal->rational n) | |
| (/ (string->number n) (sub1 (expt 10 (string-length n))))) | |
| (recurring-decimal->rational "12345") | |
| (recurring-decimal->rational "09") |
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 rackcheck | |
| rackunit) | |
| (check-property | |
| (property ([xs (gen:list gen:natural)]) | |
| (check-equal? (reverse (reverse xs)) xs))) |
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
| # source:http://reocities.com/SiliconValley/heights/7052/opcode.txt | |
| From: mark@omnifest.uwm.edu (Mark Hopkins) | |
| Newsgroups: alt.lang.asm | |
| Subject: A Summary of the 80486 Opcodes and Instructions | |
| (1) The 80x86 is an Octal Machine | |
| This is a follow-up and revision of an article posted in alt.lang.asm on | |
| 7-5-92 concerning the 80x86 instruction encoding. | |
| The only proper way to understand 80x86 coding is to realize that ALL 80x86 |
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
| (import (rnrs)) | |
| (define (generate-bar tick percent total-width) | |
| (let ([num-equals (if (= tick 0) 0 (- tick 1))] | |
| [arrow (if (= tick 0) "" ">")] | |
| [width (- total-width 6)] | |
| [places-string | |
| (cond | |
| [(< percent 10) " "] | |
| [(< percent 100) " "] |
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 | |
| (provide proof | |
| define-rewrite) | |
| (require (for-syntax racket/match) | |
| syntax/parse/define) | |
| (define-syntax-parser proof | |
| [(_ form-a ≡ form-b) | |
| #'(unless (equal? form-a 'form-b) |