问题是not=:
Clojure> (doc not=)
---------------------
Cloure.core/not=
([x] [x y] [x y & more])
Same as (not (= obj1 obj2))
Clojure> (not= [1 2 3] [1 2 3])
false
Clojure> (not= '(1 2 3) '(1 2 3))
false
Clojure> (not= #(1 2 3) #(1 2 3))
true
Run Code Online (Sandbox Code Playgroud)
任何建议表示赞赏!
函数"good-red"用于计算文件ssqHitNum.txt中的18个最高频率数.
(defun good-red ()
(let ((tab (make-hash-table)) (res '()) (nums) (sort-res))
(dotimes (i 33) (setf (gethash (+ i 1) tab) 0))
(with-open-file (stream "ssqHitNum.txt")
(loop :for line = (read-line stream nil)
:until (null line)
:do
(setq nums (butlast (str2lst (subseq line 6))))
(dolist (n nums) (incf (gethash n tab)))
))
(maphash #'(lambda (k v) (push (cons k v) res)) tab)
(setq sort-res (sort res #'> :key #'cdr))
;(print sort-res)
(subseq (mapcar #'car sort-res) 0 18)))
Run Code Online (Sandbox Code Playgroud)
$ head ssqHitNum.txt
10000 7 …Run Code Online (Sandbox Code Playgroud) (** adds an header option in the header option list*)
let add_headers header key value =
{ header with
headers = Http_headers.add key value header.headers }
Run Code Online (Sandbox Code Playgroud)
如何理解"带标题的标题......"?我想它用新标题"替换"header.headers.但是,传递的标题应该是不可变的,不应该吗?
祝商祺!
我想将以下OCaml类型(一个不平衡的二进制树)转换为Common Lisp,但作为一个CL新手,我不知道如何使用动态语言.
type 'a tree =
Leaf
| Node of 'a * 'a tree * 'a tree
Run Code Online (Sandbox Code Playgroud)
任何建议表示赞赏!
SBCL创建的stumpwm大于40 MB,这对于Window Manager来说太大了.C生产的DWM约为30K.
我们不需要一个完整的CL环境,我怎样才能让stumpwm更小?
真诚的!
解释用于eval haskell表达吗?如果是的话,我该如何使用它?
Language.Haskell.Interpreter> :t interpret
interpret :: (Data.Typeable.Internal.Typeable a, MonadInterpreter m) =>
String -> a -> m a
>interpret "1+1"
<interactive>:20:1:
Ambiguous type variable `m0' in the constraint:
(MonadInterpreter m0) arising from a use of `interpret'
Probable fix: add a type signature that fixes these type variable(s)
In the expression: interpret "1+1"
In an equation for `it': it = interpret "1+1"
Run Code Online (Sandbox Code Playgroud)
问候!
stopLoss函数导致以下错误:
Could not deduce (Text.Printf.PrintfType (m a0))
arising from the ambiguity check for `stopLoss'
from the context (Monad m,
Text.Printf.PrintfType (m b),
Text.Printf.PrintfType (m a))
bound by the inferred type for `stopLoss':
(Monad m, Text.Printf.PrintfType (m b),
Text.Printf.PrintfType (m a)) =>
Float -> Float -> Float -> m b
Possible fix:
add an instance declaration for (Text.Printf.PrintfType (m a0))
When checking that `stopLoss'
has the inferred type `forall (m :: * -> *) a b.
(Monad m, Text.Printf.PrintfType (m b), …Run Code Online (Sandbox Code Playgroud) 以下代码片段来自ocsigen源代码.我不理解用两个参数调用的"int_of_string":
try
let dppos = String.index ss':'
and len = String.length ss in
let host = String.sub ss 0 dppos
and port =
match String.sub ss (dppos+1) ((len - dppos) - 1) with
"*" -> None
| p -> Some (int_of_string "host" p)
in host, port
with
| Not_found -> ss, None
| Failure _ ->
raise (Config_file_error "bad port number")
Run Code Online (Sandbox Code Playgroud)
我在顶层测试它,它正常报告错误.
祝商祺!
如果是这样,我该如何更改以下代码:
(script-path (tbnl::enough-url (ppcre:regex-replace-all "\\\\" script-name "/") uri-prefix))
Run Code Online (Sandbox Code Playgroud)
谢谢!
以下代码可以工作,但无论我是否需要,我都要加载swank.
(ql:quickload :swank)
(defun swank ()
(swank:create-server :port 4005 :donot-close t))
Run Code Online (Sandbox Code Playgroud)
如果我将"(ql:quickload:swank)"移动到函数swank中,那么CL将无法找到包swank.
祝商祺!
以下是来自top命令:
size res
1127 *** 1 20 0 117M 2196K ttyin 0 0:00 0.00% gprolog
1149 *** 1 23 0 10700K 3728K ttyin 0 0:00 0.00% swipl
Run Code Online (Sandbox Code Playgroud)
它的RES是合理的,但与swipl相比,它的尺寸太大了.
操作系统是freebsd 9.0.
祝商祺!
common-lisp ×4
ocaml ×3
haskell ×2
clojure ×1
gnu-prolog ×1
hunchentoot ×1
prolog ×1
sbcl ×1
swank ×1