码迷,mamicode.com
首页 > 其他好文 > 详细

Skill art函数遍历字典

时间:2020-06-03 23:15:15      阅读:71      评论:0      收藏:0      [点我收藏+]

标签:logs   开头   com   alpha   each   skill   遍历字典   for   长度   

https://www.cnblogs.com/yeungchie/

  • code
procedure(ycartGo(length1)
	prog(()
		for(x 1 length1
			printf("\nTotal length : %d(%d)\n" x + 3 x)
			_ycart(x)
		)
		;return()
	)
)
procedure(_ycart(length)
	prog((alphabets Alphabets numbers keys begin end funcends funcend func)
		alphabets = list(
			"a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m"
			"n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z"
		)
		Alphabets = list(
			"A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M"
			"N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z"
		)
		;numbers = list("0" "1" "2" "3" "4" "5" "6" "7" "8" "9")
		keys = append(append(alphabets Alphabets) numbers)
		
		begin = ""
		end = ""
		for(x 0 length - 1
			begin = strcat(begin "foreach(key" sprintf(nil "%d " x) "keys ")
			end = strcat(end ")")
		)
		mid = "
			funcends = nil
			for(x 0 length - 1
				funcends = append1(funcends
					strcat(\"key\" sprintf(nil \"%d \" x))
				)
			)
			funcend = \"\"
			foreach(x funcends
				funcend = strcat(funcend evalstring(x))
			)
			func = stringToSymbol(strcat(\"art\" funcend))
			if(fboundp(func) then
				printf(\"I found it ! function - %s\\n\" func)
			)
		"
		evalstring(strcat(begin mid end))
	)
)
  • describe
  1. 用于遍历查找art开头的内置函数。
  2. ycartGo(length1),length1指定函数名art后需要查找的位数,从长度为0开始。
  3. _ycart(length),length指定函数名art后需要查找的位数,固定长度。
  • example
ycartGo(4)

Skill art函数遍历字典

标签:logs   开头   com   alpha   each   skill   遍历字典   for   长度   

原文地址:https://www.cnblogs.com/yeungchie/p/13040472.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!