From 3f01ed5014c8761a9e894f0845bd3634e26e18ff Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Wed, 16 Jul 2014 15:34:24 +0200 Subject: [PATCH] Add a `Botsbuildbots` function A tribute to Portal 2, this function will return an infinite list of the contents of the AUTHORS file on GitHub master (assuming requests is installed). Except, the macro does this, the function never gets called, it is purely there for tribute reasons. Signed-off-by: Gergely Nagy --- hy/core/language.hy | 5 ++++- hy/core/macros.hy | 12 ++++++++++++ requirements-travis.txt | 2 ++ tests/native_tests/native_macros.hy | 3 +++ 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/hy/core/language.hy b/hy/core/language.hy index e81d8cd..91cd990 100644 --- a/hy/core/language.hy +++ b/hy/core/language.hy @@ -352,7 +352,10 @@ parsed) -(def *exports* '[butlast calling-module-name coll? cons cons? cycle +(defun Botsbuildbots () (Botsbuildbots)) + +(def *exports* '[Botsbuildbots + butlast calling-module-name coll? cons cons? cycle dec distinct disassemble drop drop-while empty? even? every? first filter filterfalse flatten float? gensym identity inc input instance? integer integer? integer-char? interleave diff --git a/hy/core/macros.hy b/hy/core/macros.hy index c6071ba..58ac4b5 100644 --- a/hy/core/macros.hy +++ b/hy/core/macros.hy @@ -198,3 +198,15 @@ (.append ret `(setv ~name ~main))) ret)) + +(defmacro Botsbuildbots [] + "Build bots, repeatedly.^W^W^WPrint the AUTHORS, forever." + `(try + (do + (import [requests]) + + (let [[r (requests.get + "https://raw.githubusercontent.com/hylang/hy/master/AUTHORS")]] + (repeat r.text))) + (catch [e ImportError] + (repeat "Botsbuildbots requires `requests' to function.")))) diff --git a/requirements-travis.txt b/requirements-travis.txt index 80be0ce..9216e4f 100644 --- a/requirements-travis.txt +++ b/requirements-travis.txt @@ -1,3 +1,5 @@ +# for Botsbuildbots +requests # code quality flake8 coverage diff --git a/tests/native_tests/native_macros.hy b/tests/native_tests/native_macros.hy index fb2879c..408ca6c 100644 --- a/tests/native_tests/native_macros.hy +++ b/tests/native_tests/native_macros.hy @@ -214,3 +214,6 @@ (assert (= (tda-a1) :bazinga)) (assert (= (tda-a2) :bazinga)) (assert (= tda-main tda-a1 tda-a2))) + +(defn test-botsbuildbots [] + (assert (> (len (first (Botsbuildbots))) 50)))