Skip to content

Instantly share code, notes, and snippets.

View tylerlrhodes's full-sized avatar
🍕

Tyler Rhodes tylerlrhodes

🍕
View GitHub Profile
@tylerlrhodes
tylerlrhodes / dlv error on mac
Created March 22, 2017 16:59
Step by step of error produced for delve issue
(dlv) breakpoints
Breakpoint unrecovered-panic at 0x1025cd0 for runtime.startpanic() /usr/local/Cellar/go/1.8/libexec/src/runtime/panic.go:568 (0)
(dlv) break main.UnsetBit
Breakpoint 1 set at 0x1088cf0 for main.(*BitVector).UnsetBit() ./bitvector.go:23
(dlv) continue
Bit 0 is set!> main.(*BitVector).UnsetBit() ./bitvector.go:23 (hits goroutine(1):1 total:1) (PC: 0x1088cf0)
18: }
19: bv.bytes[word] |= 1 << bit
20: }
@tylerlrhodes
tylerlrhodes / bitvector.go
Created March 24, 2017 15:58
Gist for delve debugger issue
package main
import (
"fmt"
)
// BitVector is a simple bit vector
// It's zero value represents the empty set
type BitVector struct {
bytes []uint64
package main
import "fmt"
// Increment Natural number y
func Increment(y uint) uint {
if y == 0 {
return 1
}
if y%2 == 1 {
Push-Location
Remove-Item "public" -Recurse
hugo
set-location "public\"
Write-S3Object -BucketName tylerrhodes.net -Folder . -Recurse -KeyPrefix \ -CannedACLName public-read -ProfileName HugoProfile
package main
import (
"github.com/aws/aws-lambda-go/lambda"
"github.com/aws/aws-lambda-go/events"
"errors"
"log"
)
var (
@tylerlrhodes
tylerlrhodes / sicp1.5.scm
Last active June 16, 2018 20:26
normal vs applicative evaluation test in scheme
(define (p) (p))
(define (test x y)
(if (= x 0)
0
y))
(test 0 (p))
@tylerlrhodes
tylerlrhodes / sicp1.6.scm
Created June 17, 2018 16:35
sicp1.6 Applicative Order Evaluation and an infinite loop
#lang sicp
;; Applicative order evaluation
(define (new-if predicate then-clause else-clause)
(cond (predicate then-clause)
(else else-clause)))
(define (sqrt-iter guess x)
(display guess)
@tylerlrhodes
tylerlrhodes / HigherOrderDemo.cs
Created July 8, 2018 17:51
Demo of higher order function in c#
using System;
using System.Collections.Generic;
namespace HigherOrderProceduresDemo
{
class Program
{
static void Map(IEnumerable<int> list, Action<int> fn)
{
foreach (var item in list)
@tylerlrhodes
tylerlrhodes / CQsortDemo.cpp
Created July 8, 2018 18:11
QSort demo in C for Higher Order Function
#include <stdio.h>
#include <stdlib.h>
void print_array(int* array, size_t size)
{
for (unsigned i = 0; i < size; ++i)
{
printf("%d\n", *array++);
}
@tylerlrhodes
tylerlrhodes / functionClosures.go
Created July 8, 2018 18:36
Function Closures example in Go, from Tour of Go
package main
import "fmt"
func adder() func(int) int {
sum := 0
return func(x int) int {
sum += x
return sum
}