Some small doc fixes

This cleans up a number of doc warnings, including a bad
underline for zero?

While there, added a nil? function to match up with the
new nil is None.

Also un-hid myself from coreteam.
This commit is contained in:
Bob Tolbert 2013-12-31 16:14:05 -07:00
parent dfbdbdfb73
commit 032200bcb4
6 changed files with 56 additions and 14 deletions

View File

@ -67,7 +67,7 @@ release = hy.__version__
# List of patterns, relative to source directory, that match files and # List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files. # directories to ignore when looking for source files.
exclude_patterns = ['_build'] exclude_patterns = ['_build', 'coreteam.rst']
# The reST default role (used for this markup: `text`) to use for all documents. # The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None #default_role = None

View File

@ -19,17 +19,17 @@ Meet our mascot, "Cuddles":
.. image:: http://fc07.deviantart.net/fs70/i/2013/138/f/0/cuddles_the_hacker_by_doctormo-d65l7lq.png .. image:: http://fc07.deviantart.net/fs70/i/2013/138/f/0/cuddles_the_hacker_by_doctormo-d65l7lq.png
:alt: Paul riding cuddles into the distance :alt: Paul riding cuddles into the distance
.. Our old ascii art mascot version
.. Retained as an easter egg for those who read the docs via .rst!
.. ..
.. LET'S CUDDLEFISH Our old ascii art mascot version
.. ______ Retained as an easter egg for those who read the docs via .rst!
.. _.----'#' # '
.. ,' #' ,# ; LET'S CUDDLEFISH
.. (' (w) _,-'_/ ______
.. /// / /'.____.' _.----'#' # '
.. \|\||/ ,' #' ,# ;
(' (w) _,-'_/
/// / /'.____.'
\|\||/
You can try Hy `in your browser <https://try-hy.appspot.com>`_. You can try Hy `in your browser <https://try-hy.appspot.com>`_.

View File

@ -242,6 +242,36 @@ Raises ``TypeError`` if ``(not (numeric? x))``.
=> (neg? 0) => (neg? 0)
False False
.. _nil?-fn:
nil?
-----
Usage: ``(nil? x)``
Return True if x is nil/None.
.. code-block:: clojure
=> (nil? nil)
True
=> (nil? None)
True
=> (nil? 0)
False
=> (setf x nil)
=> (nil? x)
True
=> ;; list.append always returns None
=> (nil? (.append [1 2 3] 4))
True
.. _none?-fn: .. _none?-fn:
none? none?
@ -397,7 +427,7 @@ Return True if x is a string.
.. _zero?-fn: .. _zero?-fn:
zero? zero?
---- -----
Usage: ``(zero? x)`` Usage: ``(zero? x)``

View File

@ -160,6 +160,10 @@
"Return true if x is None" "Return true if x is None"
(is x None)) (is x None))
(defn nil? [x]
"Return true if x is nil (None)"
(is x None))
(defn numeric? [x] (defn numeric? [x]
(import numbers) (import numbers)
(instance? numbers.Number x)) (instance? numbers.Number x))
@ -253,5 +257,5 @@
(def *exports* '[cycle dec distinct drop drop-while empty? even? filter flatten (def *exports* '[cycle dec distinct drop drop-while empty? even? filter flatten
float? gensym float? gensym
inc instance? integer integer? iterable? iterate iterator? neg? inc instance? integer integer? iterable? iterate iterator? neg?
none? nth numeric? odd? pos? remove repeat repeatedly second nil? none? nth numeric? odd? pos? remove repeat repeatedly second
string string? take take-nth take-while zero?]) string string? take take-nth take-while zero?])

View File

@ -19,7 +19,6 @@ MISSING_NAMES = {
# an owner of the organization. # an owner of the organization.
CONCEALED_MEMBERS = [ CONCEALED_MEMBERS = [
('aldeka', 'Karen Rustad'), ('aldeka', 'Karen Rustad'),
('rwtolbert', 'Bob Tolbert'),
('tuturto', 'Tuukka Turto'), ('tuturto', 'Tuukka Turto'),
] ]

View File

@ -293,6 +293,15 @@
(assert-false (none? 0)) (assert-false (none? 0))
(assert-false (none? ""))) (assert-false (none? "")))
(defn test-nil? []
"NATIVE: testing for `is nil`"
(assert-true (nil? nil))
(assert-true (nil? None))
(setv f nil)
(assert-true (nil? f))
(assert-false (nil? 0))
(assert-false (nil? "")))
(defn test-nth [] (defn test-nth []
"NATIVE: testing the nth function" "NATIVE: testing the nth function"
(assert-equal 2 (nth [1 2 4 7] 1)) (assert-equal 2 (nth [1 2 4 7] 1))