<head>...</head>当我按下Ctrl + Shift + F时,我需要Eclipse(Kepler)缩进html标签
目前,这个:
<html>
<head>
<title>Insert title here</title>
<script type="text/javascript">
function func() {
console.log("Hello world");
}
</script>
</head>
<body>
<p onclick="func()">Some text</p>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
当我按下组合键时变成这个.
<html>
<head>
<title>Insert title here</title>
<script type="text/javascript">
function func() {
console.log("Hello world");
}
</script>
</head>
<body>
<p onclick="func()">Some text</p>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我需要<head>...</head>缩进内部的所有内容以及其中的所有标记<html>...</html>.
理想情况下这样:
function func() {
console.log("Hello world");
}Run Code Online (Sandbox Code Playgroud)
<html>
<head>
<title>Insert title here</title>
<script type="text/javascript">
/* function */
</script>
</head>
<body>
<p onclick="func()">Some text</p> …Run Code Online (Sandbox Code Playgroud)我需要帮助关闭此功能,如果可能的话,从交互模式或我会发疯.如果你想要这个值,REPL会在每个表达式之前坚持等号.我发现这非常刺激和不直观.更糟糕的是,如果你错误地忘记了等号,它会带你进入这个辅助提示,只有输入一个会导致错误的表达式才能退出.
*** str="This is some string"
*** str
>>
>>
>> =
>>
>> =str
stdin:6: unexpected symbol near '='
*** =str
This is some string
*** #str
stdin:1: unexpected symbol near '#'
*** =#str
19
***
*** 545+8
stdin:1: unexpected symbol near '545'
*** =545+8
553
***
Run Code Online (Sandbox Code Playgroud)
我需要一个使用REPL的教训:
有没有办法摆脱等号,这样它的行为就像其他REPL一样?
如果不做我做的事情,你如何退出辅助提示?
function tell(num,...)
print("value of implicit table:",arg)
--print("value of implicit table:",...)
select(1,arg)
--select(1,...)
end
tell(12,43,12,55)
Run Code Online (Sandbox Code Playgroud)
为什么是它使用...在表达式引起的值arg来
进行nil,例如用print("value of implicit table:",...)或select(1,...)?
(defun billion-test ()
(setq i 0)
(loop while (< i 100) do
(setq i (+ i 1))))
(billion-test)
(print "done")
Run Code Online (Sandbox Code Playgroud)
我有上面的Lisp代码,简单地循环到十亿.问题是它真的很
慢.比我写过的任何琐碎程序都要慢.这些是
我使用的解释器运行的时间(gcl和clisp).
Compiled Uncompiled
GNU Common Lisp(gcl) 270-300s 900-960s
Clisp 280-300s 960-1647s
Run Code Online (Sandbox Code Playgroud)
我使用这个Python代码来计算时间Clisp和使用系统时间进行近似
,gcl因为您无法从命令提示符运行它.
import sys
import time
import os
start=time.time()
os.system(" ".join(sys.argv[1:]))
stop=time.time()
print "\n%.4f seconds\n"%(stop-start)
Run Code Online (Sandbox Code Playgroud)
以下是与其他语言的while循环的比较:
Kawa scheme 220.3350s
Petite chez 112.827s
C# 1.9130s
Ruby 31.045s
Python 116.8600s 113.7090s(optimized)
C 2.8240s 0.0150s(optimized)
lua 84.6970s
Run Code Online (Sandbox Code Playgroud)
我的假设是,loop while <condition> do是Lisp …
我正在尝试CR使用file:read似乎由于某种原因起作用的方法读取带行结尾的文件.文件内容如下所示:
ABCDEFGH
12345
##
6789
Run Code Online (Sandbox Code Playgroud)
我希望它与所有类型的行结尾一致.每次我尝试读取文件时,它都会返回文件中的最后一行与前一行中任何尾随字符的连接,这些字符的位置大于最后一行中最后一个字符的位置.这就是我的意思:
> file=io.open("test.lua", "rb")
> function re_read(openFile)
openFile:seek("set");
return openFile:read("*a");
end
> =re_read(file) -- With CR
67895FGH
> =re_read(file) -- With CRLF
ABCDEFGH
12345
##
6789
> =re_read(file) -- with LF
ABCDEFGH
12345
##
6789
>
Run Code Online (Sandbox Code Playgroud)
如您所见,返回的字符串5是前一行中的最后一个字符串加上FGH第一行的加号.将跳过任何比最后一行短的行.
我的目标是使用该file:line()方法逐行读取文件.我希望如果file:read找到"修复",那么它可以应用于file:lines().
PostgreSQL的新手,在Oracle中经验丰富。试图了解什么是PGDATA。
阅读它,它似乎包含创建初始数据库集群所需的内容。
我安装了,并且正在从Oracle转换一些数据。安装默认情况下将PGDATA放入的路径在一个很小的文件系统中。因此,我希望将其移动到更大的文件系统中。
所以我的问题是:
谢谢
我为python设置了一个startup.py脚本,它导入了常用的模块,如re,os和sys.然而,Ipython似乎没有在启动时运行它,因为尝试使用其中一个模块会引发错误.
我正在寻找一个布尔插值字符string.format(如标题所示).
我想要一些可以这样工作的东西:
print(string.format("nil == false: %b",(nil==false))
Run Code Online (Sandbox Code Playgroud)
%b只是一个占位符,你会得到一个错误.我正在寻找'b'.我不能这样做:
print("nil == false: " .. (nil==false))
Run Code Online (Sandbox Code Playgroud)
因为布尔值不能与字符串连接.我可以:
val=(nil==false)
if val==false then truth="false" else truth="true" end
print("nil==false: ".. truth)
Run Code Online (Sandbox Code Playgroud)
但是工作太多了.
我想print在变量中存储一个函数,这样我就可以输入一些简短的函数p,例如:
In Scheme:
(define print display)
(print "Hello world\n")
;; alternate way
(define print 'display)
((eval print) "Hello world\n")
Run Code Online (Sandbox Code Playgroud)
同样的方法似乎不起作用Common Lisp:
(defvar p 'print)
;;(print (type-of p))
(p "Hello world") ;; Attempt 1
((eval p) "Hello world") ;; >> Attempt 2
((eval (environment) p) "Hello world") ;; Attempt 3
Run Code Online (Sandbox Code Playgroud)
我Attempt 1上面得到这个错误:
*** - EVAL: undefined function P
Run Code Online (Sandbox Code Playgroud)
而这与Attempt 2和3在Clisp:
*** - EVAL: (EVAL (ENVIRONMENT) P) …Run Code Online (Sandbox Code Playgroud) 我有一些代码,我是编辑,使其一目了然更容易理解,我想我应该改变所有的char=="|"到char is "|".我知道看起来我太过分了,但看起来确实好看了.无论如何,我pycheck最后一次决定,我得到了这个警告:
Warnings...
test.py:7: Using is |, may not always work
Processing module test (test.py)...
Run Code Online (Sandbox Code Playgroud)
对于我的生活,我无法想象除非你开始冒险进行多字节字符编码,CJK字符等,如果我没有错,那么它"|" is "|"将会返回False.还有其他一些我错过的情况吗?
如果标题没有多大意义,请原谅我.我不得不选择Is Lua的比较方式有用吗?和Lua的比较.
我今天想做这样的事情:
if currChar == nextChar == "-" then
...
end
Run Code Online (Sandbox Code Playgroud)
但它false每次都会回来:
> currChar="-"
> nextChar="-"
> =currChar == nextChar == "-"
false
>
-- All true in Python
print(5 == 5) -- true
print(5 == 5 == 5) -- false
print((5 == 5) == (5 == 5)) -- true
print(5 == (4 + 1) == (6 - 1)) -- false
Run Code Online (Sandbox Code Playgroud)
我在一段时间内摆弄了这些值,并发现由于某种原因,Lua从左到右成对地比较值:
> = 52 > 3 > 2
stdin:1: attempt to compare …Run Code Online (Sandbox Code Playgroud) 我有这个功能(这个程序的摘录),我想以更吸引人/功能/惯用的方式重写.
它应该从s表达式中删除任何不必要的空格.
(defn trim
" Trim whitespace from code:
(trim (trim \" d ' ( print ( + 1 1 ) )\")
==> d '(print (+ 1 1))
The replaced string is passed repeatedly to every call.
Functional version
"
[string]
(clojure.string/replace
(clojure.string/replace
(clojure.string/replace
(clojure.string/replace
(clojure.string/replace
(clojure.string/replace
(clojure.string/replace
(clojure.string/replace
(clojure.string/replace
(clojure.string/replace
string #"([^\\(\[{@~`'])(\(|\[|\{)" "$1 $2")
#"(\)|\]|})(\[|\(|\{)" "$1 $2")
#"[ \t]*(\)|\]|\})" "$1")
#"[ \t]{2,}" " ")
#"(\)|\]|\})[ \t]*(?=(\)|\]|\}))" "$1")
#"(\(|\[|\{)[ \t]*(?=(\(|\[|\{))" "$1")
#"^[ \t]*" "")
#"(\\\{|\\\(|\\\[) " "$1 ") …Run Code Online (Sandbox Code Playgroud) lua ×5
string ×3
common-lisp ×2
comparison ×2
arguments ×1
auto-indent ×1
boolean ×1
clojure ×1
database ×1
eclipse ×1
eval ×1
file ×1
function ×1
html ×1
indentation ×1
ipython ×1
line-endings ×1
lisp ×1
lisp-2 ×1
postgresql ×1
python ×1
reduce ×1
scheme ×1
while-loop ×1
windows ×1