class Song
def initialize(a) #構造函數
end
end
song1 = Song.new("Ruby Tuesday")
song2 = Song.new("Enveloped in Python")
# and so on
ivaneeo's blog自由的力量,自由的生活。 |
class Song song1 = Song.new("Ruby Tuesday") 3.times { puts "Hello!" }
把設置:
??? ? '(global-font-lock-mode t nil (font-lock)) ??? ??? '(jde-check-version-flag nil) 就可以解決jde對cedet版本檢查。
實現要安裝mozilla.
現在下來配置環境變量: ??? export MOZILLA_FIVE_HOME=/usr/X11R6/lib/mozilla setenv LD_LIBRARY_PATH ${MOZILLA_FIVE_HOME}: ${LD_LIBRARY_PATH}
轉帖:無法刪除dll文件?
高手莫笑。。(適用于XP,2003) 在論壇有時候老聽網友說某某文件刪不掉啊。。之類 的。而且有很多都是dll文件。雖然解決這個問題的方法有很多種。而且也可以把他刪除,但是網友們有沒有想過是為什么刪不掉呢??這是因為你運行的某個程 序正在調用這個dll文件。正在使用的文件是當然不可能給你刪除的。那么,到底是哪個程序在調用這個dll文件呢。我教大家一個方法可以把那個程序很容易 的找出來。。 在運行里輸入cmd進入命令提示符。 然后輸入命令tasklist /m>c:123.txt 回車。。是不是沒有任何反應?? 不要急。到C盤下面去找一找,是不是有了一個123.txt?(當然。你可以自己設定文件的輸出路徑,名字,甚至后綴。但要是文本文件哦。。) 打開他。里面就是目前運行的各個程序正在調用的dll文件。 把不能刪除的dll文件的名字記下來。然后到記事本里去編輯-查找。輸入對應的dll文件。是不是找出來了?? 找出來了后問題就好辦多了。打開任務管理器。把對應的那個程序給關了。。就可以順利刪除了。。那就不必進安全模式,進DOS那么麻煩了。。。 當 然。有些應用程序是以服務形式運行的。那么你就有可能查到的是svhost.exe但是。里面有很多個哦。。這個也好辦。仍然打開命令提示符。輸入 tasklist /svc,當然,你也可以把他輸出為文本文件,如tasklist /svc>C:234.txt。看到了嗎?每個svchost.exe后面是不是對應有一個ID呢?有了ID一對照也可以知道是哪個服務了。。如果 是可關的。就關了他。。不過記住。。系統進程可別亂關哦。
The sine of an angle (specified in
radians) can be computed by making use of the approximation
sinx
![]() ??? ![]() to reduce the size of the argument of sin. (For purposes of this exercise an angle is considered ``sufficiently small'' if its magnitude is not greater than 0.1 radians.) These ideas are incorporated in the following procedures: ??? (define?(cube?x)?(*?x?x?x)) ??? (define?(p?x)?(-?(*?3?x)?(*?4?(cube?x)))) ??? (define?(sine?angle) ?? ??? (if?(not?(>?(abs?angle)?0.1)) ?????? ??? angle ?????? ??? (p?(sine?(/?angle?3.0)))))
有100美元需找零.
??? 美元中有50美分(half-dollars),25美分(quarters),10美分(dimes),5美分(nickels),1美分(pennies). 總共有多少種方式? 分成兩步: ??? 1.計算使用50美分找零的方法數. ??? 2.上面數目加上除了使用50美分找零的方法數以外的數目. (define (count-change amount) ? (cc amount 6)) (define (first-denomination kinds-of-coins) ? (cond ((= kinds-of-coins 1) 1) ??? ((= kinds-of-coins 2) 2) ??? ((= kinds-of-coins 3) 5) ??? ((= kinds-of-coins 4) 10) ??? ((= kinds-of-coins 5) 20) ??? ((= kinds-of-coins 6) 50))) (define (cc amount kinds-of-coins) ? (cond ((= amount 0) 1) ??? ((or (< amount 0) ??? ??? (= kinds-of-coins 0)) ??? ?0) ??? (else (+ (cc (- amount?? ?? ?? ?? ?? ?? ?? ?? ;第一步 ??? ??? ??? (first-denomination kinds-of-coins)) ??? ??? ???? kinds-of-coins) ??? ??? ?(cc amount?? ?? ?? ?? ?? ?? ?? ?? ?? ??? ;第二步 ??? ??? ???? (- kinds-of-coins 1))))))
Fibonacci函數定義如下:
![]() (define?(fib?n) ??(cond?((=?n?0)?0) ????????((=?n?1)?1) ????????(else?(+?(fib?(-?n?1)) ?????????????????(fib?(-?n?2)))))) 遞歸數如下: ![]() Fib(n)非常接近 ![]() ![]() ![]() 同樣下面的式子也成立: ![]() 同樣使用線性迭代效率要高的多: (define?(fib?n) ??(fib-iter?1?0?n)) (define?(fib-iter?a?b?count) ??(if?(=?count?0) ??????b ??????(fib-iter?(+?a?b)?a?(-?count?1))))
Ackermann函數可用遞推關系如下定義
A(m,0)=A(m-1,0) m=1,2,… A(m,n)=A(m-1,A(m,n-1)) m=1,2,… n=1,2,… 初始條件為 A(0,n)=n+1,n=0,1,… (define?(A?x?y) ??(cond?((=?y?0)?0) ????????((=?x?0)?(*?2?y)) ????????((=?y?1)?2) ????????(else?(A?(-?x?1) ?????????????????(A?x?(-?y?1))))))
關于n!求解:
1.線性遞歸 ??? ![]() (define?(factorial?n) ??(if?(=?n?1) ??????1 ??????(*?n?(factorial?(-?n?1))))) 如圖所示的線性的膨脹再線性的縮減,就為線性遞歸. 2.迭代 ??? ![]() (define?(factorial?n) ??(fact-iter?1?1?n)) (define?(fact-iter?product?counter?max-count) ??(if?(>?counter?max-count) ??????product ??????(fact-iter?(*?counter?product) ?????????????????(+?counter?1) ?????????????????max-count))) 注:試驗(factorial 10000),遞歸堆棧溢出,而迭代則可以運行. |