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
IN: scratchpad 1 0 > | |
--- Data stack: | |
t | |
IN: scratchpad [ "true" ] [ "false" ] if | |
--- Data stack: | |
"true" | |
IN: scratchpad |
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
USING: kernel math math.functions sequences ; | |
IN: euler1 | |
: euler1 ( x -- y ) | |
iota [ dup [ 3 divisor? ] [ 5 divisor? ] bi or [ drop 0 ] unless ] map-sum ; |
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
import java.net.URI; | |
import java.nio.file.Files; | |
import java.nio.file.Paths; | |
public class Main { | |
public static void main(String[] args) throws Exception { | |
System.out.println(new String(Files.readAllBytes(Paths.get("/foo.txt")), "UTF-8")); | |
} | |
} |
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
user> (defn foo [& {:keys [bar] :or {bar 1}}] bar) | |
#'user/foo | |
user> (foo) | |
1 | |
user> (foo :baz 2) | |
1 | |
user> (foo :bar 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 foo = bar = 42; | |
{ | |
"type": "Program", | |
"body": [ | |
{ | |
"type": "VariableDeclaration", | |
"declarations": [ | |
{ | |
"type": "VariableDeclarator", | |
"id": { |
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
;; javascripty | |
(var foo 42) | |
(var inc (function (x) (+ x 1))) | |
(function dec (x) (- x 1)) | |
;; clojurey | |
(def foo 42) | |
(def inc (fn [x] (x + 1))) | |
(defn dec [x] (- x 1)) |
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 apply (f arr) | |
`(f ~@arr)) | |
(apply str ["foo" "bar" "baz"]) | |
;; macroexpands to: | |
(str "foo" "bar" "baz") |
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
; Missionaries and Cannibals | |
;------------------------------------------------------------------------------- | |
; main method | |
( defmethod mc () | |
( establish-operators ) | |
( setup ) | |
( solve ) | |
) |
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
#include <string.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#define BUFFER_SIZE 5 | |
struct reqdata | |
{ | |
char *data; | |
size_t len; |
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
#include <stdio.h> | |
#include <errno.h> | |
int main(int argc, char **argv) | |
{ | |
if (argc == 1) return 0; | |
if (argc == 2) { | |
char *filename = argv[1]; | |
FILE *fp = fopen(filename, "r"); | |
if (!fp) { |