Archive for the ‘Scheme Programming’ Category

THANKS TO SATYA FOR THE CODE – satish.smart@rediffmail.com ;;—————————————————————————————- ;; Database ;;—————————————————————————————- ;; Data definition : ;; (define-struct train(source destination train-no no-of-seats-ac no-of-seats-nonac)) ;; train is a structure: (make-train ‘kolkata ‘chennai 1234 24 89)) where source is a symbol, destination is a symbol, train-no is a number, no-of-seats-ac is a number, no-of seats-nonac is a [...]

;;SPECIFICATION:——-TO MANAGE THE DOCTOR DETAILS OF DEPARTMENT OF HEALTH.—————- ;;PURPOSE: Health department is fully automated where we have 4 health care centres. ;;ONLY ADMINISTRATOR can add,delete,modify and display the details of the doctor ;;ASSUMPTIONS: ;; 1.Database of all centres is centralised. ;;LIMITATION ;; 1.No login is present in the system. ;; 2.Only administrator can access [...]

;;======GLOBAL VARIABLES===== (define t1 0) (define t2 0) ;;=====CLASS DEFINITION===== (define (classarea) ;;DATA MEMBERS (define a 0) (define b 0) (define c 0) ;;MEMBER FUNCTION (define (seta p) (set! a p) ) (define (setb q) (set! b q) ) (define (setc r) (set! c r) ) (define (areasquare) (display “\n Area of Square is :”) [...]

(define shop(make-vector 10)) (define (product p_id p_name p_cid p_price) (define (dispproduct) (display “\n =====PRODUCT DETAILS=======”) (display “\n Product ID:”) (display p_id) (display “\n Product Name:”) (display p_name) (display “\n Product Category ID:”) (display p_cid) (display “\n Product Unit Price:”) (display p_price) (display “\n ===========================”) ) (define (readproduct) (display “\n Enter the Product ID:”) (set! p_id(read)) [...]

PROGRAM :- ;; Schemes offer a case-lambda macro (define foo (case-lambda ((x) “no additional args”) ((x y) “1 additional arg”) ((x y z) “2 additional args”) ((x . any) “even more additional args”))) TEST CASES:- > (foo 1) “no additional args” > (foo 2) “no additional args” > (foo 1 2) “1 additional arg” > [...]

(define s_id 0) (define s_name “”) (define s_courseid -1) (define s_sex -1) ;1-male,0-female (define s_phno 0) (define h_name “”) (define h_id 0) (define s_db(vector 10)) (define (student) ;;DATA MEMBERS (define student_id 0) (define student_name “”) (define student_courseid -1) (define student_sex -1) (define student_phno 0) ;;MEMBER FUNCTIONS ;;fn to set student id (define (setID) (display “\n [...]

First WAY Code: – ;;defn of super class (define (superclass) (define (inclass) (display “\n In Super Class”) ) (define (disp) (display “\n Display of Super Class”) ) (lambda(main) (case main ((1) (inclass)) ((2) (disp)) ) ) ) ;;end of superclass ;;defn of subclass (define (subclass) (define super(superclass)) (define (subclass1) (display “\n In Sub Class”) ) [...]

(define s_id 0) (define s_name “”) (define s_courseid -1) (define s_sex -1) ;1-male,0-female (define s_phno 0) (define h_name “”) (define h_id 0) (define (student) ;;DATA MEMBERS (define student_id 0) (define student_name “”) (define student_courseid -1) (define student_sex -1) (define student_phno 0) ;;MEMBER FUNCTIONS ;;fn to set student id (define (setID) (display “\n Enter Student ID:”) [...]

(define (point x y) ;;like creating a class in c (define (getx) x) ;;private Function 1 to return x (define (gety) y) ;;private function 2 to return y (define (add a b) ;;private function to add 2 points (begin (define sum1 0) (define sum2 0) (set! sum1 (+ (a ‘getx)(b ‘getx))) (set! sum2 (+ (a [...]

This Program was created by my group for the Structured Programming Case Study for TCS ILP in Scheme Programming Language. Use this as a reference and it’s a fully functional program with all the validations. ;SPECIFICATION:——-Health department wants to automate its doctor’s details management across various ;; health care centres. Health department has only 4 [...]