Skip to content

Commit

Permalink
Merge pull request hylang#528 from bcj/patch-2
Browse files Browse the repository at this point in the history
and/or now short-circuit
  • Loading branch information
cwebber committed Mar 16, 2014
2 parents f63f7a9 + a210a67 commit fa69d80
Showing 1 changed file with 5 additions and 19 deletions.
24 changes: 5 additions & 19 deletions docs/language/api.rst
Expand Up @@ -151,20 +151,14 @@ case the first false value will be returned. Examples of usage:
=> (and True [] False True)
[]
.. note:: `and` shortcuts and stops evaluating parameters as soon as the first
false is encountered. However, in the current implementation of Hy
statements are executed as soon as they are converted to expressions.
The following two examples demonstrates the difference.
.. note::

`and` shortcuts and stops evaluating parameters as soon as the first
false is encountered.

.. code-block:: clj
=> (and False (print "hello"))
hello
False
=> (defn side-effects [x] (print "I can has" x) x)
=> (and (side-effects false) (side-effects 42))
I can has False
False
Expand Down Expand Up @@ -919,21 +913,13 @@ parameter will be returned.
1
.. note:: `or` shortcuts and stops evaluating parameters as soon as the first
true is encountered. However, in the current implementation of Hy
statements are executed as soon as they are converted to expressions.
The following two examples demonstrates the difference.
true is encountered.

.. code-block:: clj
=> (or True (print "hello"))
hello
True
=> (defn side-effects [x] (print "I can has" x) x)
=> (or (side-effects 42) (side-effects False))
I can has 42
42
print
-----
Expand Down

0 comments on commit fa69d80

Please sign in to comment.