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
;(load "1.lsp") | |
(setq tree '(1 (2 5) 6 (10 (14 (25 27) 40)))) | |
(print tree) | |
(defun traverse-tree(tree depth) | |
(if (atom tree) | |
(progn (funcall func tree) (return-from traverse-tree)) | |
) | |
(let ((list-len (length tree))) |
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 Schedule (pretend, real) { | |
this.morning = pretend["morning"]; | |
this.evening = pretend["evening"] | |
var morning = Symbol("morning") | |
var evening = Symbol("evening") | |
this[morning] = real["morning"]; | |
this[evening] = real["evening"]; |
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 SpaceShip(pilot, maxSpeed) { | |
this.pilot = pilot; | |
this.maxSpeed = maxSpeed; | |
} | |
SpaceShip.UPDATE_PILOT = "updatePilot"; | |
SpaceShip.prototype.updatePilot = function (newAge, newSkill) { | |
var notifier = Object.getNotifier(this); | |
var self = this; |
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 tagged () ((tag :reader get-tag :writer set-tag :initform "Empty tag" :initarg :tag))) | |
(defclass 3d-point (tagged) | |
( | |
(x :reader get-x :writer set-x :initarg :x) | |
(y :reader get-y :writer set-y :initarg :y) | |
(z :reader get-z :writer set-z :initarg :z) | |
) | |
) |
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 while (conditions &body body) | |
; '(loop while , condition | |
;) | |
(defun vector-product(x y) | |
(reduce '+ 0 (map 'list #'* x y))) | |
(setq a (list (list 1 2) (list 3 4))) | |
(setq b (make-array '(2 2) :initial-element 2)) | |
; 2 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
var code1 = "0010110111011111001001000010110011011100111001101" | |
var code2 = "1102201100200102001002011102220011020111000220110" | |
function decodeMessage(message) { | |
if (message.length != 49){ | |
throw new Error("Bad length"); | |
} | |
var ans = []; | |
for (var i = 1; i < message.length; ++i) { | |
ans[ans.length] = (message[i] != message[i-1] ? 1 : 0); |
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
<ul> | |
<li class="item1">Text 1</li> | |
<li class="item2">Some text 2</li> | |
<li class="item3">Dota 2</li> | |
<li class="item4">Moon</li> | |
</ul> |
NewerOlder