Minesweeper Hacks

June 19, 2008

FIRST WAY

STEPS

  1. Open Minesweeper and select the window.
  2. Type xyzzy
  3. Hold BOTH shift keys for 3 seconds.
  4. Release shift, and hover your mouse over the mine field.
  5. Look closely to find a very tiny white square on the top left of your desktop, it should be about 1 pixel in size. Not the minesweeper screen but your computer backround. A white dot means it’s safe to click, and a black dot means that there is a mine.
  6. For MineSweeper in previous versions of Windows, i.e. before XP, search for the file winmine.ini
  7. Open this file (using notepad, wordpad, etc.)
  8. You will see entries for best times. Edit those entries, modifying the names and the times to reflect your times!
  9. You are a MineSweeper champion! :)

SOURCE – http://www.wikihow.com/Hack-Minesweeper

SECOND WAY

Today I will show you how to cheat in minesweeper. It’s very simple, but we will be editing the registry. You should back up the registry with one of those free programs out there before you mess with it, unless you are an extremely skilled programmer. If you don’t, and you mess something up, your CPU is screwed. Anyway, to get to the registry, go to Start, Run. Type regedit and then the registry should appear. Find the following key:

HKEY_CURRENT_USER\Software\Microsoft\winmine

After you find that, look for names and times. You can edit these by right-clicking, and it’s pretty much self-explanatory. Comment if you have problems.

Source – http://seansoni.blogspot.com/2006/10/how-to-hack-minesweeper.html


Mod your iPod Video.

June 18, 2008

Give New Look to your iPod Video.

The Following are pictures of how funky your iPod can look with all these customizations.

Go to : – http://ipodhacking.com/forum/forumdisplay.php?f=17 for more details.


Doctor Details Management (OOPS Concept) – Scheme

June 18, 2008

;;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 the system
;; 3.A maximum of 1000 records can be added as we have defined the length of the Vector as 1000

;;=========================================================================================================
;;defining the vector.

(define hcc(make-vector 1000)) ;;main vector of the HCC which stores doctor details and location id
(define doc_start_id 1000)   ;;for the first Doctor ID and incremented by 1 as a new doctor is added
(define index 0)            ;; initial index for hcc_vector(not using vector length function as index is incremented
;;each time a new doctor is added)
(define hcc_temp_id 0)

;;==============================================================================================
;;=============================CLASS FOR THE DOCTOR=============================================
;;==============================================================================================
;;PURPOSE:DOCTOR IS A CLASS WHICH STORES DOCTOR DETAILS(DOCTORID,DOCTORNAME,DOCTORPHONENUMBER,HCCID)
;;        AND PERFORMS OPERATIONS ON THEM.

(define (doctor)

;; Data members
(define doctor_id 0)
(define doctor_name “”)
(define doctor_phno 0)
(define doctor_hccid 0)

;; Member Functions

;;=========FUNCTION TO GET THE DOCTOR NAME FROM THE USER==============
;;CONTRACT: (setdocname) void=>void.
;;PURPOSE: It’s used to read the doctor name from console and to validate it for being text.
;;TESTCASE:(setdocname)(“Mary”)=>will set doctor name as Mary
;;(16234)=>The Name has to be a String inside Double Quotes.Please Enter the Name again.

(define (setdocname)
(display “\n Enter the Doctor Name inside double quotes.”)
(set! doctor_name(read))
(if (not (string? doctor_name))
(begin
(display “\n The Name has to be a String inside Double Quotes.”)
(display “\n Please Enter the Name again.”)
(setdocname)
)
(begin
(if (string->number doctor_name)
(begin
(display “\n Please Do not Enter numbers inside double quotes.”)
(display “\n Please Enter the Name Again.”)
(setdocname)
)
(begin
(set! doctor_name doctor_name)
)
)
)
)
)

;;============FUNCTION TO GET THE DOCTOR PHONE NUMBER FROM THE USER=============
;;CONTRACT: (setdocphno) void=>void.
;;PURPOSE: It’s used to read the doctor phone number from console and to validate it for being a number.
;;TESTCASE:(setdocphno)(9900990099)=>will set doctor phone number as 9900990099
;;(gasdgs)=>The Phone Number has to be a Number.Please Enter the Phone Number again.

(define (setdocphno)
(display “\n Enter the Phone Number of the Doctor.”)
(set! doctor_phno(read))
(if (not (number? doctor_phno))
(begin
(display “\n The Phone Number has to be a Number.”)
(display “\n Please Enter the Phone Number again.”)
(setdocphno)
)
(begin
(set! doctor_phno doctor_phno)
)
)
)

;;===========FUNCTION TO GET THE DOCTOR HCC ID FROM THE USER==================
;;CONTRACT: (setdochccid) void=>void.
;;PURPOSE: It’s used to read the doctor hcc id from console and to validate it for bring a number between 1 and 4.
;;TESTCASE:(setdochccid)(1)=>will set doctor hcc id as 1
;;(gasdgs)=>The HCC ID has to be a Number.Please Enter the HCC ID again.
;;(6)=>The HCC ID has to be between 1 and 4.Please Enter the HCC ID again.

(define (setdochccid)
(display “\n Enter the HCC ID of the Doctor.”)
(display “\n 1:Delhi 2:Mumbai 3:Hyderabad 4:Bengaluru”)
(set! doctor_hccid(read))
(if (not (number? doctor_hccid))
(begin
(display “\n The HCC ID has to be a Number.”)
(display “\n Please Enter the HCC ID again.”)
(setdochccid)
)
)
(if (and (>= doctor_hccid 1) (<= doctor_hccid 4))
(begin
(set! doctor_hccid doctor_hccid)
)
(begin
(display “\n The HCC ID has to be between 1 and 4.”)
(display “\n Please Enter the HCC ID again.”)
(setdochccid)
)
)
)

;;============FUNCTION TO DISPLAY THE DOCTOR ID OF THE DOCTOR============
;;CONTRACT:(getdocid) void=>void.
;;PURPOSE:It display the doctor ID.
;;TESTCASE:(getdocid)=>1000.

(define (getdocid)
(display doctor_id)
)

;;============FUNCTION TO DISPLAY THE NAME OF THE DOCTOR=================
;;CONTRACT:(getdocname) void=>void.
;;PURPOSE:It display the doctor Name.
;;TESTCASE:(getdocname)=>Mary.

(define (getdocname)
(display doctor_name)
)

;;============FUNCTION TO DISPLAY THE PHONE NUMBER OF THE DOCTOR============
;;CONTRACT:(getdocphno) void=>void.
;;PURPOSE:It display the doctor phno.
;;TESTCASE:(getdocphno)=>9900990099.

(define (getdocphno)
(display doctor_phno)
)

;;==============FUNCTION TO DISPLAY THE HCC ID OF THE DOCTOR=================
;;CONTRACT:(getdochccid) void=>void.
;;PURPOSE:It display the doctor’s location id.
;;TESTCASE:(getdochccid)=>1.

(define (getdochccid)
(display doctor_hccid)
)

;;==============FUNCTION TO GET THE DOCTOR ID OF THE DOCTOR====================
;;CONTRACT:(get_doc_id) void=>number.
;;PURPOSE:It returns the Doctor ID.
;;TESTCASE:(get_doc_id)=>1000.

(define (get_doc_id)
doctor_id
)

;;===============FUNCTION TO GET THE LOCATION ID OF THE DOCTOR=================
;;CONTRACT:(get_hcc_id) void=>number.
;;PURPOSE:It returns the Doctor Location ID.
;;TESTCASE:(get_hcc_id)=>1

(define (get_hcc_id)
doctor_hccid
)

;;========FUNCTION TO ADD A NEW DOCTOR===================
;;DATA METHOD TO ADD A NEW DOCTOR.
;;CONTRACT: void===>void.
;;PURPOSE:Procedure to add a doctor where doctor details are read from the console.
;;TESTCASES:
;; (Mary 9900990099 1)=>Doctor Added.The Doctor ID is:1000

(define (add_doctor)
(set! doctor_id doc_start_id)
(setdocname)
(setdocphno)
(setdochccid)
(vector-set! hcc index doc_temp)
(set! doc_temp(doctor))
(display “\n Doctor Added.The Doctor ID is:”)
(display doctor_id)
(set! index ( + index 1))
(set! doc_start_id ( + doc_start_id 1))
(main_menu)
)

;;=================FUNCTION TO DISPLAY A DOCTOR/ALL DOCTORS=====================
;;FUCNTION TO DISPLAY A PARTICULAR DOCTOR BASED ON EMPLOYEE ID / LIST OF ALL DOCTORS
;;CONTRACT: (display_doctor) void=>void.
;;Display procedure for displaying all the doctor’s details or the details of the particular doctor.
;;TESTCASE:
;;(1001)==>(1001 mary 9900990099 1 DELHI) – displays details doctor with doctor id as 1001
;;(1)==>display list of all the doctors.
;;(1005) ==> Display’s Doctor does’nt exist if the doctor id is not there.

(define (display_doctor)
(define choice 0)
(define flag 0)
(display “\n To Display list of all the Doctors Enter 1.”)
(display “\n Enter a Doctor ID for a particular doctor.”)
(display “\n **Note – The Doctor ID Starts from 1000**”)
(set! choice(read))
(if (number? choice)
(begin
(if (= choice 1)
(begin
(let loop((i 0))
(define doc_temp(doctor))
(define hcc_temp(hcclocation))
(if (< i index)
(begin
(set! doc_temp (vector-ref hcc i))
(if (not (= (doc_temp ‘get_doc_id) -1))
(begin
(set! flag 1)
(display “\n =====DOCTOR DETAILS=======”)
(display “\n Doctor ID:”)
(doc_temp ‘getdocid)
(display “\n Doctor Name:”)
(doc_temp ‘getdocname)
(display “\n Doctor Phone Number:”)
(doc_temp ‘getdocphno)
(display “\n Doctor HCC ID:”)
(doc_temp ‘getdochccid)
(set! hcc_temp_id (doc_temp ‘gethccid))
(hcc_temp ’set_hcc_id)
(display “\n HCC Name:”)
(hcc_temp ‘disp_hcc_name)
(display “\n ===========================”)
)
)
(loop(+ i 1))
)
)
)
)
)
(if (>= choice 1000)
(begin
(let loop((i 0))
(define doc_temp(doctor))
(define hcc_temp(hcclocation))
(if (< i index)
(begin
(set! doc_temp (vector-ref hcc i))
(if (= (doc_temp ‘get_doc_id) choice)
(begin
(set! flag 1)
(set! doc_temp (vector-ref hcc i))
(display “\n =====DOCTOR DETAILS=======”)
(display “\n Doctor ID:”)
(doc_temp ‘getdocid)
(display “\n Doctor Name:”)
(doc_temp ‘getdocname)
(display “\n Doctor Phone Number:”)
(doc_temp ‘getdocphno)
(display “\n Doctor HCC ID:”)
(doc_temp ‘getdochccid)
(set! hcc_temp_id (doc_temp ‘gethccid))
(hcc_temp ’set_hcc_id)
(display “\n HCC Name:”)
(hcc_temp ‘disp_hcc_name)
(display “\n ===========================”)
)
)
(loop (+ i 1))
)
)
)
)
)
(if (= flag 0)
(begin
(display “\n ======================”)
(display “\n Doctor Does’nt Exist”)
(display “\n ======================”)
)
)
(main_menu)
)
(begin
(newline)
(display “\n ================================================”)
(display “\n The Choice has to be a Number.Please Enter Again”)
(display “\n ================================================”)
(display_doctor)
)
)
)

;;======================FUNCTION TO SET DOCTOR DETAILS AS EMPTY==============
;;PURPOSE:IT’S USED TO SET THE VALUES.USED BY THE delete_doctor function
;;CONTRACT:(empty_doctor)void=>void.
;;TESTCASE:(empty_doctor)(-1 “” 0 0).

(define (empty_doctor)
(set! doctor_id -1)
(set! doctor_name “”)
(set! doctor_phno 0)
(set! doctor_hccid 0)
)

;;=======================FUNCTION TO DELETE A DOCTOR=====================
;;CONTRACT:(delete_doctor) void=>void.
;;PURPOSE:Procedure to delete doctor’s record.
;;TESTCASE:
;;IN DELETE PROCEDURE (1000)=>Doctor is Deleted.
;;If ID is not there then it display Doctor not found.

(define (delete_doctor)
(define choice 0) ;choice is used as local variable for reading the doctor id
(define flag 0)
(define d -1)
(begin
(display “\n Enter the Doctor ID which is to be Deleted”)
(set! choice(read))
(if (number? choice)
(begin
(let loop (( i 0))
(define doc_temp(doctor))
(if (< i index)
(begin
(set! doc_temp (vector-ref hcc i))
(if (= (doc_temp ‘get_doc_id) choice)
(begin
(set! flag 1)
(doc_temp ‘emptydoctor)
(vector-set! hcc i doc_temp)
(display “\n Doctor Deleted”)
)
)
(loop (+ i 1))
)
)
)
)
(begin
(newline)
(display “\n ============================================================”)
(display “\n The Doctor ID has to be Number Please Enter Doctor ID again.”)
(display “\n =============================================================”)
(delete_doctor)
)
)
(if (= flag 0)
(begin
(display “\n ======================”)
(display “\n Doctor Does’nt Exist”)
(display “\n ======================”)
)
)
(main_menu)
)
)

;;=======================FUNCTION TO DISPLAY THE LIST OF ALL DOCTORS IN A PARTICULAR LOCATION==============
;;FUNCTION TO DISPLAY THE LIST OF ALL DOCTORS IN A PARTICULAR LOCATION
;;CONTRACT:(display_location) void=>void.
;;PURPOSE:Display procedure for list of doctors at a particular location.
;;TESTCASE: (1)==>List of all doctors for location 1.
;; if hccid <1 and hccid >4 then location not found.
;;if the input is greater then 4 or less than 1 ==>Location Not found.

(define (display_location)
(define choice 0) ;choice is a local variable where we will read the location id
(define n 0)
(define flag 0)
(begin
(display “\n 1:Delhi 2:Mumbai 3:Hyderabad 4:Bengaluru”)
(display “\n Enter the Location Number : “)
(set! choice(read))
(if (number? choice)
(begin
(if (and (>= choice 1) (<= choice 4))
(begin
(let loop((i 0))
(define doc_temp(doctor))
(define hcc_temp(hcclocation))
(if (< i index)
(begin
(set! doc_temp (vector-ref hcc i))
(if (= (doc_temp ‘gethccid) choice)
(begin
(set! flag 1)
(display “\n =====DOCTOR DETAILS=======”)
(display “\n Doctor ID:”)
(doc_temp ‘getdocid)
(display “\n Doctor Name:”)
(doc_temp ‘getdocname)
(display “\n Doctor Phone Number:”)
(doc_temp ‘getdocphno)
(display “\n Doctor HCC ID:”)
(doc_temp ‘getdochccid)
(set! hcc_temp_id (doc_temp ‘gethccid))
(hcc_temp ’set_hcc_id)
(display “\n HCC Name:”)
(hcc_temp ‘disp_hcc_name)
(display “\n ===========================”)
)
)
(loop (+ i 1))
)
)
)
)
(begin
(display “\n ======================”)
(display “\n Location Does’nt Exist”)
(display “\n ======================”)
(main_menu)
)
)
)
(begin
(display “\n ==================================================”)
(display “\n The Location has to be a Number.Please Enter Again”)
(display “\n ===================================================”)
(display_location)
)
)
(if ( = flag 0)
(begin
(display “\n ========================”)
(display “\n No Doctors in Location.”)
(display “\n =========================”)
)
)
)
(main_menu)
)

;;======================FUNCTION TO MODIFY DOCTOR DETAILS============
;;CONTRACT:(modify_doctor) void=>void.
;;PURPOSE:Procedure to modify all the fields or any individual field of doctor details.
;;TESTCASE:(modify_doctor) 1000 If ID Present then =>displays old values => Asks what has to be modified(name,phone number
;;hccid)and modifes it.Modifying one field is also allowed.
;;If ID not present =>Doctor Does’nt Exist.

(define (modify_doctor)
(define choice 0) ;;to get id of doctor
(define flag 0) ;;for doctor id found / not
(define modify_choice 0)
(begin
(display “\n Enter the ID of the Doctor who is to be Updated.”)
(set! choice(read))
(if (number? choice)
(begin
(let loop((i 0))
(define doc_temp(doctor))
(define hcc_temp(hcclocation))
(if (< i index)
(begin
(set! doc_temp (vector-ref hcc i))
(if (= (doc_temp ‘get_doc_id) choice)
(begin
(set! flag 1)
(display “\n =====OLD DOCTOR DETAILS=======”)
(display “\n Doctor ID:”)
(doc_temp ‘getdocid)
(display “\n Doctor Name:”)
(doc_temp ‘getdocname)
(display “\n Doctor Phone Number:”)
(doc_temp ‘getdocphno)
(display “\n Doctor HCC ID:”)
(doc_temp ‘getdochccid)
(set! hcc_temp_id (doc_temp ‘gethccid))
(hcc_temp ’set_hcc_id)
(display “\n HCC Name:”)
(hcc_temp ‘disp_hcc_name)
(display “\n ===========================”)
(display “\n 1.Modify Doctor Name”)
(display “\n 2.Modify Doctor Phone Number”)
(display “\n 3.Modify Doctor Location(HCCID)”)
(display “\n 4.Modify All Details”)
(display “\n Please Enter your Choice”)
(set! modify_choice(read))
(if (number? modify_choice)
(begin
(case modify_choice
((1) (doc_temp ’setdocname)
(display “\n ======================”)
(display “\n Doctor Name Modified.”)
(display “\n ======================”))
((2) (doc_temp ’setdocphno)
(display “\n ==============================”)
(display “\n Doctor Phone Number Modified.”)
(display “\n ==============================”))
((3) (doc_temp ’setdochccid)
(display “\n =========================”)
(display “\n Doctor HCC ID Modified.”)
(display “\n =========================”))
((4) (doc_temp ’setdocname)
(doc_temp ’setdocphno)
(doc_temp ’setdochccid)
(display “\n =========================”)
(display “\n Doctor Details Modified.”)
(display “\n =========================”))
(else ((display “\n Wrong Choice.”)
(modify_doctor)))
)
)
(begin
(display “\n================================”)
(display “\n The Choice has to be a Number.”)
(display “\n=================================”)
(modify_doctor)
)
)
(vector-set! hcc index doc_temp)
)
)
(loop(+ i 1))
)
)
)
)
(begin
(display “\n ==================================”)
(display “\n The Doctor ID has to be a Number.”)
(display “\n Please Enter the  Doctor ID Again.”)
(display “\n ==================================”)
(modify_doctor)
)

)
(if ( = flag 0)
(display “\n Doctor Does’nt Exist.”)
)
(main_menu)
)
)

;;=======================FUNCTION TO EXIT============================
;;CONTRACT:(exitmain) void=>void.
;;PURPOSE:(exitmain) is used to exit.

(define (exitmain)
(begin
(display “\n Exiting ………..Exited”)
)
)

;;===================LAMBDA – THE INTERFACING FUNCTION==================
;;PURPOSE: Its a function for interacting with the methods of the class.
(lambda (msg)
(cond
((eqv? msg ‘add_doctor)(add_doctor))
((eqv? msg ‘display_doctor)(display_doctor))
((eqv? msg ‘getdocid)(getdocid))
((eqv? msg ‘getdocname)(getdocname))
((eqv? msg ‘getdocphno)(getdocphno))
((eqv? msg ‘getdochccid)(getdochccid))
((eqv? msg ‘get_doc_id)(get_doc_id))
((eqv? msg ‘delete_doctor)(delete_doctor))
((eqv? msg ‘exit)(exitmain))
((eqv? msg ‘emptydoctor)(empty_doctor))
((eqv? msg ‘gethccid)(get_hcc_id))
((eqv? msg ‘display_location)(display_location))
((eqv? msg ‘modify_doctor)(modify_doctor))
((eqv? msg ’setdocname)(setdocname))
((eqv? msg ’setdocphno)(setdocphno))
((eqv? msg ’setdochccid)(setdochccid))
(else (error msg “\n Not a Supported Function”))
)
)

) ;;================END OF CLASS DEFINITION FOR DOCTOR==========================
;;==============================================================================
;;==============================================================================

;;******************************************************************************
;;******************************************************************************

;;==============================================================================
;;========================CLASS FOR LOCATION====================================
;;==============================================================================

;;purpose:hcclocation is another class for healthcare centre names.

(define (hcclocation)

;;data members

(define hcc_id 0)
(define hcc_name “”)

;;member functions

;;========FUNCTION TO RETRIVE HCC ID======================
;;CONTRACT:(get_hcc_id) void=>number.
;;PURPOSE: To retrieve the hccid for objects of the class.
;;TESTCASE:(get_hcc_id)=>1.

(define (get_hcc_id) hcc_id)

;;===============FUNCTION TO RETRIVE HCC NAME========================
;;CONTRACT:(get_hcc_id) void=>string.
;;PURPOSE: To retrieve the hccname for objects of the class.
;;TESTCASE:(get_hcc_id)=>Delhi.

(define (get_hcc_name) hcc_name)

;;==============FUNCTION TO SET HCC ID==========================
;;CONTRACT:(set_hcc_id) number=>void.
;;PURPOSE: To set the hcc_id.

(define (set_hcc_id z)
(set! hcc_id z)
)

;;================FUNCTION TO DISPLAY THE NAME OF THE LOCATION===================
;;CONTRACT: (disp_hcc_name) void => void.
;;PURPOSE:To display the names of the health care centre location.
(define (disp_hcc_name)
(cond
((eqv? hcc_id 1)(display “Delhi”))
((eqv? hcc_id 2)(display “Mumbai”))
((eqv? hcc_id 3)(display “Hyderabad”))
((eqv? hcc_id 4)(display “Bengaluru”))
)
)

;;==========INTERFACING FUNCTION – LAMBDA==============
;;PURPOSE: Its a function for interacting with the methods of the hcclocation class.

(lambda (msg)
(cond
((eqv? msg ’set_hcc_id)(set_hcc_id hcc_temp_id))
((eqv? msg ‘disp_hcc_name)(disp_hcc_name))
)
)

) ;;==================END OF LOCATION CLASS======================================
;;===============================================================================
;;===============================================================================

;;Object of the Doctor Class.
(define doc_temp(doctor))

;;CONTRACT:It reads from choice from the console.
;;PURPOSE:Main menu procedure to get the menu for choosing options.

(define (main_menu)
(define choice 0) ;choice is a local declaration for reading the number to select the procedure.

(begin
(display “\n =============================================================”)
(display “\n ===========Welcome to Doctor Management System===============”)
(display “\n =============================================================”)
(display “\n 1.Add a Doctor”)
(display “\n 2.Delete a Doctor”)
(display “\n 3.Modify a Doctor”)
(display “\n 4.Display a Doctor / All Dcotors”)
(display “\n 5.Display List of Doctors in a Location “)
(display “\n 6.Exit”)
(display “\n Enter your CHOICE”)
(set! choice(read))
(cond
((eqv? choice 1) (doc_temp ‘add_doctor))
((eqv? choice 2) (doc_temp ‘delete_doctor))
((eqv? choice 3) (doc_temp ‘modify_doctor))
((eqv? choice 4) (doc_temp ‘display_doctor))
((eqv? choice 5) (doc_temp ‘display_location))
((eqv? choice 6) (doc_temp ‘exit))
(else (main_menu))
)
)
)

(main_menu)

;;==============================================================================================
;;====================================END OF PROGRAM============================================
;;==============================================================================================


Essay On a COW

June 12, 2008

“The cow is a successful animal. Also he is quadrupud, and because he is female, he give milk,but will do so when he is got child.He is same like God,sacred to Hindus and useful to man.But he has got four legs together. Two are forward and two are afterwards.

“His whole body can be utilised for use. More so the milk. What can it do? Various ghee, butter,cream, curd, why and the condensed milk and so forth. Also he is useful to cobbler, watermans and mankind generally. “His motion is slow only because he is of asitudinious species. Also his other motion is much useful to trees, plants as well as making flat cakes in hand and drying in the sun. Cow is the only animal that extricates his feeding after eating. Then afterwards she chew with his teeth whom are situated in the inside of the mouth. He is incessantly in the meadows in the grass.

“His only attacking and defending organ is the horn, specially so when he is got child. This is done by knowing his head whereby he causes the weapons to be paralleled to the ground of the earth and instantly proceed with great velocity forwards.

“He has got tails also, but not like similar animals. It has hairs on the other end of the other side. This is done to frighten away the flies which alight on his cohoa body whereupon he gives hit with it. The palms of his feet are soft unto the touch. So the grasses head is not crushed. At night time have poses by looking down on the ground and he shouts his eyes like his relatives, the horse does not do so.

“This is the cow.”


Polymorphism in Scheme – An example

June 11, 2008

;;======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 :”)
(foo a)
)

(define (arearectangle)
(display “\n Area of Rectangle is :”)
(foo a b)
)

(define foo
(case-lambda
((x) (* x x))
((x y) (* x y))
)
)

(lambda (msg)
(case msg
((1)
(display “\n Enter the side of the square”)
(set! t1(read))
(seta t1)
(areasquare)

)
((2)
(display “\n Enter the lenght of the rectangle”)
(set! t1(read))
(seta t1)
(display “\n Enter the breadth of the rectangle”)
(set! t2(read))
(setb t2)
(arearectangle)

)
)
)
)

(define z(classarea))

(z 1)
(z 2)


Vectors and Classes in Scheme – a simple example

June 11, 2008

(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))
(display “\n Enter the Product Name:”)
(set! p_name(read))
(display “\n Enter the Product Category ID:”)
(set! p_cid(read))
(display “\n Enter the Product Unit Price:”)
(set! p_price(read))
)
(define (changeprice)
(display “\n Enter the new price”)
(set! p_price(read))
)
(lambda (msg)
(cond
((eqv? msg ‘readpdt)(readproduct))
((eqv? msg ‘disppdt)(dispproduct))
((eqv? msg ‘changeprice)(changeprice))
(else (error msg “is not a Supported Function”))
)
)
)

;;=====END OF CLASS DEFINITION==========================
(define (getshop)
(let loop((i 0))
(define p1(product 0 “” 0 0)) ;;the most important line(remember the placement)
(if (< i 3)
(begin

(p1 ‘readpdt)
(vector-set! shop i p1)
(loop (+ i 1))
)
)
)
)

(define (dispshop)
(let loop((i 0))
(if (< i 3)
(begin
((vector-ref shop i) ‘disppdt)
(loop(+ i 1))
)
)
)
)
(getshop)
(dispshop)


Function Overloading in Scheme – An example

June 11, 2008

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”
> (foo 1 2 3)
“2 additional args”
> (foo 1 2 3 4 5 6)
“even more additional args”


Vectors + Classes + Inheritance in Scheme Programming – an example

June 11, 2008

(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 Enter Student ID:”)
(set! s_id(read))
(if (not(number? s_id))
(begin
(display “\n Student ID has to be a number”)
(setID)
)
(begin
(set! student_id s_id)
)
)
)
(define (setName)
(display “\n Enter Student Name:”)
(set! s_name(read))
(if (not(string? s_name))
(begin
(display “\n Student Name has to be a string.”)
(setName)
)
(begin
(set! student_name s_name)
)
)
)

(define (setCourse)
(display “\n Enter Student Course:”)
(set! s_courseid(read))
(set! student_courseid s_courseid)
)

(define (setSex)
(display “\n Enter the Sex of the Student:”)
(set! s_sex(read))
(set! student_sex s_sex)
)

(define (setPhno)
(display “\n Enter the Phone Number of the Student:”)
(set! s_phno(read))
(set! student_phno s_phno)
)

(define (displaydetails)
(display “\n Student ID:”)
(display student_id)
(display “\n Student Name:”)
(display student_name)
(display “\n Student Course:”)
(display student_courseid)
(display “\n Sex:”)
(display student_sex)
(display “\n Student Phone Number:”)
(display student_phno)
)

(define (modify_phno)
(display “\n Enter the new Phone Number:”)
(set! s_phno(read))
(set! student_phno s_phno)
)

(lambda (msg)
(cond
[(eqv? msg 'setid)(setID)]
[(eqv? msg 'setname)(setName)]
[(eqv? msg 'setcourse)(setCourse)]
[(eqv? msg 'setsex)(setSex)]
[(eqv? msg 'setphno)(setPhno)]
[(eqv? msg 'displaydetails)(displaydetails)]
)
)
)

;;end of class defn

(define (hostel)
(define stud1(student))
;;DATA MEMBERS
(define hostel_name “”)
(define hostel_id 0)

;;MEMBER FUNCTIONS
(define (setHostelName)
(display “\n Enter Hostel Name:”)
(set! h_name(read))
(set! hostel_name h_name)
)

(define (setHostelId)
(display “\n Enter Hostel ID:”)
(set! h_id(read))
(set! hostel_id h_id)
)

(define (displayHostel)
(display “\n Hostel Name:”)
(display hostel_name)
(display “\n Hostel ID:”)
(display hostel_id)
)

(lambda(msg)
(cond
[(eqv? msg 'hostelname)(setHostelName)]
[(eqv? msg 'hostelid)(setHostelId)]
[(eqv? msg 'displayhostel)(displayHostel)]
[#t (stud1 msg)]
)
)
)

(define mr(student))

(define mrhostel(hostel))
(define copy (hostel))

(mrhostel ’setid)
(mrhostel ’setname)
(mrhostel ’setcourse)
(mrhostel ’setsex)
(mrhostel ’setphno)
(mrhostel ‘hostelname)
(mrhostel ‘hostelid)
;(mrhostel ‘displaydetails)
;(mrhostel ‘displayhostel)
(vector-set! s_db 0 mrhostel) ;setting 0th index of vector s_db as mrhostel
(set! copy (vector-ref s_db 0)) ;;copying 0th index of s_db to copy
(copy ‘displaydetails) ;calling fns using copy
(copy ‘displayhostel)  ;calling fns using copy


Inhertitance in Scheme – 2 ways

June 11, 2008

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 (disp)
(display “\n Display of Sub Class”)
)
(lambda (main)
(case main
((1) (super 1))
((2) (super 2))
((3) (subclass1))
((4) (disp))
)
)
)
;;end of sub class

(define sub(subclass))
(sub 1)
(sub 2)
(sub 3)
(sub 4)

Output:-

In Super Class
Display of Super Class
In Sub Class
Display of Sub Class

Second Way

Code :-

;;defn of super class
(define (superclass)
(define (inclass)
(display “\n In Super Class”)
)
(define (disp)
(display “\n Display of Super Class”)
)
(lambda(msg)
(cond
((eqv? msg ‘inclass)(inclass))
((eqv? msg ‘disp)(disp))
)
)
)
;;end of superclass
;;defn of subclass
(define (subclass)
(define super(superclass))
(define (subclass1)
(display “\n In Sub Class”)
)
(define (disp)
(display “\n Display of Sub Class”)
)
(lambda (msg)
(cond
((eqv? msg ’subclass1)(subclass1))
((eqv? msg ‘disp)(disp))
(#t (super msg))
)
)
);;end of sub class

(define sub(subclass))
(sub ‘inclass) ;calls superclass fn
(sub ‘disp)    ;;calls subclass fn(even though super class also has fn called ‘disp
(sub ’subclass1) ;;calls subclass fn
(sub ‘disp)      ;;calls sub class fn

Output :-

In Super Class
Display of Sub Class
In Sub Class
Display of Sub Class


Inheritance in Scheme Programming

June 10, 2008

(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:”)
(set! s_id(read))
(set! student_id s_id)
)

(define (setName)
(display “\n Enter Student Name:”)
(set! s_name(read))
(set! student_name s_name)
)

(define (setCourse)
(display “\n Enter Student Course:”)
(set! s_courseid(read))
(set! student_courseid s_courseid)
)

(define (setSex)
(display “\n Enter the Sex of the Student:”)
(set! s_sex(read))
(set! student_sex s_sex)
)

(define (setPhno)
(display “\n Enter the Phone Number of the Student:”)
(set! s_phno(read))
(set! student_phno s_phno)
)

(define (displaydetails)
(display “\n Student ID:”)
(display student_id)
(display “\n Student Name:”)
(display student_name)
(display “\n Student Course:”)
(display student_courseid)
(display “\n Sex:”)
(display student_sex)
(display “\nStudent Phone Number:”)
(display student_phno)
)

(define (modify_phno)
(display “\n Enter the new Phone Number:”)
(set! s_phno(read))
(set! student_phno s_phno)
)

(lambda (msg)
(cond
[(eqv? msg 'setid)(setID)]
[(eqv? msg 'setname)(setName)]
[(eqv? msg 'setcourse)(setCourse)]
[(eqv? msg 'setsex)(setSex)]
[(eqv? msg 'setphno)(setPhno)]
[(eqv? msg 'displaydetails)(displaydetails)]
)
)
)

;;end of class defn

(define (hostel)
(define stud1(student))
;;DATA MEMBERS
(define hostel_name “”)
(define hostel_id 0)

;;MEMBER FUNCTIONS
(define (setHostelName)
(display “\n Enter Hostel Name:”)
(set! h_name(read))
(set! hostel_name h_name)
)

(define (setHostelId)
(display “\n Enter Hostel ID:”)
(set! h_id(read))
(set! hostel_id h_id)
)

(define (displayHostel)
(display “\n Hostel Name:”)
(display hostel_name)
(display “\n Hostel ID:”)
(display hostel_id)
)

(lambda(msg)
(cond
[(eqv? msg 'hostelname)(setHostelName)]
[(eqv? msg 'hostelid)(setHostelId)]
[(eqv? msg 'displayhostel)(displayHostel)]
[#t (stud1 msg)]
)
)
)

(define mr(student))

(define mrhostel(hostel))

(mrhostel ’setid)
(mrhostel ’setname)
(mrhostel ’setcourse)
(mrhostel ’setsex)
(mrhostel ’setphno)
(mrhostel ‘hostelname)
(mrhostel ‘hostelid)
(mrhostel ‘displaydetails)
(mrhostel ‘displayhostel)