[plt-scheme] Scheme: Subroutines

From: Ewan Higgs (ewan_higgs at flyingpig.com)
Date: Wed Sep 8 12:23:25 EDT 2004

Noel Welsh wrote:

> I'm really confused.  What some languages call subroutines
> are called functions in Scheme, and are the core of the
> language.

Sub-routines don't return values. Essentially, a void function in C/C++. 
AFAIK, they don't exist in Scheme.

Mr. Wentworth is looking for the word 'Factory'. A function, that will 
return an object that depends on the arguments.

 > I am looking for a way to write myframesubroutine% and use it to
 > produce a window with these values:
 > (x 175)(y 175)(height 300)(width 600)

(define MyFrame-Factory
   (lambda (caption_)
     (new frame% (caption caption_)
                 (x 175) (y 175)
                 (width 600) (height 300))))

(define my-frame (MyFrame-Factory "Hello, World"))

Otherwise, it is possible that Phillip would like a subclass of myframe 
with predetermined parameters. An example of this can be found at:

http://schemecookbook.org/Cookbook/GUIWidgetAggregation

Regards,
Ewan

-- 
# Ewan Higgs
# Developer
# +44 07751745851



Posted on the users mailing list.