Use SMLNJ.
Install the rlwrap from your package manager. Prepend rlwrap
to your invocation of sml
like so: rlwrap sml
.
Install package smlnj, and run sml
from the shell.
js/options.js: searchenginary[0] = "http://www.readability.com/m?url="; | |
js/options.js: searchenginary[1] = "http://mobilizer.instapaper.com/m?u="; | |
js/options.js: searchenginary[2] = "http://s.evernote.com/grclip?url="; | |
js/options.js: searchenginary[3] = "http://wayback.archive.org/web/*/" | |
js/options.js: searchenginary[4] = "http://webcache.googleusercontent.com/search?q=cache:" | |
js/options.js: searchenginary[13] = 'http://webcache.googleusercontent.com/search?q=cache:'; | |
js/options.js: searchenginary[20] = "http://www.tumblr.com/tagged/"; | |
js/options.js: searchenginary[21] = "http://www.pinterest.com/search/pins/?q="; | |
js/options.js: searchenginary[22] = "http://www.reddit.com/search?q="; | |
js/options.js: searchenginary[23] = "http://digg.com/search?q="; |
(defun winny/raise-or-create-window-system-frame (display) | |
"Raise an existing frame in the window system or create a new one." | |
(let ((frames (seq-filter #'(lambda (f) (frame-parameter f 'display)) (frame-list)))) | |
(if (null frames) | |
(make-frame `((window-system . x) | |
(display . ,display))) | |
(select-frame-set-input-focus (car frames))))) |
(* Mine *) | |
let encode list = | |
let rec encode' current acc list = | |
match (current, list) with | |
| (None, []) -> acc | |
| (Some c, []) -> c::acc | |
| (None, h::t) -> encode' (Some (1, h)) acc t | |
| (Some ((count, elem) as c), h::t) -> if elem = h | |
then encode' (Some (count+1, elem)) acc t | |
else encode' (Some (1, h)) (c::acc) t |
1 | |
120 | |
==== but the following will fail ==== | |
fact: contract violation | |
expected: natural? | |
given: -5 | |
in: the 1st argument of | |
(-> natural? natural?) | |
contract from: (function fact) | |
blaming: /tmp/ex.rkt |
#lang racket | |
(require srfi/41) | |
(define (fizzbuzz-stream) | |
(let loop ([n 1]) | |
(stream-cons | |
(match* ((modulo n 3) (modulo n 5)) | |
[(0 0) "FizzBuzz"] | |
[(0 _) "Fizz"] |
[ | |
{ | |
"model": "webapp.game", | |
"pk": 3, | |
"fields": { | |
"name": "Shorewood businesses", | |
"active": false, | |
"winner": null, |
unsigned char score(struct card *cards) { | |
if (cards[0].value == cards[1].value | |
&& cards[0].value == cards[2].value | |
&& cards[0].value == cards[3].value) { | |
return RANK_FOUR; | |
} | |
unsigned char order[] = {0, 1, 2, 3}; | |
unsigned char swapped; | |
do { |
#lang racket | |
(define modifiers | |
(hash 'inc + | |
'dec -)) | |
(define operations | |
(hash '> > | |
'< < | |
'!= (negate =) |
#lang racket | |
(define (part1 ls) | |
(for/sum ([n (map (curry argmax identity) ls)] | |
[m (map (curry argmin identity) ls)]) | |
(- n m))) | |
(define (part2 ls) | |
(for/sum ([line ls]) | |
(for/first ([n line] |