Compare commits
No commits in common. "30f67ab42b673bf2cffb5b39b04048d63eddfd0f" and "ca5302f42fe430f37557dfd78cb4140074964d3c" have entirely different histories.
30f67ab42b
...
ca5302f42f
@ -1,37 +0,0 @@
|
||||
// Approximate racket functions
|
||||
function circle(color) {
|
||||
print(`${color} circle`)
|
||||
}
|
||||
function square(color) {
|
||||
print(`${color} square`)
|
||||
}
|
||||
function print(shape) {
|
||||
console.log(shape)
|
||||
}
|
||||
// Cuz javascript doesn't have functional primitives
|
||||
function first(list) {
|
||||
return list[0]
|
||||
}
|
||||
function rest(list) {
|
||||
return list.slice(1)
|
||||
}
|
||||
|
||||
// Helper to cycle through the functions
|
||||
function cycle(list) {
|
||||
return rest(list).concat(first(list))
|
||||
}
|
||||
|
||||
// The actual function
|
||||
function rainbow(...functions) {
|
||||
let colors = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet']
|
||||
function rainbowRecursive(functions, colors) {
|
||||
if (colors.length === 0) {
|
||||
return
|
||||
}
|
||||
first(functions)(first(colors))
|
||||
rainbowRecursive(cycle(functions), rest(colors))
|
||||
}
|
||||
rainbowRecursive(functions, colors)
|
||||
}
|
||||
|
||||
rainbow(circle, square)
|
@ -1,17 +0,0 @@
|
||||
#lang racket
|
||||
(require pict)
|
||||
(require pict/color)
|
||||
; The actual function
|
||||
(define (rainbow . shapes)
|
||||
(define colors (list red orange yellow green blue purple))
|
||||
(define (cycle lst) (append (rest lst) (list (first lst))))
|
||||
(define (rainbow-recursive shapes colors)
|
||||
(cond
|
||||
[(empty? colors) (void)]
|
||||
[(print((first colors) (first shapes)))
|
||||
(rainbow-recursive (cycle shapes) (rest colors))]
|
||||
)
|
||||
)
|
||||
(rainbow-recursive shapes colors))
|
||||
; Example usage
|
||||
(rainbow (filled-rectangle 25 25) (filled-ellipse 25 25))
|
@ -1,12 +0,0 @@
|
||||
; Fix Windows Volume:
|
||||
$Volume_Up::
|
||||
SoundGet, volume
|
||||
Send {Volume_Up}
|
||||
SoundSet, volume + 1
|
||||
Return
|
||||
|
||||
$Volume_Down::
|
||||
SoundGet, volume
|
||||
Send {Volume_Down}
|
||||
SoundSet, volume - 1
|
||||
Return
|
Loading…
Reference in New Issue
Block a user