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
~ $ brew install clisp | |
==> Downloading http://ftp.gnu.org/pub/gnu/clisp/release/2.49/clisp-2.49.tar.bz2 | |
File already downloaded and cached to /Users/sholik/Library/Caches/Homebrew | |
==> ./configure --prefix=/usr/local/Cellar/clisp/2.49 --with-readline=yes | |
executing /private/tmp/homebrew-clisp-2.49-folP/clisp-2.49/src/configure --prefix=/usr/local/Cellar/clisp/2.49 --with-readline=yes | |
configure: creating cache config.cache | |
checking for a BSD-compatible install... /usr/bin/install -c | |
checking whether build environment is sane... yes | |
checking for a thread-safe mkdir -p... build-aux/install-sh -c -d | |
checking for gawk... no |
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
~ $ brew link libsigsegv | |
Linking /usr/local/Cellar/libsigsegv/2.8... 2 links created | |
~ $ brew install clisp | |
==> Downloading http://ftp.gnu.org/pub/gnu/clisp/release/2.49/clisp-2.49.tar.bz2 | |
File already downloaded and cached to /Users/sholik/Library/Caches/Homebrew | |
==> ./configure --prefix=/usr/local/Cellar/clisp/2.49 --with-readline=yes | |
==> ulimit -s 16384 && make | |
==> make check | |
==> make install | |
mkdir -p gllib |
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
#include "regex.h" | |
using namespace boost::xpressive; | |
struct regex_t { | |
sregex pattern; | |
}; | |
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
#include <string> | |
#include "regex.h" | |
/* | |
* Return a new string with all occurrences of 'from' replaced with 'to' | |
*/ | |
std::string replace_all(const std::string &str, const char *from, const char *to) | |
{ | |
std::string result(str); |
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
#include <string> | |
#include <iostream> | |
#include <assert.h> | |
std::string replace_all(const std::string &str, const char *from, const char *to) | |
{ | |
std::string result(str); | |
std::string::size_type | |
index = 0, | |
from_len = strlen(from), |
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
(defn merge-seqs | |
"Merges two sorted sequences into a single sorted sequence" | |
([left right] | |
(merge-seqs (list left right))) | |
([[left right]] | |
(loop [l left, r right, result []] | |
(let [lhead (first l), rhead (first r)] | |
(cond | |
(nil? lhead) (concat result r) | |
(nil? rhead) (concat result l) |
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
git ls-files | egrep '\.erl|\.ex[s]$' | xargs cat | sed '/^$/d' | wc -l |
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
# !!! | |
# This is an outdated version of the code. See https://gist.github.com/2783092. | |
defmodule Chat.Client do | |
# In all of the following functions 'server' stands for the server's pid | |
def join(server) do | |
send server, :join | |
end | |
def say(server, message) do |
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
defmodule With do | |
@doc """ | |
Provides a shortcut for multiple function invocations on the same module. | |
Example: | |
x = [1,2,3,4] | |
with List do | |
@append [x, @reverse x] | |
end |
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
defmodule Atomize do | |
@doc """ | |
Given an expression, replaces all variables with atoms and atoms with | |
variables. | |
For example, | |
a = 1; b = "string" | |
Atomize.invert {a, :a, {{b, :b}, [c, d]}} | |
#=> {:a, 1, {{:b, "string"}, [:c, :d]}} |
OlderNewer