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 create = (globals) => { | |
var _G = Object.assign({ | |
}, globals || { | |
}); | |
_G._G = _G; | |
_G.environment = [{ | |
}]; | |
var isNil = (x) => { | |
return x === undefined || x === null; | |
}; |
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
~$ time luajit -e 'print(1)' | |
1 | |
real 0m0.090s | |
user 0m0.031s | |
sys 0m0.053s | |
~$ time luajit -e 'print(1)' | |
1 | |
real 0m0.082s |
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 delimiters (set-of "," "\r" "\n" "\"" "")) | |
(define whitespace (set-of "," "\r" "\n")) | |
(define stream (str more) | |
(obj pos: 0 string: str len: (# str) more: more)) | |
(define peek-char (s) | |
(char (get s 'string) (get s 'pos))) | |
(define read-char (s) |
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
#!/usr/bin/env lumen | |
(define passed 0) | |
(define failed 0) | |
(define tests ()) | |
(define system (require 'system)) | |
(define reader (load "reader.l")) | |
(define-macro test (x msg) |
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 aux (load "aux.l")) | |
(define count-indexed (name) | |
(let h ((get io 'open) name) | |
((get h 'seek) h "end" -8) | |
(with n (tonumber (be64dec ((get h 'read) h "*a"))) | |
((get h 'close) h)))) | |
(define count-rows (name) | |
(let h ((get io 'open) name) |
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
//#![feature(proc_macro)] | |
extern crate exec; | |
extern crate libc; | |
// pub unsafe extern fn realpath(pathname: *const c_char, resolved: *mut c_char) -> *mut c_char | |
// // use std::io::fs::{mkdir_recursive,rmdir_recursive}; | |
// use std::io; | |
// use std::io::fs; | |
// use std::io::process::{ProcessOutput,ProcessExit}; | |
// use std::os; |
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-global environment (list (obj))) | |
(define-global target (language)) | |
(define-global nil? (x) | |
(target | |
js: (or (= x nil) (= x null)) | |
lua: (= x nil))) | |
(define-global is? (x) (not (nil? x))) |
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
; Four people, Arnold, Brenda, Carlos and Darlene, each said two statements such that: | |
; • One person lied in both statements; | |
; • One person told the truth in both statements; and | |
; • Two people told the truth in one statement and a lie in the other statement. | |
; Arnold said, “Brenda lied once” and “Darlene lied twice.” | |
; Brenda said, “I never lie” and “Arnold never lied.” | |
; Carlos said, “Darlene lied twice” and “Brenda never lied.” | |
; Darlene said, “Arnold lied twice” and “I never lie.” |
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
Preface | |
Is Lisp worth learning? Will it make you a better programmer? Who cares, and why | |
should you? | |
If you list the N most impressive programs written in Lisp, it would probably be | |
dwarfed in depth and breadth by the N most impressive JavaScript programs. Isn't | |
that proof that this book isn't worth your time? | |
The best way to disprove this notion is to show by example. Consider a word |
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
foo |