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
class RandomSubclass < [Array, Hash, String, Fixnum, Float, TrueClass].sample | |
# Wat | |
end |
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
function [c, ceq] = h(x) | |
ceq = []; | |
c = (x(1) - 1)^2 + (x(2) + 1)^2 - 1; | |
end | |
function [xp, yp] = circle(x,y,r) | |
ang=0:0.01:2*pi; | |
xp= x + r * cos(ang); | |
yp= y + r * sin(ang); | |
end |
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
function zad5() | |
foo = @(x1, x2) 100*(x2 - x1^2)^2 + (sqrt(2) - x1)^2; | |
bar = @(x) foo(x(1), x(2)); | |
X0 = [0; 0]; | |
Ymin = fminunc(bar, X0); | |
Ymin | |
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
V hillis_steele(alias op, V)(V array) { | |
for(size_t i = 1; i < array.length; i *= 2) { | |
for(size_t j = array.length; j > 0; --j) { | |
if(j > i) { | |
array[j-1] = op(array[j-1-i], array[j-1]); | |
} | |
} | |
} | |
return array; | |
} |
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
(defmacro defvm (regs @tuple body) | |
(append `(do (defmacro defop (name @tuple body) | |
(append (tuple 'defun name '$regs | |
(append (tuple 'dump (stringof name)) '$regs)) | |
body)) | |
(defmacro go (name) | |
(cons name '$regs))) | |
(map (lambda (op) | |
(append `(defop $(car op)) |
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 (splines-1 x X Y) | |
(foldl (lambda (((X0 . Y0) . (X1 . Y1)) result) | |
(if (<= X0 x X1) | |
(+ Y0 (* (/ (- Y1 Y0) | |
(- X1 X0)) | |
(- x X0)) | |
result))) | |
(let ((zipped (zip X Y))) | |
(zip zipped (cdr zipped))))) |
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 (bisection f a b tol) | |
(let ((c (* (+ a b) 0.5))) | |
(cond ((<= (abs (f c)) tol) c) | |
((> (* (f a) (f c)) 0) (bisection f c b tol)) | |
(else (bisection f a c tol))))) | |
(define (newton f fp fb a b tol) | |
(let loop ((c (if (> (* (f a) (fb a)) 0) a b))) | |
(if (<= (abs (f c)) tol) | |
c |
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
(defclass Point (Object) | |
'x 'y) | |
#; A constructor | |
(defmethod initialize ((p Point) initargs) | |
(call-next-method) | |
(initialize-slots p initargs)) | |
#; Point3D inherits the ctor | |
(defclass Point3D (Point) |
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
(setq org-capture-templates | |
(list* `("1" "New easy quest." entry (file "") | |
,(concat "* TODO %?\nSCHEDULED: %t\n" | |
":PROPERTIES:\n" | |
":gamify_exp: %(gamify-assign-some-exp 5 2)\n" | |
":END:\n" | |
"%U\n%a\n %i\n")) | |
`("2" "New medium quest." entry (file "") | |
,(concat "* TODO %?\nSCHEDULED: %t\n" | |
":PROPERTIES:\n" |
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
(require 'gamify) | |
(gamify-start) |