请输入您要查询的百科知识:

 

词条 Hy
释义

  1. Example code

  2. See also

  3. Notes

  4. References

  5. External links

{{About|the programming language Hy||HY (disambiguation){{!}}HY}}{{Infobox programming language
| name = Hy
| logo = Hy Cuddles.png
| logo caption = Hy logo - Cuddles the cuttlefish
| screenshot =
| screenshot caption =
| paradigm = Multi-paradigm: procedural, functional, object-oriented, meta, reflective, generic
| family = Lisp
| designer = Paul Tagliamonte
| developers = Core team
| released = {{Start date and age|2013|df=yes}}
| latest release version =
| latest release date =
| latest preview version = 0.15.0
| latest preview date = {{Start date and age|2018|09|11|df=yes}}
| typing =
| scope = lexical, optionally dynamic{{citation needed |date=July 2017}}
| programming language =
| platform = IA-32, x86-64
| operating system = Cross-platform
| license = MIT-style
| file ext = .hy
| file format =
| website = {{URL|hylang.org}}
| implementations =
| dialects =
| influenced by = Lisp, Kawa, Clojure, Common Lisp
| influenced =
}}Hy (alternately, Hylang) is a programming language, a dialect of the language Lisp designed to interact with the language Python by translating expressions into Python's abstract syntax tree (AST). Hy was introduced at Python Conference (PyCon) 2013 by Paul Tagliamonte.[1]

Similar to Kawa's and Clojure's mapping of s-expressions onto the Java virtual machine (JVM),[2] Hy is meant to operate as a transparent Lisp front end to Python's abstract syntax.[3] Lisp allows operating on code as data (metaprogramming). Thus, Hy can be used to write domain-specific languages.[4] Hy also allows Python libraries, including the standard library, to be imported and accessed alongside Hy code with a compiling[5] step converting the data structure of both into Python's AST.[6][7][8][9]

Example code

From the language documentation:[10]

=> (print "Hy!")

Hy!

=> (defn salutationsnm [name] (print (+ "Hy " name "!")))

=> (salutationsnm "YourName")

Hy YourName!

See also

  • Clojure
  • Kawa (Scheme implementation)

Notes

1. ^{{cite speech |title=PyCon lightning talk |last=Tagliamonte |first=Paul |date=2 April 2013 |location=Santa Clara |url=http://blog.pault.ag/day/2013/04/02 |access-date=2 September 2014 |event=Python Conference (PyCon)}}
2. ^{{cite news |last1=Turto |first1=Tuukka |title=Programming Can Be Fun with Hy |url=http://www.opensourceforu.com/2014/02/programming-can-fun-hy/ |access-date=2 September 2014 |work=Open Source For You |date=14 February 2014}}
3. ^{{cite web |last=Edge |first=Jake |title=Getting Hy on Python |url=https://lwn.net/Articles/596626/ |access-date=2 September 2014 |date=30 April 2014 |website=LWN.net}}
4. ^{{cite speech |title=Getting Hy on Python: How to implement a Lisp front-end to Python |last=Tagliamonte |first=Paul |date=11 April 2014 |location=Montreal |url=https://us.pycon.org/2014/schedule/presentation/192/ |access-date=2 September 2014 |event=PyCon}}
5. ^"Compiled" is a term which may apply to expressing Hy code in Python's AST or converting that AST into bytecode, the latter being dependent on the specific Python interpreter used and not Hy.
6. ^Hy is tested on Python 2.7, 3.4 through 3.6, and PyPy.
7. ^{{cite web |title=Hy Documentation |url=http://docs.hylang.org/en/stable/tutorial.html#hy-is-a-lisp-flavored-python |website=hylang.org |access-date=3 September 2014}}
8. ^{{cite book |last=Danjou |first=Julien |date=26 March 2014 |title=The Hacker's Guide to Python |url=https://books.google.com/books?id=B6nhAwAAQBAJ&pg=PT171 |chapter=The AST |pages=165–172}}
9. ^{{cite web |last=Kitchin |first=John |title=More on Hy and why I think it is a big deal |url=http://kitchingroup.cheme.cmu.edu/blog/2016/03/31/More-on-Hy-and-why-I-think-it-is-a-big-deal/ |website=The Kitchin Research Group |publisher=Carnegie Mellon University |access-date=19 September 2018 |date=31 March 2016}}
10. ^{{cite web |title=Quickstart |url=http://docs.hylang.org/en/stable/quickstart.html |website=Hylang.org |access-date=19 September 2018 |date=15 May 2018}}

References

External links

  • {{Official website|hylang.org}}
  • {{GitHub|hylang/hy}}
  • Documentation
  • [https://www.youtube.com/watch?v=AmMaN1AokTI Video of 2014 PyCon talk]
{{Lisp}}{{Lisp programming language}}

3 : Lisp (programming language)|Cross-platform free software|Lisp programming language family

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/9/22 6:46:59