scheme

How to import .class file in a .java file?

柔情痞子 提交于 2019-12-19 06:05:10
问题 What i need to do is as follows: I have a bigloo scheme program (*.scm), then using the bigloo frameworks jvm a class file is generated. I want to use this .class file from a .java file. That is, i need to import this(.class) file as i want to use some functions defined in the scheme file which is now a .class file. How do i do it in Eclipse? i have created two packages one for java and one for the .class file. Then i import the package containing the .class file. But i am not able to use the

How to import .class file in a .java file?

半世苍凉 提交于 2019-12-19 06:05:06
问题 What i need to do is as follows: I have a bigloo scheme program (*.scm), then using the bigloo frameworks jvm a class file is generated. I want to use this .class file from a .java file. That is, i need to import this(.class) file as i want to use some functions defined in the scheme file which is now a .class file. How do i do it in Eclipse? i have created two packages one for java and one for the .class file. Then i import the package containing the .class file. But i am not able to use the

(Scheme) Recursive function to compute all possible combinations of some lists?

邮差的信 提交于 2019-12-19 04:14:30
问题 What is an example of a recursive function to compute all possible combinations of lists? For example, (combine (list 1 2 3) (list 1 2)) should return '((1 1) (1 2) (2 1) (2 2) (3 1) (3 2)) . 回答1: Here's my solution. Requires SRFIs 1 and 26 to be available. (define (cartesian-product first . rest) (define (iter l result) (define (prepend-all x) (map (cut cons <> x) l)) (concatenate (map prepend-all result))) (map reverse (fold iter (map list first) rest))) 回答2: Here's my take; I first define

Why higher order procedures?

非 Y 不嫁゛ 提交于 2019-12-19 03:22:23
问题 So if a language provides higher order procedure then I can have procedure that returns procedure. Something like: (define (Proc a b c) (lambda (x) ( #| method body here in terms of a b c and x |# ))) To create new procedure, I would just do something like: (define ProcA (Proc a1 b1 c1)) ; Would create ProcA that has 1 argument Similar task could be done in a language which does not support higher order procedure by defining Proc that takes 4 instead of 3 arguments and calling this procedure

Why higher order procedures?

妖精的绣舞 提交于 2019-12-19 03:22:09
问题 So if a language provides higher order procedure then I can have procedure that returns procedure. Something like: (define (Proc a b c) (lambda (x) ( #| method body here in terms of a b c and x |# ))) To create new procedure, I would just do something like: (define ProcA (Proc a1 b1 c1)) ; Would create ProcA that has 1 argument Similar task could be done in a language which does not support higher order procedure by defining Proc that takes 4 instead of 3 arguments and calling this procedure

File I/O operations - scheme

不想你离开。 提交于 2019-12-19 03:20:49
问题 Can someone point me to basic file I/O operations examples in Scheme? I just want to try basic read/write/update operations on a file. Finding it difficult as not having appropriate resources to learn from. 回答1: It's mostly implementation-specific. Given that you're using racket, see the guide section and the reference manual. 回答2: The easiest way to read/write files in any R5RS compliant Scheme is: ;; Read a text file (call-with-input-file "a.txt" (lambda (input-port) (let loop ((x (read

Running SICP Pattern Matching Rule Based Substitution Code

蓝咒 提交于 2019-12-18 11:53:24
问题 I have found the code from this lesson online (http://groups.csail.mit.edu/mac/ftpdir/6.001-fall91/ps4/matcher-from-lecture.scm), and I am having a heck of a time trying to debug it. The code looks pretty comparable to what Sussman has written: ;;; Scheme code from the Pattern Matcher lecture ;; Pattern Matching and Simplification (define (match pattern expression dictionary) (cond ((eq? dictionary 'failed) 'failed) ((atom? pattern) (if (atom? expression) (if (eq? pattern expression)

Which language in DrScheme for SICP?

江枫思渺然 提交于 2019-12-18 11:51:52
问题 I have been using the Module for SICP in DrScheme 4.2 but which language has the best support for SICP in DrScheme? Has anyone here tried this? Thanks. 回答1: I don't think you need anything but R5RS which is available in DrScheme via Language > Choose Language... . You might want to allow redefinition of bindings. After you have selected R5RS, click on " Show Details " and uncheck " Disallow redefinition of initial bindings ". Some places in the text uses an error function, which is not

A “pure” scheme implementation (R5RS) of SHA256?

杀马特。学长 韩版系。学妹 提交于 2019-12-18 11:13:46
问题 I can use SHA256 in Scheme using external libraries (Java, C or system dependent) or using a specific Scheme implementation (like Chicken e.g.), but I wonder if there is a "pure" scheme implementation. 回答1: I wrote an implementation today. Alas, R5RS has neither bytevectors nor binary I/O, so this uses the R7RS APIs for bytevectors and binary I/O. It should be easy to bridge those APIs to your Scheme implementation's native APIs (for example, I actually tested my implementation on Racket and

How do I get a scheme interpreter working inside Emacs?

被刻印的时光 ゝ 提交于 2019-12-18 10:26:10
问题 I'm going through SICP and I'd like to have an interpreter analogous to the interactive Python interpreter to play around in while I'm watching the lectures and reading the book. Furthermore, I'd like this interpreter to run inside Emacs so I can jump back and forth between files of scheme code and the interactive interpreter and so forth. However, I'm fairly new to Emacs and have not as of yet been able to get this to work or find one clear set of instructions to use in getting it to work.