;; example: (write (A-Z :start (+ 65 1) :end 87))
(defmacro A-Z (&key (start 65) (end 90))
(let* ((s-start (gensym))
(s-end (gensym))
(s-start start)
(s-end end))
`(loop for i from ,s-start to ,s-end
collect (code-char i)))) (defmacro A-Z (&key (start 65) (end 90))
(let ((s-start (gensym))
(s-end (gensym)))
`(let ((,s-start ,start)
(,s-end ,end))
(loop for i from ,s-start to ,s-end
collect (code-char i))))) (defun prime-p (n)
"判读n是否为素数"
(when (> n 1)
(do ((i 2 (1+ i)))
((= i n) t)
(when (zerop (mod n i))
(return nil))))) (defun typeof (obj)
"return the type of OBJ"
(typecase obj
(list 'list)
(number 'number)
(array 'array)
(function 'function)
(string 'string))) (defun our-filter (lst fn)
;; 这个过滤器感觉更 remove差不多
(let ((res nil))
(dolist (el lst)
(let ((is (funcall fn el)))
(if (not is) (push el res))))
(nreverse res))) (defun _sort (lst)
;;; 这是一个默认从小到大的排序函数
;;; > (setf a '(1 3 2))
;;; (1 3 2)
;;; > (_sort a)
;;; (1 2 3)
;;; > a
;;; (1 2 3)
(let ((len (length lst)))
(do ( (i 0 (+ i 1)) ) ( (not (< i len)) )
(do ( (j 0 (+ j 1)) ) ( (not (< j (- len 1 i))) )
(let (
(a (nth j lst))
(b (nth (+ j 1) lst))
)
(and (> a b)
(setf (nth (+ j 1) lst) a
(nth j lst) b
)))))) lst) (defun distinct (lst)
;;; 去除重复数据
;;; > (distinct '(1 2 3 2 1 6))
;;; (1 2 3 6)
(let ((res '()))
(dolist (el lst)
(if (not (member el res))
(setf res (append res (cons el nil)))
))
res)) (defun our-push (lst &rest addData)
;; 返回新的lst
;; > (our-push '(1 23) 'name "hello" '(a bc))
;; (1 23 NAME "hello" (A BC))
(dolist (el addData)
(setf lst (append lst (cons el nil))))
lst) (defun our-length (lst)
;;; 这个函数返回一个lst的长度
(if (null lst)
0
(+ 1 (our-length (cdr lst)))
)) (defun our-qa ()
;;; 一个询问1+1等于几的函数
(format t "1+1= ")
(let ((a (read)))
(if (and (numberp a) (= a 2))
'yes
(our-qa)
)
)) (defun null-list (lst)
;;; 若果是空表返回 t
(if (and (listp lst) (null lst))
t)) (defun our+ (numberlist)
;;; 这个函数会对 一个全是数字的列表进行求和
;;;> (our+ '(1 2 3 "233"))
;;;6
(let ( (firstNumber (car numberlist)) )
(if (or (null numberlist) (null (numberp firstNumber)))
0
(+ firstNumber (our+ (cdr numberlist)))
)
)
)

clisp的一些function的更多相关文章

  1. 通过百度echarts实现数据图表展示功能

    现在我们在工作中,在开发中都会或多或少的用到图表统计数据显示给用户.通过图表可以很直观的,直接的将数据呈现出来.这里我就介绍说一下利用百度开源的echarts图表技术实现的具体功能. 1.对于不太理解 ...

  2. jsp中出现onclick函数提示Cannot return from outside a function or method

    在使用Myeclipse10部署完项目后,原先不出错的项目,会有红色的叉叉,JSP页面会提示onclick函数错误 Cannot return from outside a function or m ...

  3. JavaScript function函数种类

    本篇主要介绍普通函数.匿名函数.闭包函数 目录 1. 普通函数:介绍普通函数的特性:同名覆盖.arguments对象.默认返回值等. 2. 匿名函数:介绍匿名函数的特性:变量匿名函数.无名称匿名函数. ...

  4. 在ubuntu16.10 PHP测试连接MySQL中出现Call to undefined function: mysql_connect()

    1.问题: 测试php7.0 链接mysql数据库的时候发生错误: Fatal error: Uncaught Error: Call to undefined function mysqli_con ...

  5. jquery中的$(document).ready(function() {});

    当文档载入时执行function函数里的代码, 这部分代码主要声明,页面加载后 "监听事件" 的方法.例如: $(document).ready( $("a") ...

  6. Function.prototype.toString 的使用技巧

    Function.prototype.toString这个原型方法可以帮助你获得函数的源代码, 比如: function hello ( msg ){ console.log("hello& ...

  7. 转:ORA-15186: ASMLIB error function = [asm_open], error = [1], 2009-05-24 13:57:38

    转:ORA-15186: ASMLIB error function = [asm_open], error = [1], 2009-05-24 13:57:38http://space.itpub. ...

  8. [Xamarin] 透過Native Code呼叫 JavaScript function (转帖)

    今天我們來聊聊關於如何使用WebView 中的Javascript 來呼叫 Native Code 的部分 首先,你得先來看看這篇[Xamarin] 使用Webview 來做APP因為這篇文章至少講解 ...

  9. Oracle数据库自动备份SQL文本:Procedure存储过程,View视图,Function函数,Trigger触发器,Sequence序列号等

    功能:备份存储过程,视图,函数触发器,Sequence序列号等准备工作:--1.创建文件夹 :'E:/OracleBackUp/ProcBack';--文本存放的路径--2.执行:create or ...

随机推荐

  1. Redis击穿、穿透、雪崩产生原因以及解决思路

    击穿 大家都知道,计算机的瓶颈之一就是IO,为了解决内存与磁盘速度不匹配的问题,产生了缓存,将一些热点数据放在内存中,随用随取,降低连接到数据库的请求链接,避免数据库挂掉.需要注意的是,无论是击穿还是 ...

  2. 题解 P3833 【[SHOI2012]魔法树】

    题目 直通车 很显然这是个树刨的板子,树上链查询和子树查询 注意: 1.这个点的树根为 0 而不是 1 所以注意读图时点标号 +1 就解决了 2.注意数据范围\(2^{32}\) 然后板子就能过了 n ...

  3. 小白的springboot之路(十九)、集成swagger(com.spring4all篇)

    0-前言 集成swagger,有两种方式: 一种在前面已经介绍过了,直接集成官方的springfox-swagger2的方式,这种方式需要在配置类中配置 第二种方式是这里要介绍的方式,国人写的com. ...

  4. PA防火墙抓包结果显示重传(re-transmission)

    问题起因: 部分内网服务器调用外网站点抓取图片时出现缓慢及超时现象. 由于是由内向外方向的访问,且通过的应用层设备只有防火墙:而且用其他网段测试机测试的时候发现并没有上述访问缓慢或超时. 从防火墙抓包 ...

  5. 秒啊,速来get这9个jupyter实用技巧

    1 简介 jupyter notebook与jupyter lab作为广受欢迎的ide,尤其适合开展数据分析相关工作,而掌握它们相关的一些实用技巧,势必会大大提升日常工作效率.而今天我就来给大家介绍9 ...

  6. 【uva 1153】Keep the Customer Satisfied(算法效率--贪心+优先队列)

    题意:有N个工作,已知每个工作需要的时间和截止时间.要求所有工作穿行完成,第一项任务开始的时间不早于时刻0.问最多能完成多少个工作.(N≤800000) 解法:贪心.可以模型化题目为:已知N个任务的长 ...

  7. codeforces 630K Indivisibility (容斥原理)

    IT City company developing computer games decided to upgrade its way to reward its employees. Now it ...

  8. hdu5414 CRB and String

    Problem Description CRB has two strings s and t. In each step, CRB can select arbitrary character c  ...

  9. Uva 12436 Rip Van Winkle's Code

    Rip Van Winkle was fed up with everything except programming. One day he found a problem whichrequir ...

  10. WPF 无法对元素“TextBox”设置 Name 特性值“TB2”

    错误信息 无法对元素"TextBox"设置 Name 特性值"TB2"."TextBox"在元素"UserControl1&quo ...