Load Library from String

Apr 8, 2011 at 11:47 AM

Hi,

is there a way to load a library into ironscheme without using "(import (xx))", so that i don't have to create a library file. I would like to just execute the content of the library and use it afterwards.

Any suggestions?


Cheers

Sebastian

Coordinator
Apr 8, 2011 at 12:23 PM

INCLUDE should do what you are looking for.

Example:

(include "somefile.ss")

This will 'inject' the content of that file where you call INCLUDE.

Apr 8, 2011 at 12:44 PM

Hi leppie,

thanks for that suggestion, but i meant to load a library just without a file. I am generating the library within c# code and just want to use it in ironscheme.

For example, i generate four scheme functions in c# like this:

 

(define (MyFun msg)
      (.............))

(define (MyFun1 msg)
      (.............))

(define (MyFun2 msg)
      (.............))

(define (MyFun3 msg)
      (.............))

And now i want to use them within ironscheme. I know that i just could evaluate them in the scheme engine but thats alot slower than writing them into a file and load it as a library:

(library (AppStack)
    (export MyFun
               MyFun1
               MyFun2
               MyFun3)

(define (MyFun msg)
      (.............))

(define (MyFun1 msg)
      (.............))

(define (MyFun2 msg)
      (.............))

(define (MyFun3 msg)
      (.............))

)

So i would like to generate library code (as shown) but instead of writing it to the file i would like to just Evaluate it in the scheme engine and use it afterwards. I already tried to evaluate it but the methods weren't found when i tried to use them.

 

Cheers

Sebastian