This file contains 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
Eshell V5.9.1 (abort with ^G) | |
% The Y combinator allows recursion to be defined as a set of rewrite rules without requiring | |
% native recursion support in the language. | |
c(y_comb_single). % takes single param | |
{ok,y_comb_single} | |
(y_comb_single:y2( | |
fun (F) -> | |
fun(0) -> 1; |
This file contains 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
Eshell V5.9.1 (abort with ^G) | |
1> c(mini_chat). | |
{ok,mini_chat} | |
2> mini_chat:start(). | |
true | |
3> Jane = spawn(mini_chat, user, ["Jane"]). | |
SYSTEM: Jane has joined the channel. | |
<0.42.0> | |
4> Zach = spawn(mini_chat, user, ["Zach"]). | |
SYSTEM: Zach has joined the channel. |
This file contains 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
(ns sudoku | |
(:refer-clojure :exclude [==]) | |
(:use clojure.core.logic)) | |
(defn get-square [rows x y] | |
(for [x (range x (+ x 3)) | |
y (range y (+ y 3))] | |
(get-in rows [x y]))) | |
(defn init [vars hints] |
This file contains 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
-module(mini_chat). | |
-compile(export_all). | |
-define(ACTIVE_OPTIONS, [{reuseaddr, true}]). | |
% Commands start with "/", char 47 | |
is_command(Str) -> hd(Str) =:= 47. | |
chatroom(Users) -> | |
process_flag(trap_exit, true), |
This file contains 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
from pprint import pprint | |
import random | |
import sys | |
def main(): | |
aircraft_carrier = [] | |
battle_ship = [] | |
submarine = [] | |
destroyer = [] |
This file contains 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
push = (element) -> (stack) -> | |
newStack = [element].concat stack | |
{value: element, stack: newStack} | |
pop = (stack) -> | |
element = stack[0] | |
newStack = stack.slice 1 | |
{value: element, stack: newStack} | |
bind = (stackOperation, continuation) -> (stack) -> |
NewerOlder