This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User | |
def name | |
@name | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Util | |
import Numeric.LinearAlgebra | |
import Statistics.Distribution.Normal as ND | |
import Statistics.Distribution | |
import Graphics.Plot | |
-- kernel esitimation -- | |
x_data :: Matrix Double | |
x_data = fromLists $ map filter [0.01, 0.02..0.99] | |
where |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Numeric.LinearAlgebra | |
import Graphics.Plot | |
import System.Random | |
import System.IO.Unsafe | |
import List as L | |
leasts_process n m random_power = do base_data <- return $ sinwave n | |
test_data <- randmize random_power base_data | |
w_vector <- return $ least_squares test_data m | |
result <- return $ approxim_list (map (\(x, _) -> x) base_data) w_vector |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;sicp3-5-3 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(load "~/gist/sicp3-5-2/sicp3-5-2.scm") | |
(define (display-stream stream num) | |
(if (= num 0) | |
'() | |
(begin | |
(print (stream-car stream)) | |
(display-stream (stream-cdr stream) (- num 1))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;sicp3-5-2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(load "~/gist/sicp3-5-1/sicp3-5-1.scm") | |
;;nから始まる整数のストリーム | |
(define (integers-start-from n) | |
(cons-stream n | |
(integers-start-from (+ n 1)))) | |
(define integers (integers-start-from 1)) | |
(stream-ref integers 3) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;sicp3-5-1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(use slib) | |
(require 'trace) | |
(define the-empty-stream '()) | |
(define (stream-null? s) | |
(eq? s the-empty-stream)) | |
(define (stream-ref s n) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use gauche.threads) | |
;;sicp3-4-2 : 並列性の制御機構 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;一定時間後に手続きを実行する | |
(define (delay time proc) | |
(lambda () | |
(thread-sleep! time) | |
(proc))) | |
(define (delay-print time name) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;sicp3-3-5 | |
;;加算の制約 sum = a1 + a2 の関係にある | |
(define (adder a1 a2 sum) | |
(define (process-new-value) | |
(cond ((and (has-value? a1) | |
(has-value? a2)) | |
(set-value! sum | |
(+ (get-value a1) (get-value a2)) | |
me)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use slib) | |
(require 'trace) | |
;; sicp 3.3.2 | |
(define (front-ptr queue) | |
(car queue)) | |
(define (rear-ptr queue) | |
(cdr queue)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;sicp 3.3.1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(define a '(1 . 2)) | |
a | |
;;(1 . 2) | |
(set-car! a 100) | |
a | |
;;(100 . 2) |
NewerOlder