mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 09:40:21 +00:00
Add Hy language.
Hy is a dialect of Lisp that’s embedded in Python.
This commit is contained in:
@@ -733,6 +733,13 @@ Haxe:
|
|||||||
extensions:
|
extensions:
|
||||||
- .hxsl
|
- .hxsl
|
||||||
|
|
||||||
|
Hy:
|
||||||
|
type: programming
|
||||||
|
lexer: Clojure
|
||||||
|
ace_mode: clojure
|
||||||
|
color: "#7891b1"
|
||||||
|
primary_extension: .hy
|
||||||
|
|
||||||
IDL:
|
IDL:
|
||||||
type: programming
|
type: programming
|
||||||
lexer: Text only
|
lexer: Text only
|
||||||
|
|||||||
9
samples/Hy/fibonacci.hy
Normal file
9
samples/Hy/fibonacci.hy
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
;; Fibonacci example in Hy.
|
||||||
|
|
||||||
|
(defn fib [n]
|
||||||
|
(if (<= n 2) n
|
||||||
|
(+ (fib (- n 1)) (fib (- n 2)))))
|
||||||
|
|
||||||
|
(if (= __name__ "__main__")
|
||||||
|
(for [x [1 2 3 4 5 6 7 8]]
|
||||||
|
(print (fib x))))
|
||||||
13
samples/Hy/hello-world.hy
Normal file
13
samples/Hy/hello-world.hy
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
;; The concurrent.futures example in Hy.
|
||||||
|
|
||||||
|
(import [concurrent.futures [ThreadPoolExecutor as-completed]]
|
||||||
|
[random [randint]]
|
||||||
|
[sh [sleep]])
|
||||||
|
|
||||||
|
(defn task-to-do []
|
||||||
|
(sleep (randint 1 5)))
|
||||||
|
|
||||||
|
(with-as (ThreadPoolExecutor 10) executor
|
||||||
|
(setv jobs (list-comp (.submit executor task-to-do) (x (range 0 10))))
|
||||||
|
(for (future (as-completed jobs))
|
||||||
|
(.result future)))
|
||||||
Reference in New Issue
Block a user