diff --git a/eg/appengine/.gitignore b/eg/appengine/.gitignore deleted file mode 100644 index 0a764a4..0000000 --- a/eg/appengine/.gitignore +++ /dev/null @@ -1 +0,0 @@ -env diff --git a/eg/appengine/README.md b/eg/appengine/README.md deleted file mode 100644 index 679fa7a..0000000 --- a/eg/appengine/README.md +++ /dev/null @@ -1,23 +0,0 @@ -App Engine skeleton for hylang -============================== - -# Demo - -[proppy-hy.appspot.com](https://proppy-hy.appspot.com) -[proppy-hy.appspot.com/paultag](https://proppy-hy.appspot.com/paultag) - - -# Setup -``` -pip install -r requirements.txt -t env -``` - -# Run locally -``` -dev_appserver.py . -``` - -# Deploy -``` -appcfg.py -a ${APPID} --oauth2 update . -``` diff --git a/eg/appengine/app.yaml b/eg/appengine/app.yaml deleted file mode 100644 index cfe79b6..0000000 --- a/eg/appengine/app.yaml +++ /dev/null @@ -1,13 +0,0 @@ -application: hy-sample -version: 1 -runtime: python27 -api_version: 1 -threadsafe: yes - -handlers: -- url: /favicon\.ico - static_files: favicon.ico - upload: favicon\.ico - -- url: .* - script: main.__hymain__.app diff --git a/eg/appengine/appengine_config.py b/eg/appengine/appengine_config.py deleted file mode 100644 index 7b2bb42..0000000 --- a/eg/appengine/appengine_config.py +++ /dev/null @@ -1,3 +0,0 @@ -import os.path -import sys -sys.path.insert(0, os.path.abspath('env')) diff --git a/eg/appengine/main.hy b/eg/appengine/main.hy deleted file mode 100644 index 8324881..0000000 --- a/eg/appengine/main.hy +++ /dev/null @@ -1,7 +0,0 @@ -(require hy.contrib.meth) -(import [flask [Flask redirect]]) - -(def app (Flask __name__)) - -(route hello "/" [name] (.format "(hello \"{0}!\")" name)) -(route root "/" [] (redirect "/hyne")) diff --git a/eg/appengine/main.py b/eg/appengine/main.py deleted file mode 100644 index 4eff14e..0000000 --- a/eg/appengine/main.py +++ /dev/null @@ -1,2 +0,0 @@ -from hy.importer import import_file_to_module -__hymain__ = import_file_to_module('__hymain__', 'main.hy') diff --git a/eg/appengine/requirements.txt b/eg/appengine/requirements.txt deleted file mode 100644 index bf177c9..0000000 --- a/eg/appengine/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -Flask -hy==0.9.10 # master is broken because of rply diff --git a/eg/clint/clint-progress.hy b/eg/clint/clint-progress.hy deleted file mode 100644 index 4d247f1..0000000 --- a/eg/clint/clint-progress.hy +++ /dev/null @@ -1,6 +0,0 @@ -(import [clint.textui [progress]] - [time [sleep]] - [random [random]]) - -(for [x (.bar progress (range 100))] - (sleep (* (random) 0.1))) diff --git a/eg/curry/ski.hy b/eg/curry/ski.hy deleted file mode 100644 index c5fdffc..0000000 --- a/eg/curry/ski.hy +++ /dev/null @@ -1,12 +0,0 @@ -(require hy.contrib.curry) - - -(defnc s [x y z] ((x z) (y z))) ; λxyz.xz(yz) -(defnc k [x] (fn [y] x)) ; λx.λy.x -(defnc i [x] x) ;; λx.x - -(defnc succ [n] (+ n 1)) - - -(print (((((s ((((k s) k) i) i)) (i i)) ((i (i i)) - ((((k s) i) ((s (k s)) k)) i))) succ) 0)) diff --git a/eg/debian/parse-rfc822.hy b/eg/debian/parse-rfc822.hy deleted file mode 100644 index 3ba7de9..0000000 --- a/eg/debian/parse-rfc822.hy +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env hy -;; Copyright (c) Paul R. Tagliamonte , 2013 under the terms -;; of the Expat license, a copy of which you have should have received with -;; the source. - - -(import sys) - - -(defn parse-rfc822-file [path] - "Parse an RFC822 file" - (with-as (open path "r") fd - (parse-rfc822-stream fd))) - - -(defn parse-rfc822-stream [fd] - "Parse an RFC822 stream" - (setv bits {}) - (setv key None) - (for [line fd] - (if (in ":" line) - (do (setv line (.split line ":" 1)) - (setv key (.strip (get line 0))) - (setv val (.strip (get line 1))) - (assoc bits key val)) - (do - (if (= (.strip line) ".") - (assoc bits key (+ (get bits key) "\n")) - (assoc bits key (+ (get bits key) "\n" (.strip line))))))) - bits) - - -(setv block (parse-rfc822-file (get sys.argv 1))) -(setv source (get block "Source")) -(print source "is a(n)" (get block "Description")) - - -(import [sh [apt-cache]]) -(setv archive-block (parse-rfc822-stream (.show apt-cache source))) -(print "The archive has version" (get archive-block "Version") "of" source) diff --git a/eg/flask/meth_example.hy b/eg/flask/meth_example.hy deleted file mode 100644 index 4df70d7..0000000 --- a/eg/flask/meth_example.hy +++ /dev/null @@ -1,27 +0,0 @@ -;;; Simple Flask application -;;; -;;; Requires to have Flask installed -;;; -;;; You can test it via: -;;; -;;; $ curl 127.0.0.1:5151 -;;; $ curl -X POST 127.0.0.1:5151/post -;;; $ curl -X POST 127.0.0.1:5151/both -;;; $ curl 127.0.0.1:5151/both - -(import [flask [Flask]]) - -(require hy.contrib.meth) - -(setv app (Flask "__main__")) - -(route get-index "/" [] - (str "Hy world!")) - -(post-route post-index "/post" [] - (str "Hy post world!")) - -(route-with-methods both-index "/both" ["GET" "POST"] [] - (str "Hy to both worlds!")) - -(apply app.run [] {"port" 5151}) diff --git a/eg/gevent/sockets/socket-server.hy b/eg/gevent/sockets/socket-server.hy deleted file mode 100644 index b80289f..0000000 --- a/eg/gevent/sockets/socket-server.hy +++ /dev/null @@ -1,11 +0,0 @@ -(import [gevent.server [StreamServer]]) - - -(defn handle [socket address] - (.send socket "Hello from Lisp!\n") - (for [x (range 5)] (.send socket (+ (str x) "\n"))) - (.close socket)) - - -(setv server (StreamServer (, "127.0.0.1" 5000) handle)) -(.serve-forever server) diff --git a/eg/lxml/parse-tumblr.hy b/eg/lxml/parse-tumblr.hy deleted file mode 100644 index 3b513a4..0000000 --- a/eg/lxml/parse-tumblr.hy +++ /dev/null @@ -1,25 +0,0 @@ -;;; Hy tumblr printer. -;;; Copyright (c) Paul R. Tagliamonte, 2013, MIT/Expat license. - - -(import [lxml [etree]] - [sys [argv]]) - -(try - (import [urllib.request [urlopen]]) - (except [ImportError] - (import [urllib2 [urlopen]]))) - -(defn get-rss-feed-name [tumblr] - (.format "http://{0}.tumblr.com/rss" tumblr)) - -(defn get-rss-feed [tumblr] - (.parse etree (urlopen (get-rss-feed-name tumblr)))) - -(defn print-posts [tumblr] - (for [post (.xpath (get-rss-feed tumblr) "//item/title")] - (print post.text))) - -(if (cut argv 2) - (print-posts (get argv 2)) - (print-posts "this-plt-life")) diff --git a/eg/python3/futures/hello-world.hy b/eg/python3/futures/hello-world.hy deleted file mode 100644 index 99f691f..0000000 --- a/eg/python3/futures/hello-world.hy +++ /dev/null @@ -1,11 +0,0 @@ -(import [concurrent.futures [ThreadPoolExecutor as-completed]] - [random [randint]] - [sh [sleep]]) - -(defn task-to-do [] (sleep (randint 1 5))) - - -(with-as (ThreadPoolExecutor 10) executor - (setv jobs (list-comp (.submit executor task-to-do) (x (range 0 10)))) - (for [future (as-completed jobs)] - (.result future))) diff --git a/eg/rpython/.gitignore b/eg/rpython/.gitignore deleted file mode 100644 index 24e1a04..0000000 --- a/eg/rpython/.gitignore +++ /dev/null @@ -1 +0,0 @@ -target-c diff --git a/eg/rpython/Makefile b/eg/rpython/Makefile deleted file mode 100644 index 6910794..0000000 --- a/eg/rpython/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -RPY_WRAP = python -m hy -RPY_FLAGS = -O2 -RPY = ~/pypy/rpython/bin/rpython - -all: clean build - -clear: - @clear - -clean: - rm -f target-c - -build: - $(RPY_WRAP) $(RPY) $(RPY_FLAGS) target.py diff --git a/eg/rpython/THANKS b/eg/rpython/THANKS deleted file mode 100644 index e19a936..0000000 --- a/eg/rpython/THANKS +++ /dev/null @@ -1,2 +0,0 @@ -Thanks so much for Romain Guillebert for sitting down and hacking -this out with me. A true hacker in every sense of the word. Thank you! diff --git a/eg/rpython/target.py b/eg/rpython/target.py deleted file mode 100644 index 0817bbf..0000000 --- a/eg/rpython/target.py +++ /dev/null @@ -1,15 +0,0 @@ -import hy -import sys -import test - - -def entry_point(argv): - return test.main(argv) - - -def target(driver, args): - return entry_point, None - - -if __name__ == "__main__": - entry_point(sys.argv) diff --git a/eg/rpython/test.hy b/eg/rpython/test.hy deleted file mode 100644 index 7409a49..0000000 --- a/eg/rpython/test.hy +++ /dev/null @@ -1,12 +0,0 @@ -;; hello, rHy! - - -(defn fib [n] - (if (<= n 2) n - (+ (fib (- n 1)) (fib (- n 2))))) - - -(defn main [argv] - (for [x [1 2 3 4 5 6 7 8]] - (print (fib x))) - 0) diff --git a/eg/sh/tagwords.hy b/eg/sh/tagwords.hy deleted file mode 100644 index 16ae9bf..0000000 --- a/eg/sh/tagwords.hy +++ /dev/null @@ -1,5 +0,0 @@ -;; python-sh from hy - -(import [sh [cat grep]]) -(print "Words that end with `tag`:") -(print (-> (cat "/usr/share/dict/words") (grep "-E" "tag$"))) diff --git a/eg/sunlight/party-count.hy b/eg/sunlight/party-count.hy deleted file mode 100755 index d54feec..0000000 --- a/eg/sunlight/party-count.hy +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env hy -;; Copyright (c) Paul R. Tagliamonte , 2013 under the terms -;; of the Expat license, a copy of which you should have received with -;; the source. - -(import sys) -(import [sunlight [openstates]] - [collections [Counter]]) - - -(def *state* (get sys.argv 1)) - - -(defn get-legislators [state] - (apply openstates.legislators [] {"state" state})) - - -(defn get-party-breakdown [state] - (Counter (map - (lambda [x] (get x "party")) - (get-legislators state)))) - - -(print *state* "-" (get-party-breakdown *state*)) diff --git a/eg/twisted/get-page.hy b/eg/twisted/get-page.hy deleted file mode 100644 index 3f102be..0000000 --- a/eg/twisted/get-page.hy +++ /dev/null @@ -1,39 +0,0 @@ -;; To run this example, do the following: -;; $ hy get-page.hy http://docs.hylang.org/en/latest/ -;; -;; At which point, you should see output like this: -;; 2013-06-24 23:03:57-0700 [-] Log opened. -;; 2013-06-24 23:03:57-0700 [-] Starting factory -;; 2013-06-24 23:03:57-0700 [HTTPPageGetter,client] Byte count for the content of the HTTP page passed: 11835 -;; 2013-06-24 23:03:57-0700 [HTTPPageGetter,client] Preparing to stop reactor ... -;; 2013-06-24 23:03:57-0700 [HTTPPageGetter,client] Stopping factory -;; 2013-06-24 23:03:57-0700 [-] Main loop terminated. -(import sys) - -(import [twisted.web.client [getPage]] - [twisted.internet [reactor]] - [twisted.python [log]]) - -(defn get-page-size [result] - (print - (+ "Byte count for the content of the HTTP page passed: " - (str (len result))))) - -(defn log-error [err] - (log.msg err)) - -(defn finish [ignore] - (log.msg "Preparing to stop reactor ...") - (reactor.stop)) - -(defn get-page [url] - (let [d (getPage url)] - (d.addCallback get-page-size) - (d.addErrback log-error) - (d.addCallback finish))) - -(if (= __name__ "__main__") - (do - (log.startLogging sys.stdout) - (get-page (second sys.argv)) - (reactor.run)))