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 [...]
Archive for the ‘Scheme Programming’ Category
RAILWAY RESERVATION – SCHEME Programming
Posted: July 31, 2008 in Scheme ProgrammingTags: railway reservation code scheme, railway reservation scheme programming
Doctor Details Management (OOPS Concept) – Scheme
Posted: June 18, 2008 in Scheme ProgrammingTags: doctor, Doctor details management scheme, doctor details mangement scheme oops
;;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 [...]
Polymorphism in Scheme – An example
Posted: June 11, 2008 in Scheme ProgrammingTags: Polymorphism Scheme, polymorphism scheme example
;;======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 :”) [...]
Vectors and Classes in Scheme – a simple example
Posted: June 11, 2008 in Scheme ProgrammingTags: vector class scheme example, vectors and classes in scheme example
(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)) [...]
Function Overloading in Scheme – An example
Posted: June 11, 2008 in Scheme ProgrammingTags: function overloading scheme, function overloading scheme example
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” > [...]
Vectors + Classes + Inheritance in Scheme Programming – an example
Posted: June 11, 2008 in Scheme ProgrammingTags: vector and class example in scheme, vector class inheritance scheme example, vectors inheritance classes in scheme
(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 [...]
Inhertitance in Scheme – 2 ways
Posted: June 11, 2008 in Scheme ProgrammingTags: inheritance in scheme, scheme inheritance
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”) ) [...]
Inheritance in Scheme Programming
Posted: June 10, 2008 in Scheme ProgrammingTags: inheritance example in scheme, inheritance in scheme, scheme inheritance
(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:”) [...]
OOPS BASICS (CLASS) in SCHEME
Posted: June 10, 2008 in Scheme ProgrammingTags: OOPS BASICS (CLASS) in SCHEME, OOPS Programming in scheme, oops scheme
(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 [...]
Doctor Details Management in Scheme Language
Posted: June 9, 2008 in Scheme ProgrammingTags: Doctor details management scheme, health care automation scheme
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 [...]