[plt-scheme] language levels in drscheme

From: Corey Sweeney (corey.sweeney at gmail.com)
Date: Wed Jan 17 19:56:41 EST 2007

Hey danny.  That must not have come across right.  I'll try a differnt way.

Try doing the following:

menu option language->choose language->plt->pretty big

type in some module:
(module test-lang (lib "plt-pretty-big-text.ss" "lang")
  (provide (all-defined))
  (display "hi there!"))

click the green "run" button...

Nothing happens, cause your language isn't set as "(module ...)"


Now, 90% of my code, must remain outside of modules.  So open another tab,
and type in another program:

(display "this is another program).

then do:
menu option language->choose language->plt->(module ...)

click the green run button

module-language: only module expressions are allowed in:...

because it's not a module.  the idea is that with some tabs having modules,
and some tabs having .scm files, choosing the "(module ...)" drscheme
language for just the tabs with module files would be nice, since it's a
pain to set that on each reload.


I doubt that

(module test-lang (lib "(module ...)" "lang")

would do anything usefull :)

Corey

On 1/17/07, Danny Yoo <dyoo at hkn.eecs.berkeley.edu> wrote:
>
>
>
> On Wed, 17 Jan 2007, Danny Yoo wrote:
>
> > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> > (module test-lang (lib "plt-pretty-big.ss" "lang")
> >  (define (hypotenuse a b)
> >    (sqr (+ (sqrt a) (sqrt b)))))
> > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> Hi Corey,
>
> Oh good grief, that's not the definition of the hypotenuse function...
> *grin*  Sorry about that.
>
>
> But I wanted to add that if you have this as a file, you can then invoke
> it by using REQUIRE.  You'll also probably want to expose the contents of
> the module to the outside world, which is done by using the PROVIDE form.
>
> So, for example:
>
> ########################################################################
> dyoo at dyoo-desktop:~$ cat test-lang.ss
> (module test-lang (lib "plt-pretty-big-text.ss" "lang")
>
>    (provide (all-defined))
>
>    ;; hypotenuse: number number -> number
>    ;; Computes the hypotenuse of a right triangle with legs a and b.
>    (define (hypotenuse a b)
>      (local ((define a*2 (sqr a))
>              (define b*2 (sqr b)))
>        (sqrt (+ a*2 b*2)))))
>
>
> dyoo at dyoo-desktop:~$ mzscheme
> Welcome to MzScheme v369.4 [3m], Copyright (c) 2004-2007 PLT Scheme Inc.
> > (require "test-lang.ss")
> > (hypotenuse 3 4)
> 5
> ########################################################################
>
>
> Finally, have you already seen these?
>
>      http://www.htus.org/Book/Staging/how-to-use-modules/
>
>      http://hkn.eecs.berkeley.edu/~dyoo/plt/modules.text
>
>
> Hope this helps!
>



-- 
((lambda (y) (y y)) (lambda (y) (y y)))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20070117/ca008dc6/attachment.html>

Posted on the users mailing list.