•
•
•
•
What is DaniWeb IT Discussion Community?
DaniWeb is a massive community of 373,565 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,859 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
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)))
Comments (Newest First)
Junkbone | Newbie Poster | Jan 20th, 2006
•
•
•
•
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.
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.
mister-fett | Light Poster | Aug 29th, 2005
bexta87 | Newbie Poster | Apr 20th, 2005
•
•
•
•
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?
vegaseat | Kickbutt Moderator | Dec 31st, 2004
•
•
•
•
Looks a little like the old goofy LISP!
cscgal | The Queen of DaniWeb | Dec 16th, 2004
•
•
•
•
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!
dstern | Unverified User | Dec 10th, 2004
•
•
•
•
I just joined, and am a scheme programmer. So don't think you are all alone here!
Post Comment
•
•
•
•
DaniWeb Marketplace (Sponsored Links)
Does anyone else on this forum know scheme?