Skip to content

Instantly share code, notes, and snippets.

@monkey413
monkey413 / fear_of_macros.rkt
Last active October 14, 2019 17:11
fear_of_macros.rkt
#lang racket
(define-syntax foo
(lambda (stx)
(syntax "I am foo")))
(define-syntax (also-foo stx)
(syntax "I am also foo"))
(define-syntax (quoted-foo stx)
#'"I am also foo, using #' instead of syntax")
@monkey413
monkey413 / listentry.cpp
Last active May 16, 2018 11:19
I don't know why I am doing.
/* -1 not found */
unsigned int findList(const unsigned int DATA_A, const unsigned int DATA_B){
unsigned int prevEntry = NULL, curEntry = ListHead;
while(curEntry != NULL) {
if (ListArray[curEntry].DataH == DATA_A && ListArray[curEntry].DataL == DATA_B) {
printf("FoundEntry = %d, PreEntry = %d\n", curEntry, prevEntry);
return curEntry;
}
@monkey413
monkey413 / filt.cpp
Created May 16, 2018 08:34
I don't know why I am doing.
#include <stdio.h>
int lowerBound(const int nums[], int numsSize, int target){
int lb = 0, n = numsSize, step;
while(n > 0){
step = n/2;
if(nums[lb+step] < target){
lb += step+1;
n -= step+1;