Skip to content

Commit

Permalink
Merge pull request #9 from brandonwillard/recent-hy-updates
Browse files Browse the repository at this point in the history
Updates for compatibility with recent Hy changes
  • Loading branch information
algernon authored Aug 31, 2018
2 parents c8d14f5 + 782b05c commit a3e86d9
Show file tree
Hide file tree
Showing 26 changed files with 852 additions and 586 deletions.
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
language: python
python:
- "2.7"
- "3.3"
- "3.4"
- "pypy"
install: pip install -r requirements.txt --allow-all-external
- "3.5"
- "3.6"
- "pypy3.5"
install: pip install -r requirements.txt
script:
- nosetests
- python tests/bench.py
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ Example
(import [getpass [getuser]])
(defreader h [_] "#hy")
(defn lovesᵒ [u v] (≡ v #hy))
(deftag h [_] "#hy")
(defn lovesᵒ [u v] (≡ v #h y))
(run* [who what] (lovesᵒ who what)
(≡ who (getuser))
(≡ what #hy))
(≡ what #h y))
;; => [['algernon' '#hy']]
```

Expand Down
50 changes: 29 additions & 21 deletions adderall/bitnum.hy
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@
;; You should have received a copy of the GNU Lesser General Public
;; License along with this program. If not, see <http://www.gnu.org/licenses/>.

(import [adderall.dsl [*]])
(require adderall.dsl)
(import [adderall.dsl [*]]
[adderall.internal [*]])

(require [adderall.dsl [*]])
(require [adderall.internal [defn-alias]])


(defn-alias [nandᵒ nando] [x y r]
(condᵉ
Expand Down Expand Up @@ -65,7 +69,7 @@

(defn-alias [>1ᵒ >1o] [n]
(fresh [a ad dd]
( (list* a ad dd) n)))
( (cons a ad dd) n)))

(defn-alias [adderᵒ addero] [d n m r]
(condⁱ
Expand All @@ -83,15 +87,19 @@
[( [1] n) (gen-adderᵒ d n m r)]
[( [1] m) (>1ᵒ n) (>1ᵒ r)
(adderᵒ d [1] n r)]
[(>1ᵒ n) (gen-adderᵒ d n m r)]))
[(>1ᵒ n) (gen-adderᵒ d n m r)]
(else u#)))

(defn-alias [gen-adderᵒ gen-addero] [d n m r]
(fresh [a b c e x y z]
( (cons a x) n)
( (cons b y) m) (posᵒ y)
( (cons c z) r) (posᵒ z)
(full-adderᵒ d a b c e)
(adderᵒ e x y z)))
;; (allⁱ
(full-adderᵒ d a b c e)
(adderᵒ e x y z)
;; )
))


(defn-alias [+ᵒ +o] [n m k]
Expand All @@ -105,18 +113,18 @@
;; with leading underscores do not get automatically imported. (With
;; python2, we get mungling, and the function will start with a hy_
;; prefix, so we don't have that problem)
(if-python2
nil
(def __all__ ["nandᵒ" "nando"
"xorᵒ" "xoro"
"notᵒ" "noto"
"andᵒ" "ando"
"half_adderᵒ" "half_addero"
"full_adderᵒ" "full_addero"
"build_num"
"posᵒ" "poso"
">1ᵒ" ">1o"
"adderᵒ" "addero"
"gen_adderᵒ" "gen_addero"
"+ᵒ" "+o"
"_ᵒ" "_o"]))
#_(if-python2
None
(setv EXPORTS ["nandᵒ" "nando"
"xorᵒ" "xoro"
"notᵒ" "noto"
"andᵒ" "ando"
"half_adderᵒ" "half_addero"
"full_adderᵒ" "full_addero"
"build_num"
"posᵒ" "poso"
">1ᵒ" ">1o"
"adderᵒ" "addero"
"gen_adderᵒ" "gen_addero"
"+ᵒ" "+o"
"-ᵒ" "-o"]))
Loading

0 comments on commit a3e86d9

Please sign in to comment.