wanpeebaw
2020-11-22 10:48:53

Any suggestion to make it more scheme-way or racket-way?


kellysmith12.21
2020-11-22 11:45:14

One thing that would make it more Racket-like would be that you can define a bf language. Since the syntax is very simple, that would be a pretty easy task.


kellysmith12.21
2020-11-22 11:45:47

Then, you can use #lang bf to write programs.


kellysmith12.21
2020-11-22 11:46:32

Another possibility would be to change the (run) procedure to use a functional style. Strictly speaking, that might reduce efficiently, but not necessarily by much. And, it would be a good exercise in using immutable data.


laurent.orseau
2020-11-22 12:47:07

I guess the main point is “avoid eval” :wink:


wanpeebaw
2020-11-22 13:57:22

@kellysmith12.21 > Then, you can use #lang bf to write programs. Thanks for the suggestion. Actually, that’s my starting point. https://gist.github.com/sleepnova/835b1df4029c0d03764f8bcdc33b96d6 But I need something that can read a bf program file and then execute it on the fly. So I don’t have to copy and paste every bf program into a file starting with #lang bf.


laurent.orseau
2020-11-22 13:59:14

That can be a different story indeed, although you could also use dynamic-require and friends.


wanpeebaw
2020-11-22 14:10:58

@laurent.orseau Many thanks, you helped me get ride off this line. (eval '(require 'bf-module) ns) Can you help me get ride off this line too? (eval bf-module ns) What do you mean by “friends”?

Can I avoid eval while still read-translate-load-execute my code dynamically through Racket’s JIT compiler engine?



laurent.orseau
2020-11-22 14:13:04

(if needed)


laurent.orseau
2020-11-22 14:15:06

If the program to execute is written in #lang bf , you can simply dynamic-require the program file without using eval (you’ll need to parameterize the namespace with a new one though)


laurent.orseau
2020-11-22 14:16:14

if you need to execute the same program a second time in the same namespace, you will need dynamic-rerequire. If you create a new namespace each time, dynamic-require should be enough


wanpeebaw
2020-11-22 14:30:38

Or maybe I have to write a macro which expand a bf program file path to a Racket syntax object?


laurent.orseau
2020-11-22 14:33:12

oh you mean you want to read user input like with a REPL?


laurent.orseau
2020-11-22 14:33:32

for REPLs, using eval is legitimate


laurent.orseau
2020-11-22 14:33:55

(but if you only ever read from file, then you generally don’t need it)


kellysmith12.21
2020-11-22 14:35:13

If the user is writing programs at a REPL, perhaps defining a #lang and providing #%top-interaction would be appropriate?


laurent.orseau
2020-11-22 14:36:19

(Also, minor thing: Regarding style, the <https://docs.racket-lang.org/global/index.html|docs for global> say that by convention global ids are surrounded by . So I guess it should be *file*. Note that the won’t appear in the command line arguments)


wanpeebaw
2020-11-22 14:36:33

I only want to execute a bf program from file. Don’t have to be interactive in REPL.


laurent.orseau
2020-11-22 14:37:09

Ok, good, that simplifies things a little.


laurent.orseau
2020-11-22 14:38:05

Then I’m not sure why you ask about this: > Or maybe I have to write a macro which expand a bf program file path to a Racket syntax object?


wanpeebaw
2020-11-22 15:28:12

@laurent.orseau I was thinking about how to achieve the same goal without using eval. Is there any better or right way to dynamically generate a module and make it compile and load from Rackets VM?


badkins
2020-11-22 16:55:27

FYI - after receiving a non-objection from @greg :), I created a #frog channel for Frog users to share tips, ask questions, etc.


soegaard2
2020-11-22 16:56:54

laurent.orseau
2020-11-22 17:00:15

You’re not happy with the user having to write modules like: #lang bf +++++[-&gt;&gt;&gt;++&lt;&lt;&lt;]&gt;&gt;&gt;. ?


laurent.orseau
2020-11-22 17:01:02

(because this really is just a module that you can require, as long as you require the bf language in the namespace first)


samdphillips
2020-11-22 17:33:41

Are #:defaults and #:fast-defaults predicates tested in order of definition in define-generics ?


d_run
2020-11-22 20:13:24

Want to install Racket CS on Raspian Arm64 - Reading https://github.com/racket/racket/blob/master/build.md#11-git-repository-versus-source-distribution and it suggests I should install from a snapshot. So I downloaded racket-7.9.0.6-arm-linux-cs.sh which is 265mb and I have no idea what I am supposed to do with it


soegaard2
2020-11-22 20:14:02

It’s a shell script (it ends in sh) - so you are meant to run it.


d_run
2020-11-22 20:14:11

okay so i need to chmod -x?


soegaard2
2020-11-22 20:14:56

yes - I think sh racket-7.9.0.6-arm-linux-cs.sh also works.


d_run
2020-11-22 20:19:05

that worked great thanks!


soegaard2
2020-11-22 20:19:17

Great.


d_run
2020-11-22 20:31:59

Next Q: I installed the minimal version, but raco is missing make, exe and distribute - which packages do I need to install to get them? I don’t see anything obvious in the package directory


d_run
2020-11-22 20:32:55

soegaard2
2020-11-22 20:33:54

Yes, I think it is compiler you need.


d_run
2020-11-22 20:34:23

oof SSL fail


d_run
2020-11-22 20:34:28

Resolving "compiler" via <https://www.cs.utah.edu/plt/snapshots/20201120-b9e1294/catalog/> ssl-make-client-context: requested protocol not supported; SSL not available; check `ssl-load-fail-reason' requested: 'auto


d_run
2020-11-22 20:35:35

$ openssl version OpenSSL 1.1.1d 10 Sep 2019


d_run
2020-11-22 20:37:23

I see a very lengthy manual build in my future


kellysmith12.21
2020-11-22 20:49:50

If I want to prevent control from escaping an expression, is it correct to install a continuation barrier around the expression?


ryanc
2020-11-22 21:05:04

If you run (require openssl) and then ssl-load-fail-reason in the Racket repl, what do you get?


ryanc
2020-11-22 21:14:36

Continuation barriers prevent jumps back in. For example, in (+ (f) (g)), f could capture a continuation and store it somewhere and then g could invoke it. If you put a barrier around the call to f, then g can’t use that continuation because it would cross the barrier.


ryanc
2020-11-22 21:14:50

You might want dynamic-wind.


kellysmith12.21
2020-11-22 21:18:37

I could use dynamic-wind and have the post-thunk raise an exception.


kellysmith12.21
2020-11-22 21:28:12

Related, how do I guarantee that call/cc doesn’t capture beyond an expression, is that a case for prompts?


d_run
2020-11-22 21:29:30

&gt; ssl-load-fail-reason "ffi-lib: could not load foreign library\n path: libcrypto.so\n system error: libcrypto.so: cannot open shared object file: No such file or directory"


d_run
2020-11-22 21:33:24

I do have OpenSSL installed


ryanc
2020-11-22 21:34:23

Yes, kind of. But prompts have tags, and you can jump past a prompt if there is a prompt with another tag outside it, and if you have a reference to the outer tag.


mwblakley
2020-11-22 21:37:34

might try (get-lib-search-dirs) and make sure libcrypto.so is on one of those paths


ryanc
2020-11-22 21:37:48

Thanks. What are the specific suffixes in /usr/lib for libcrypto.so and libssl.so? (For example, libssl.so.1.1?)


d_run
2020-11-22 21:39:44

hmmm i don’t see it in /usr/lib


d_run
2020-11-22 21:40:18

@mwblakley do i need to require a pkg for that?


ryanc
2020-11-22 21:40:24

One thing that may fix your problem is installing the libssl-dev package. That package includes a link from libssl.so and libcrypto.so to the specific versions of those libraries that are installed. Racket doesn’t always know about the most recent .so versions.


ryanc
2020-11-22 21:41:00

Try find /lib /usr/lib -name 'libcrypto.so*'


ryanc
2020-11-22 21:41:39

The actual library files are often in an architecture-specific subdirectory, and I don’t know that that is for your system.


d_run
2020-11-22 21:42:12

/usr/lib/aarch64-linux-gnu/libcrypto.so /usr/lib/aarch64-linux-gnu/libcrypto.so.1.1


ryanc
2020-11-22 21:45:34

Thanks. That means it’s not the problem I was thinking of, though, and now I’m stumped.


kellysmith12.21
2020-11-22 22:02:14

Ah. Is there no way to totally prevent capture beyond a given expression?


d_run
2020-11-22 22:31:00

tbh i’m also confused by the new build instructions. Have been unable to build from source off tag v7.9 using make from the top level.


d_run
2020-11-22 22:31:48

fails building Chez

compiling <http://cpnanopass.ss\|cpnanopass.ss> with output to cpnanopass.patch Killed make[12]: *** [Mf-base:307: cpnanopass.patch] Error 137 make[11]: *** [Mf-boot:25: tarm64le.boot] Error 2 make[10]: *** [Makefile:59: tarm64le.bootquick] Error 2 make[9]: *** [Makefile:58: tarm64le.bootquick] Error 2 make[9]: Leaving directory '/home/pi/github/racket/racket/src/build/cs/c/ChezScheme' make[8]: *** [Makefile:140: pb-bootquick] Error 2 make[8]: Leaving directory '/home/pi/github/racket/racket/src/build/cs/c' make[7]: *** [Makefile:134: scheme-via-pb] Error 2 make[7]: Leaving directory '/home/pi/github/racket/racket/src/build/cs/c' make[6]: *** [Makefile:118: scheme] Error 2 make[6]: Leaving directory '/home/pi/github/racket/racket/src/build/cs/c' make[5]: *** [Makefile:76: cs] Error 2 make[5]: Leaving directory '/home/pi/github/racket/racket/src/build/cs/c' make[4]: *** [Makefile:287: cs-base] Error 2 make[4]: Leaving directory '/home/pi/github/racket' make[3]: *** [Makefile:271: cs-minimal-in-place] Error 2 make[3]: Leaving directory '/home/pi/github/racket' make[2]: *** [Makefile:145: plain-in-place] Error 2 make[2]: Leaving directory '/home/pi/github/racket' make[1]: *** [Makefile:142: in-place] Error 2 make[1]: Leaving directory '/home/pi/github/racket' make: *** [Makefile:138: main] Error 2


d_run
2020-11-22 22:34:46

Also

&gt; (get-lib-search-dirs) '(#&lt;path:/home/pi/.local/share/racket/snapshot/lib&gt; #&lt;path:/home/pi/racket-7.9.0.6/lib&gt;)


d_run
2020-11-22 22:36:15

Maybe the snapshot is looking in the wrong place?


d_run
2020-11-22 22:46:48

If I want to build a minimal racket from source on Arm64 (Raspian) what do I need to run, I can’t really figure out what to do from https://github.com/racket/racket/blob/master/build.md


d_run
2020-11-22 22:47:48

Previously I needed to do some kind of configure incantations but it seems like the guide has been updated quite a bit, an tbh I just want to know what I need to do to get this to build.


ryanc
2020-11-22 22:51:41

You could run it in a new thread. Or if you know there are no prompts with other tags in the context, you can use a prompt.


d_run
2020-11-22 23:04:24

Currently the build is failing with

Load <http://back.ss\|back.ss> compiling <http://library.ss\|library.ss> with output to /home/pi/github/racket/racket/src/build/cs/c/ChezScheme/boot/tarm64le/library.so fx-: contract violation expected: fixnum? given: 1152921504606846975 context...: {cp0 unique164968} {finish-compile unique363235} {do-compile-file unique363531} /home/pi/github/racket/racket/src/ChezScheme/rktboot/make-boot.rkt:171:0 body of "/home/pi/github/racket/racket/src/ChezScheme/rktboot/make-boot.rkt" body of "/home/pi/racket-7.9.0.6/collects/setup/main.rkt"


sorawee
2020-11-23 01:06:39

I made another version which is closer to Racket’s parameter, but it uses box instead of thread-cell, and uses hasheq instead of Chez Scheme’s intmap, and doesn’t support fancy features like derived parameters. In Matthew’s benchmark, my get is as efficient as native get, but set is about twice faster.


samth
2020-11-23 01:39:37

I think @mflatt made some 32 bit related changes that might be relevant — are you on the latest HEAD


d_run
2020-11-23 01:46:27

I’m on tag v7.9


d_run
2020-11-23 01:46:37

can switch to head


samth
2020-11-23 01:46:55

Worth a try at least


d_run
2020-11-23 02:03:57

yah same error


samth
2020-11-23 02:07:30

:(


samth
2020-11-23 02:07:35

Maybe report a bug


phanthero
2020-11-23 03:29:01

To Org Mode & Racket users out there: For keeping an archive of web-based notes during university, would it better to use Frog / Scribble/ Pollen (or maybe something else with Racket), or would it be conducive to use Org Mode (which is plain text and very easy to organize when used with Emacs) and use the simple html-export, which can create websites like <http://doc.norang.ca/org-mode.html#HowToUseThisDocument|this one> or <http://olivierberger.org/|this one> ?


phanthero
2020-11-23 03:29:19

Never really used Frog/Scribble/Pollen so not sure


sorawee
2020-11-23 04:26:08

Personally I’d just use Org Mode. Pollen could potentially work if you invest a lot of time with it, but Org Mode will work for you from the start.


sorawee
2020-11-23 04:48:24

To me, the main perk of Org Mode is not the language itself, but it’s the ability to integrate with the editor (Emacs) so that you can take note quickly. Pollen, when set up properly, will provide a better language than that of Org Mode, but you will still lose the editor integration.