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
(use srfi-1) | |
(define (advance ls n) | |
(if (< n 1) | |
ls | |
(advance (cdr ls) (- n 1)))) | |
(define (subset ls start count) | |
(define (build-cell it i) | |
(if (= i count) |
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 math | |
def sqrt(x_0, guess, tol): | |
x = guess | |
while math.fabs(x*x - x_0) > tol: | |
x = (x*x - x_0) / (2.0 * x) | |
return x | |
print(sqrt(2.0, 2.0, 0.0001)) |
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 (eval-html templ env) | |
(define (lookup-var key env) | |
(let ((pair (assoc key env))) | |
(if (pair? pair) | |
(cdr pair) | |
'()))) | |
(define (tag? templ) |
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
# Created By: Justin Meiners (2012) | |
# This was really useful at one point. I doubt it still is. | |
from pymel.all import * | |
import pymel | |
selection_list = pymel.core.ls(type="transform", selection=True) | |
for node in selection_list: | |
node.centerPivots() | |
point = node.getRotatePivot(space="world") |
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
; ParenScript experiment | |
; https://common-lisp.net/project/parenscript/reference.html | |
; https://gitlab.common-lisp.net/parenscript/parenscript | |
; typical functions | |
(defun fib (n) | |
(cond ((= n 0) 0) | |
((= n 1) 1) | |
(t (+ (fib (- n 1)) (fib (- n 2)))))) |
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
// Created By: Justin Meiners (2018) | |
pragma solidity ^0.4.24; | |
// https://en.wikipedia.org/wiki/Dutch_auction | |
contract DutchAuction { | |
uint public askingPrice; | |
address public auctioneer; | |
address public winner; | |
address public seller; |
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
# Created By: Justin Meiners (2017) | |
# simple calculations | |
# ------------------------------- | |
import math | |
def volume_cone(radius, height): | |
volume = math.pi * (radius**2.0) * (height / 3.0) | |
return volume |
Learn You a Haskell For Great Good
I tried going through this book a few times when I was younger, but lacked the mathematical knowledge to understand a lot of what was going on. Now the functional ideas and type system are a breeze but lazinesss is still very new and mysterious.
Referential transparency: if a function is called multiple times with the same inputs, it will produce the same outputs.
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
// how to write a struct to a buffer. | |
typedef struct { | |
int version; | |
int count; | |
char id[8]; | |
} FileInfo; | |
FileInfo info; |