This file contains 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
copyItem = function(item, shallow) { | |
var itemProto = Object.prototype.toString.call(item); | |
var newItem = item; | |
var getItem = function(child) { return !shallow ? copyItem(child) : child; }; | |
if (itemProto === Object.prototype.toString.call([])) { | |
newItem = []; | |
for (var itemIndex=0, len=item.length; itemIndex < len; itemIndex++) newItem.push(getItem(item[itemIndex])); | |
} | |
if (itemProto === Object.prototype.toString.call({})) { | |
newItem = {}; |
This file contains 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 random | |
num = random.randint(0, 100) | |
win = False | |
print("Guess my number game!") | |
while not win: | |
user = input("> ") | |
if user.isdecimal(): | |
user = int(user) | |
if user > num: | |
print("To High!") |
This file contains 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 (join-paths) | |
(join (flat $args) (if (= ostype "Windows") {\} "/"))) |
This file contains 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
;;;; NewLisp | |
(context 'let-unpack) ; (let-unpack (a b c (list 1 2 3)) (+ a b c)) -> 6 | |
(define-macro (let-unpack:let-unpack expressions body) | |
(letn (rev (reverse expressions) syms (apply list (reverse (rest rev))) vals (eval (first rev))) | |
(eval (letex (expression (map (fn (symb val) (list symb val)) syms vals) body body) | |
'(let expression body))))) | |
(context MAIN) |