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
"""A simple implementation of a greedy transition-based parser. Released under BSD license.""" | |
from os import path | |
import os | |
import sys | |
from collections import defaultdict | |
import random | |
import time | |
import pickle | |
SHIFT = 0; RIGHT = 1; LEFT = 2; |
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
#!/bin/bash | |
RESET="\e[0m" | |
BLACK="\e[0;30m" | |
RED="\e[0;31m" | |
GREEN="\e[0;32m" | |
YELLOW="\e[0;33m" | |
BLUE="\e[0;34m" | |
MAGENTA="\e[0;35m" | |
CYAN="\e[0;36m" |
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
;simple inference engine, using bruteforce propagation of modus ponens | |
;if the fact matches given clause (using supplied map of bindings), | |
;returns a map of established bindings, else returns false | |
(defn match | |
([clause fact] (match clause fact {})) | |
([clause fact bnds] | |
(let [[cls & clsR] clause, [fct & fctR] fact] | |
(cond (contains? #{:not=} cls) {:__special__ clause} | |
(= clause fact) bnds |
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
# Display chart of programming languages recognized by GitHub, sorted by their popularity. | |
# Be patient, it takes about one minute to complete on a good internet connection. | |
for i in `curl -s "https://github.com/languages" | grep -io "/languages/[^\"]*" | sort | uniq`; do curl -s "https://github.com$i" | grep "<h1>.*</h1>" | sed 's/the most/#1/g' | sed 's/.*<h1>\(.*\) <em>.*#\([0-9]*\).*/\2 \1/g'; done | sort -n |
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
able | |
about | |
above | |
abst | |
accordance | |
according | |
accordingly | |
across | |
act | |
actually |
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
Rozhovor v kancelárii. | |
"Čaf. Workuje to?" | |
"No čau, už si tu? Nie, zatiaľ sa mi to nepodarilo rozbehať." | |
"Okej, tak sa logofni, ja sa na to luknem." | |
"Inak júzujem tvoju stoličku, neva? Len si toto sejvnem a hneď ti ju ritarnem. Aj tak to musím ísť dať sajnúť hedovi." | |
"Kľudne si ju nechaj, tejknem si tamtú." | |
"Ako chceš, ja už idem za hedom, už si môžeš tejknúť svoju." | |
U šéfa: | |
"Šéfko, sajneš mi túto invojsu? Vendor ma už obháňa, že sme overďjú." |
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
;; outlet code for implementing traditional macro expansion | |
;; macros | |
(define (expand form) | |
(cond | |
((variable? form) form) | |
((literal? form) form) | |
((macro? (car form)) | |
(expand ((macro-function (car form)) form))) |
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
;Lisp in Lisp in Golomb forests. Includes use of linked lists. | |
;Based on Paul Graham's version of McCarthy's paper and code. | |
;Uses only eq, cond, atom, quote, cons, car, and cdr. | |
(defun null. (x) | |
(eq x '())) | |
(defun and. (x y) | |
(cond (x | |
(cond (y 't) |
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
################ Lispy: Scheme Interpreter in Python | |
## (c) Peter Norvig, 2010; See http://norvig.com/lispy.html | |
################ Symbol, Env classes | |
from __future__ import division | |
Symbol = 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
;source: http://ideone.com/lEx0T | |
;explanation: http://stackoverflow.com/a/3685147 | |
(defun null. (x) | |
(eq x '())) | |
(defun and. (x y) | |
(cond (x (cond (y 't) ('t '()))) | |
('t '()))) |
OlderNewer