User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Legacy and Other Languages section within the Software Development category of DaniWeb, a massive community of 455,962 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,578 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.
Please support our Legacy and Other Languages advertiser: Programming Forums
Views: 2060 | Replies: 15 | Solved
Reply
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,878
Reputation: Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold 
Rep Power: 13
Solved Threads: 193
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: Scheme Help

  #11  
Nov 17th, 2007
Just as a random addendum. Above I said you could make your ADT as:
(define (rank card) (car card))
That's fine, but if you really want to wow, forget the fluff and just say:
(define rank car)

Heh heh heh...
Reply With Quote  
Join Date: Jun 2005
Location: Troy
Posts: 1,296
Reputation: Rashakil Fol has a spectacular aura about Rashakil Fol has a spectacular aura about 
Rep Power: 7
Solved Threads: 40
Colleague
Rashakil Fol's Avatar
Rashakil Fol Rashakil Fol is offline Offline
Salamander Man

Re: Scheme Help

  #12  
Nov 24th, 2007
Originally Posted by Duoas View Post
There are no procedures in scheme, only functions.

There are no functions in Scheme, only procedures. That is, the word used in the R5RS specification (and probably R6RS, but I haven't read that) is "procedure". That's why there is a procedure named procedure? in Scheme, and no procedure named function?.

However, your help to the OP is stellar.
Reply With Quote  
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,878
Reputation: Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold 
Rep Power: 13
Solved Threads: 193
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: Scheme Help

  #13  
Nov 24th, 2007
Thanks. Please keep in mind that the OP (and most other readers here) haven't read (nor will they) the R5RS.

The R5RS committee needed a word for a technical thing. They chose poorly (though, considering the circumstances and the technical issues, I don't blame them).

A "procedure" is a very broad term. In most computing contexts that I am aware of, procedures return value by way of side-effect only, whereas functions explicitly return value.

In Scheme, a combination (a lambda), is a function call: local values are bound to an expression which is evaluated for value. That value then replaces the local context. Please keep in mind that this is a functional operation --hence the term functional languages.

Please understand that I'm not being rude. You are very correct. However, you must be careful not to confuse those reading here with those who care about all the technicalities and terminologies specific to functional languages and Scheme in particular.

To be short: in Scheme it is meaningless to talk about the difference between a procedure and a function. But in the minds of programmers everywhere, unfamiliar with Scheme, the difference is in "how do I then get this value to be passed out of the procedure". The answer is, there are no procedures in scheme (or any other functional language). Only functions (or lambdas) that evaluate to (or "return") a new value. You pass a value out by evaluating to that value.

I hope I've explained my choice in language to everyone's satisfaction. If you are a Scheme junkie, know that I am too (it is my all-time favorite functional language, and I've used it in professional contexts). I know as well as you that in Scheme combinations are called "procedures". I don't take this as an excuse to use terms that confuse rather than help the poor saps struggling to figure this stuff out. By the time they get to the point where they read the R5RS about procedure?, they will already know enough to bridge the gap.

Hope this helps.
Reply With Quote  
Join Date: Nov 2007
Posts: 8
Reputation: nanaman is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
nanaman nanaman is offline Offline
Newbie Poster

Re: Scheme Help

  #14  
Nov 26th, 2007
Thanks so much for all the help Duoas, rep points coming your way, got the assignment all working and handed in, again thanks
Reply With Quote  
Join Date: Jun 2005
Location: Troy
Posts: 1,296
Reputation: Rashakil Fol has a spectacular aura about Rashakil Fol has a spectacular aura about 
Rep Power: 7
Solved Threads: 40
Colleague
Rashakil Fol's Avatar
Rashakil Fol Rashakil Fol is offline Offline
Salamander Man

Re: Scheme Help

  #15  
Nov 26th, 2007
Originally Posted by Duoas View Post
In Scheme, a combination (a lambda), is a function call: local values are bound to an expression which is evaluated for value. That value then replaces the local context. Please keep in mind that this is a functional operation --hence the term functional languages.


Well, yeah. I agree with calling functions (when used functionally in Scheme) functions. And calling procedures (when used procedurally, with side effects) procedures.

Of course, Scheme isn't really a functional language. :-) </haskell troll>

I don't understand why you have "(a lambda)" there, saying that a 'lambda (expression?)' is a synonym for the term 'combination', though.
Last edited by Rashakil Fol : Nov 26th, 2007 at 4:22 pm.
Reply With Quote  
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,878
Reputation: Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold 
Rep Power: 13
Solved Threads: 193
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: Scheme Help

  #16  
Nov 26th, 2007
I think that's actually part of the reason they called them procedures, because Scheme allows side effects...

The use of the word "combination" is another one of those Scheme goodies... But in an evaluative/transformational way of thinking it makes sense... (as Scheme is all about list transformation).

Are you in to program transformation too? (All the Haskell junkies I know are into that.)

They all worry about me because I like my side effects being transparent. I don't want to have to dink with monads for every function that uses a function that may have side effects... That's what compilers are for IMO.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Legacy and Other Languages Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Legacy and Other Languages Forum

All times are GMT -4. The time now is 8:59 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC