|
Technical -
Technical
|
|
Written by Karthikeyan NG Administrator
|
|
Monday, 12 October 2009 16:50 |
|
; string reverse
(define (stringrev inputString) (define len (string-length inputString)) (define result "") (let loop((count len)) (if(> count 0) (begin (set! result (string-append result (make-string 1 (string-ref inputString (- count 1))))) (loop (- count 1)) )) result ) ) input: ;(stringrev "karthi") output: "ihtrak"
_____________________________________ ; fibonacci series
(define (fibonacci num) (define num1 0) (define num2 1) (define result(list)) (let loop((count 0) (temp 0)) (if(< count num) (begin (set! result (append result (list num1))) (set! temp num2) (set! num2 (+ num1 num2)) (set! num1 temp) (loop (+ count 1) temp) ) result ) ) ) input: (fibonacci 5) output: (0 1 1 2 3)
___________________________ ;struct
(define-struct std(roll name)) (define (pro clist) (std-roll (list-ref clist 0)) (set-std-roll! (list-ref clist 0) 2) (std-roll (list-ref clist 0)) ) (pro (list (make-std 11 "gg") (make-std 12 "tt"))) 2
______________________________ (define (checkprime num) (if(< num 2) #f (begin (let loop((count 2) (end (round(sqrt num)))) (if(<= count end) (begin (if(= (modulo num count) 0) #f (loop (+ count 1) end) ) ) #t ) ) ) ) ) ;(checkprime 8) ;(checkprime 9) ;(checkprime 1) ;(checkprime 2)
(define (prime num) (define result(list)) (let looping((count 2) (end num)) (if(<= count num) (begin (if(checkprime count) (begin (set! result (append result (list count))) (looping (+ count 1) end) ) (looping (+ count 1) end) ) ) result ) ) ) input: (prime 50) output: (2 3 5 7 11 13 17 19 23 29 31 37 41 43 47)
|
|
Last Updated on Tuesday, 13 October 2009 09:50 |
|
Technical -
Technical
|
|
Written by Karthikeyan NG
|
|
Monday, 12 October 2009 15:48 |
|
Here I have listed some basic programs in scheme language. Ask me if you have any doubts :).
_____________________
;;Bubble sort
(define (bubble inputList) (define (swap inputList index1 index2) (let ((item1 (list-ref inputList index1)) (item2 (list-ref inputList index2))) (set-car! (list-tail inputList index1) item2) (set-car! (list-tail inputList index2) item1) ) ) (let loop1((count1 0) (len1 (- (length inputList) 1))) (if(< count1 len1) (begin (let loop2((count2 (+ count1 1)) (len2 (length inputList))) (if(< count2 len2) (begin (if(> (list-ref inputList count1) (list-ref inputList count2)) (begin (swap inputList count1 count2) (loop2 (+ count2 1) len2) ) (loop2 (+ count2 1) len2) ) ) (loop1 (+ count1 1) len1) ) ) )inputList ) )) sample input: (bubble (list 5 2 6 1 3)) output: (1 2 3 5 6)
|
|
Read more...
|
Vinnai thandi varuvaya review
VTV - I love this film a lot..U ve narrated the story ll..but its not sequential..think u ld ve slept while seein
Luv s a feel tat can come to anyone.U cant say tht only those who think tat they can liv together ld luv..Coz luv doesnt come after thinkin these n all..Even if they r not able to liv 2gether,the feel ll be thr always n tats luv..Thr ll be a feel between them til the end of lif even if they r apart..tats true luv..this s jus my own opinion..
உலக காதலர்களுக்கு
Kavithai romba nalla irundhuchu.. adhuvum ""காதலின் காதலனாக!!!"" konnuteenga..!! Nee nadadhu machi.. una adicchuka eyavanum kedayadhu..!!
My name is Khan movie-review
MNIK rockzz !!! - Dude...had seen d movie yesterday... All d credits goes to SRK who really made d movie lively...The nice thing about the story is huv the followin link happend Rizwan khan -> Bush -> Muslim -> 9/11 -> Obama
Beauty of d story
உலக காதலர்களுக்கு
kalakreenga rep!!! great going...............
உலக காதலர்களுக்கு
Indraya Kadhal - Ulaga kadhalarka ezhuthina indraya kadhal kavithai superb ...
My name is Khan movie-review
My comment - That's `asperger's syndrome' very much what Justin Hoffman played in `Rain Man'(a classic of all time). Hope they've got inspired from that role which won him an oscar. The movie is very much Indian-ish when it comes to the anti-climax and climax(media coverage and meeting Obama
) Anyways just printing my first test comment on your site
உலக காதலர்களுக்கு
Super kavidhai - It resembles my love boss. Nice one. Keep it up.
My name is Khan movie-review
MNIK is good -
I have seen the movie and it was really nice. I love sharukh.