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
sbcl --script %1 |
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
;; Global lexical variable by Kent M. Pitman https://groups.google.com/g/comp.lang.lisp/c/d5bsSR0o4Ps/m/6Hxj3TCvDHQJ | |
(defmacro deflexical (var &optional init doc) | |
`(progn (define-symbol-macro ,var (get ',var 'lexical)) | |
(setf ,var ,init) | |
(setf (get ',var 'lexical-doc) ',doc) | |
',var)) |
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
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe /p:configuration=release |
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
(defun play-game () | |
(let ((score 0) numbers answer) | |
(loop | |
(setf numbers (loop repeat 5 collect (random 10))) | |
(format t "Score: ~a~%" score) | |
(format t "Add these numbers: ~a: " numbers) | |
(finish-output) | |
(setf answer (parse-integer (read-line) :junk-allowed t)) | |
(if (eql (reduce #'+ numbers) answer) | |
(progn |
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
using System; | |
using System.Linq; | |
class Program | |
{ | |
static void Main() | |
{ | |
var score = 0; | |
var random = new Random(); |
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
<div style="text-align: center;"> | |
<span>hello</span> | |
</div> |
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
#lang racket | |
(define (fib n) | |
(let loop ([a 0] [b 1] [n n]) | |
(if (= n 0) | |
a | |
(loop b (+ a b) (- n 1))))) | |
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
#lang racket | |
;; memoized fibonacci | |
(define Fib (make-hash)) | |
(define (fib n) | |
(let ([v (hash-ref Fib n #f)]) | |
(cond [v v] | |
[else (let ([v (if (< n 2) n (+ (fib (- n 2)) (fib (- n 1))))]) | |
(hash-set! Fib n v) | |
v)]))) |
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
function collatz([System.Numerics.BigInteger]$n) { | |
echo $n; | |
if ($n -gt 1) { | |
if ($n % 2 -eq 0) { | |
collatz($n / 2); | |
} else { | |
collatz(3 * $n + 1); | |
} | |
} | |
} |
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 collections | |
print('Prefix calculator: + - * / ^') | |
def eval(tokens): | |
tok = tokens.popleft() | |
if tok == '+': | |
return eval(tokens) + eval(tokens) | |
elif tok == '-': | |
return eval(tokens) - eval(tokens) |
NewerOlder