Hy (lisp)
https://www.tutorialspoint.co...
case-insensitive
three types of elements are constants and always return their own value
Numbers; letter t, logical true; value nil, logical false, empty list
1958 (Lisp) -> 2020 (Hy)
Hy designed to interact with Python by translating expressions into Python's abstract syntax tree (AST)
(write-line "Hello World") (write (+ 7 9 11)) # 7 + 9 + 11 (write (+ (* (/ 9 5) 60) 32)) # ((9/5)*60)+32
basic building blocks
atom: numbers and special characters
123008907 abc123
list: a sequence of atoms and/or other lists enclosed in parentheses
(a ( a b c) d e fgh)
string: a group of characters enclosed in double quotation marks
" I am a string"semicolon symbol (;) is used for indicating a comment line
case-insensitive
three types of elements are constants and always return their own value
Numbers; letter t, logical true; value nil, logical false, empty list
data types can be categorized as
Scalar types - for example, number types, characters, symbols etc Data structures - for example, lists, vectors, bit-vectors, and strings
macro is a function
(defmacro setTo10(num) (setq num 10)(print num)) (setq x 25) (print x) (setTo10 x)
Global variables are generally declared using the defvar construct.
(defvar x 234) (write x)
let and prog for creating local variables.
(prog ((x '(a b c))(y '(1 2 3))(z '(p q 10))) (format t "x = ~a y = ~a z = ~a" x y z)) # x = (A B C) y = (1 2 3) z = (P Q 10)
相关推荐
dragonzht 2020-06-17
huangyufeng0 2020-04-18
xzkjgw 2020-03-06
zhongranxu 2019-06-26
郭岚 2019-06-26
firstblood00 2019-06-26
jiangliu 2019-06-26
huangyufeng0 2019-06-26
Godfavoredone 2019-06-21
zgljl0 2019-06-21
firstblood00 2014-07-23
guugle00 2018-11-22
tygsfe 2018-10-18
菜鸟学习PHP 2018-11-21
codersh 2018-08-21
huakai 2018-03-09
LeviHuang 2016-12-20
ITlinuxP 2012-10-16
看我看我 2012-06-21