File: hello.hy

package info (click to toggle)
hy 1.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,632 kB
  • sloc: python: 7,299; makefile: 38; sh: 27
file content (27 lines) | stat: -rwxr-xr-x 397 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env hy
(setv foobar (+ 2 2))
(setv [tim eric] ["jim" "derrick"])
(setv  alpha "a"  beta "b")

(sorted "abcBC"
  :key (fn [x] (.lower x)))

(defn test [a b [c "x"] #* d]
  [a b c d])

(lfor
  x (range 3)
  y (range 3)
  :if (= (+ x y) 3)
  (* x y))

(defmacro do-while [test #* body]
  `(do
    ~@body
    (while ~test
      ~@body)))

(setv x 0)
(do-while x
  (print "Printed once."))