Could anyone tell me something about Scheme Common-Lisp and FASL File - scheme

Can anyone tell me something about this file? As I know:
Common-Lisp and Scheme are both dialects of lisp.
Common-Lisp source file *.lisp can be compiled into binary file *.fasl which can be loaded faster than the source file.
Q:Can the Scheme source code *.scm be compiled into some binary file that will be loaded faster than the source code?
Thanks in advance,
joe

Yes, if the Scheme implementation you're using has that feature.
FASL in Racket: http://docs.racket-lang.org/reference/fasl.html
FASL in Chez Scheme: http://www.scheme.com/csug8/io.html#./io:h15
Alternatively, you could compile your code to native binaries...

Related

How to load files in Scheme lisp

I've been trying to load another file into my Scheme scrip but when I do this,
(load "fn1.lisp")
the error came out as
The port #[input-port 13 for file: "/Users/yiwenzhu/Library/Mobile Documents/com~apple~CloudDocs/work/study/computer/SICP/src_lisp/fn1.lisp"] signalled an error:
The primitive channel-read, while executing the read system call, received the error: Bad address.
How to solve this? Thanks.
load is the only compatible way until R5RS, but after that the standard introduced libraries. Where the files need to be installed is implementation dependent, but the source structure on how to define and use isn't.
Also know that SICP is pre-R5RS so there isn't one modern Scheme implementation that would run the books examples without some compatibility layer. Eg. I have an answer about how to do SICP with DrRacket.
Since we don't know how the file you are trying to include look like or which Scheme implementation you are using I'm afraid I cannot help you further. I can update if you update your question.

What happens when we run a julia-lang script?

In my understanding, julia is a script language with a JIT compiler. But in java, you can find *.class files; In python, you can find *.pyc files. This means java and python need first convert its language to bytecode, then using VM to run this bytecode. However, I can not find the bytecode files for julia like *.jlc. Any ideas?
Actually there is functionality to dump the LLVM bitcode in Julia:
See jl_dump_bitcode.
Thanks to Isiah for pointing out that it is possible to use code_llvm to read the bitcode in the interpreter.
Note that in julia_trampoline this function is used, depending on a build_path option. However this does not seem like an end-user interface to me.
In contrast to other JIT-based software like NodeJS (V8), it is however technically possible to dump the LLVM bitcode.
This is covered in the manual: http://docs.julialang.org/en/release-0.5/devdocs/eval/
Leah Hanson has written an excellent article here on the 5 steps Julia performs to get from Julia code to native Assembly code:

How can I reassemble a disassembled .dylib (Mac OS X) (.asm) that depends on QT?

I disassembled a dylib file using hopper disassembler, this library depends on QT framework. I just changed a few instructions in assembly code and tried to use the option in hopper to "generate new executable". It created a copy of the source file without my changes. I assume that this was because this was a library and not an executable. I could save to an .asm file but now I donĀ“t know how to reassemble the file again to make the library work as before. Do I need to program in XCode to do this? Is there a tutorial in the web I can follow to do this?Can I do this with MonoDevelop? Please let me know as I am toally clueless here. Thanks.
Can't you operate on the library directly with a hex editor?

Debugging multiple files in DrRacket

I am using DrRacket to debug scheme code using the R5RS language. I am trying to debug over multiple files imported using the load function. I opened both files as the instructions on the Dr Racket site says but when debugging, functions from other files are just skipped over.
Any idea of how to debug multiple files in DrRacket?
At the moment, the debugger cannot go over files other than the one in the definitions window.
(In addition, using the R5RS language and load is a bad way to organize code -- using modules is much better.)

How to compile scheme code to a bin file?

I am using a software who has a built-in scheme interpreter. User could communicate and/or manipulate the software by typing command in the interpreter. The interpreter also could load scheme code file or bin file that contain scheme code. I wrote some scheme functions like this:
(define test (lambda(() (display "This is a test!")))
I will use the function "test" in the software interpreter later.
I don't want to anyone to change my code, so how can I compile this function into a bin file and load it to the interperter later?
Thanks a lot!!!
Joe
Interpreters don't run compiled code.
You can compile all your scheme program with scheme compilers but not have an hybrid interpreted/compiled code
http://www.call-cc.org/
Yours

Resources