Re: [racket-users] Working out which directory the current code was loaded from?

2020-07-27 Thread Peter W A Wood
Many thanks Philip The resulting code is much neater and, to me, more readable: (define-runtime-path foo.txt "foo.txt") (define-runtime-path bar.txt "bar.txt") (define-runtime-path outfile.txt "outfile.txt") (define-runtime-path Data/portfolio.csv "../../Data/portfolio.csv") (define-runtime-path

Re: [racket-users] Working out which directory the current code was loaded from?

2020-07-27 Thread Philip McGrath
For this particular purpose, you want `define-runtime-path`: https://docs.racket-lang.org/reference/Filesystem.html#%28part._runtime-path%29 -Philip On Mon, Jul 27, 2020 at 9:38 PM Peter W A Wood wrote: > I have a short racket program/script that reads a file from the directory > in which it i

[racket-users] Working out which directory the current code was loaded from?

2020-07-27 Thread Peter W A Wood
I have a short racket program/script that reads a file from the directory in which it is stored. The directory structure is something like this: a/ b/ c/ my-racket.rkt my-data-file.txt

Re: [racket-users] Does Racket interpreter exist?

2020-07-27 Thread zeRusski
> > The best way to distinguish compilers from interpreters is that a > compiler takes a program and produces another program, whereas an > interpreter takes a program (along with some input) and produces an > answer. > Doesn't this trivialize the difference a bit too much? Does it really com

Re: [racket-users] Does Racket interpreter exist?

2020-07-27 Thread Sam Tobin-Hochstadt
A few thoughts on interpreters vs compilers: - somewhere, there has to be an interpreter -- the x86 chip in my laptop is interpreting the x86 code that Racket generates. - there could certainly be a more direct AST-based interpreter for (fully-expanded) Racket. My work on Pycket involved writing s

Re: [racket-users] Does Racket interpreter exist?

2020-07-27 Thread zeRusski
Thank you for this fantastic reply Sam! I now think I had a very naive model of "interpreter" when I asked the question. My CS degree from the nowhere university has it that language interpreters walk the tree and you know "execute" be it in the host language or generating native code. I feel a

Re: [racket-users] with-continuation-marks in errortrace

2020-07-27 Thread 'John Clements' via Racket Users
Let me jump in here and say a few things that maybe everyone already knows :). The stepper’s annotation places a *ton* of annotation on a computation, and allows the reconstruction of the full computation. Errortrace does less, and provides less. The both share a goal of allowing the programmer

Re: [racket-users] Re: with-continuation-marks in errortrace

2020-07-27 Thread Matthew Flatt
At Sun, 26 Jul 2020 20:21:56 -0700, Sorawee Porncharoenwase wrote: > I have been toying with another way to instrument the code. It roughly > expands to: > > (define-syntax-rule (wrap f) > (call-with-immediate-continuation-mark >'errortrace-k >(λ (k) > (let ([ff (thunk f)]) >

Re: [racket-users] Re: with-continuation-marks in errortrace

2020-07-27 Thread Shu-Hung You
Thinking about your example again, is the idea here to preserve the first (so perhaps outermost) continuation mark information, instead of the innermost continuation mark? I don't yet fully understand how this approach interacts with the evaluation of tail position expressions, but keeping both see