954,554 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?

Dr Scheme example

By mister-fett on Sep 20th, 2004 6:07 pm

Since no one has posted in this forum as of yet, I decided to tap out a quick scheme. This program, when run through the Mr Ed part of dr scheme available from www.drscheme.org , will cause a window to pop up with text and a button. By clicking the button, the text changes, so does the window, and so does the location of the window. Does anyone know what Dr Scheme is besides me on this forum? (there have to be some out of 16,000 users!)

(define start (instantiate frame% ("Welcome to the land")(x 50)(y 50)(height 300)(width 600)))
(define line1 (instantiate message% ("This is a game, and you find yourself in a room" start)))
(define line2 (instantiate message% ("in this room are two things: A sword, and a wand." start)))
(define line3 (instantiate message% ("Obvious exits are north and east." start)))
(instantiate button% () (label "Grab Sword")(parent start)
  (callback (lambda (button event)(send start show #f)(send sword1 show #t))))
(instantiate button% () (label "Grab Wand")(parent start)
  (callback (lambda (button event)(send start show #f)(send sword1 show #t))))
(send start show #t)
(define sword1 (instantiate frame% ("This is a test")(x 100)(y 100)(height 500)(width 800)))
(define msg (instantiate message% ("This whole thing was just a test, so I am not going to complete the game! (sorry!)" sword1)))

I just joined, and am a scheme programmer. So don't think you are all alone here!

dstern
Newbie Poster
1 post since Dec 2004
Reputation Points: 10
Solved Threads: 0
 

I have some scheme experience as well, from a computer science programming languages course I took. No experience with Dr. Scheme though. Lambda! Lambda! Lambda!

cscgal
The Queen of DaniWeb
Administrator
19,427 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 230
 

Looks a little like the old goofy LISP!

vegaseat
DaniWeb's Hypocrite
Moderator
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
 

i'm doing scheme at university... and i need some scheme code to convert a decimal number to binary for an exercise we're doing. does anyone have any ideas?

bexta87
Newbie Poster
1 post since Apr 2005
Reputation Points: 10
Solved Threads: 0
 

I am now in contact with bexta87.
Does anyone else on this forum know scheme?

mister-fett
Light Poster
48 posts since Aug 2004
Reputation Points: 12
Solved Threads: 0
 

1) It looks like LISP because it is LISP. Scheme is a very minimalist version of Common Lisp, and DrScheme is an implementation with some goodies added, such as the GUI library that mr. Fett is using in that example. So you could say PLT scheme is LISP's cousin.
2) As for bexta87's question (although it's a little late for him to do anything iwht the answer), it would depend on your implementation. I know PLT Scheme has a procedure that would do that for you. For more restrictive implementations, you may have to resort to logarithm rules (log base 2 of x equals ln of x over ln of 2) to figure out what order of magnitude you're talking about, then compare it to the next-lowest power of two, if our number is lower, the bit is a zero, if it's higher, the bit is a one and subtract the power of two from our number. Then repeat the comparision process until you get down to 2^0.

Junkbone
Newbie Poster
6 posts since Jan 2006
Reputation Points: 10
Solved Threads: 0
 

i want to take a list's depth i write a code but it is not true can you help about this
(define (E11 lst)
(if (null? lst)
1
(if (list? (car lst))
(max (+ 1 (E11 (car lst))))
(E11 (cdr lst)))))

nwest
Newbie Poster
1 post since Mar 2010
Reputation Points: 10
Solved Threads: 0
 

Welcome to the internet, nwest.

Rashakil Fol
Super Senior Demiposter
Team Colleague
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You