Common Lisp – assoc 函数的示例代码
2013-05-06 13:59
417 查看
;;ASSOC function searches supplied list for cons cell that have item as car part. Return value is the cell with key-value pair which key matched testing conditions, otherwise NIL. Default comparison operator is EQL. ;;Associative list, or for short alist, is a list with key-value pairs in cons cells. That is ((key1 . value1) (key2 . value2) ...) (assoc 'a '((a . 1) (b . 2) (c . 3))) => (A . 1) (assoc 'x '((a . 1) (b . 2) (c . 3))) => NIL (assoc 'b '((a . 1) (b . 2) (c . 3) (b . 4))) => (B . 2) (assoc "b" '(("a" . 1) ("b" . 2))) => NIL (assoc "b" '(("a" . 1) ("b" . 2)) :test #'equal) => ("b" . 2) (assoc 7 '((6 . a) (9 . b)) :key #'1+) => (6 . A) (assoc 5 nil) => NIL
Reference: http://jtra.cz/stuff/lisp/sclr/assoc.html
S.K.
相关文章推荐
- Common Lisp – destructuring-bind 函数的示例代码
- Common Lisp – eq, eql, equal, equalp 函数的示例代码
- Common Lisp, incf, decf, setf, setq, defparameter, defvar 等函数的示例代码
- ABAP--SAP的SYSTEM的函数列表和代码示例
- 使用C#调用存储过程,用函数合理组织代码,使程序更加的清晰(示例)
- MATLAB句柄相关函数和代码示例(设置美化图表属性)
- php分页函数示例代码分享
- 用PHP生成随机数的函数(代码示例)
- 信管14:虚函数示例代码二
- python利用dir函数查看类中所有成员函数示例代码
- 【Linux C代码分享二】UDP Socket示例程序:使用fgets函数获取屏幕输入
- ABAP--SAP的SYSTEM的函数列表和代码示例
- C调用Python函数相关代码示例剖析
- Python常见文件操作的函数示例代码
- js函数返回多个返回值的示例代码
- php指定函数参数默认值示例代码
- php指定函数参数默认值示例代码
- ABAP--SAP的SYSTEM的函数列表和代码示例
- JS中实现简单Formatter函数示例代码
- 2-驱动_加载函数_卸载函数_注册设备号_led驱动示例代码