andre
2020-8-17 15:30:31

Good afternoon friends,

I’m trying to build a distributable version of my little Gemini browser:

https://git.sr.ht/~soapdog/fafi-browser

The source folder contains a main.rkt which has (module+ main ...) in it. I thought that selecting that file and using the menu to create a distribution should work. I also tried to come up with a build script based on Alex build script for ActivityLog2:

https://git.sr.ht/~soapdog/fafi-browser/tree/maybe-build/build.rkt

What is happening is that everything appears to build correctly on first glance but nothing happens when I try running the Fafi.exe file. If I try running it like Fafi.exe -v I get a Racket v7.7 banner which makes me think that my main module is not executing. This happens if I use my build script or if I use the menu in DrRacket.

Can someone share some pointers or feedback about where to look to fix this? I greatly appreciate any feedback.


wanpeebaw
2020-8-17 16:56:12

lexi.lambda
2020-8-17 17:02:59

No. “First-class macros” are usually called https://en.wikipedia.org/wiki/Fexpr\|fexprs. They are not very common.


notjack
2020-8-17 17:35:08

They’re also not a good idea


jjsimpso
2020-8-17 17:41:44

I’m looking forward to trying fafi. I have a gopher server I wrote in racket that I build a distributable version of. I use a Makefile to run a handful of ‘raco’ commands. The gist of it is this:


jjsimpso
2020-8-17 17:42:16

SRC_FILES = trie.rkt file-search.rkt corpus.rkt gopher.rkt main.rkt EXE = main DIST_DIR = gopher21

all: gopher21

main: $(SRC_FILES) raco make -v main.rkt raco exe -v main.rkt

gopher21: $(EXE) raco distribute $(DIST_DIR) $(EXE)


jjsimpso
2020-8-17 17:44:25

‘raco make’ compiles the files. ‘raco exe’ builds an executable. And ‘raco distribute’ bundles everything in one directory that can be distributed.


spdegabrielle
2020-8-17 18:02:51

spdegabrielle
2020-8-17 19:39:10

@andre how did you get on? Did it work?


andre
2020-8-17 19:58:22

@spdegabrielle I just managed to make a build that works but the command-line flags I have in my main.rkt are not working as expected. Things like -h and -v are the Racket version and not my own.


andre
2020-8-17 20:17:39

solved by passing #:cmdline '("--") to create-embedding-executable.


andre
2020-8-17 20:17:45

thanks a lot for all the help folks.


i.n.buryan
2020-8-17 20:21:19

@i.n.buryan has joined the channel


spdegabrielle
2020-8-17 20:21:54

:surfer:


camoy
2020-8-17 20:36:27

If you’re interested though you can check out John Shutt’s work on Kernel


sandel.konjevic.teodo
2020-8-17 20:38:06

Hi everyone, I’m having trouble sending a post request from client to server containing many lines of data (a result of using a “select all” functionality). How does one go about compressing a post request in Racket? Any pointers are appreciated.


sorawee
2020-8-17 20:39:25

I’m not familiar with web stuff, but can you clarify what you mean by “having trouble”? What error did you get? Or what was not working?


sandel.konjevic.teodo
2020-8-17 20:44:18

Apologies, I should’ve included the error with my original message.

take: contract violation expected: a list with at least 639 elements given: '(1099 1101 1103 1109 1111 1113 1115 1117 1119 1121 1123 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1160 1161 1162 1163 1164 ... The error occurs when the user submits the form containing the checkboxes. I’m not sure which function in the background is calling “take” so I’m struggling to pinpoint the source of the problem.


jaz
2020-8-17 20:45:52

The problem here is that you’re trying to take more elements than there are.


jaz
2020-8-17 20:46:30

Ah — sorry, I missed the fact that you’re not explicitly calling take, right?


sandel.konjevic.teodo
2020-8-17 20:53:55

I’ll double check for a stray take , but in case I don’t find it, is there any chance it’s being called by some function in the background?


jaz
2020-8-17 20:55:42

I’m unclear on the context here. When you initially posted your question, I thought that you were using an http client function, like post-pure-port, but now I’m wondering if the browser is what’s doing the http post, and your code is server-side.


notjack
2020-8-17 21:01:23

can you run the code with errortrace enabled? that will give a stack trace that should make it easier for us to understand the problem


jaz
2020-8-17 21:08:02

And if the code isn’t private, providing the relevant section, or a link to the repo would be helpful, too.



alexharsanyi
2020-8-18 00:50:04

Is there a limit on the numbers with which bitwise-bit-set? can work? It does not seem to work for me on Racket 7.8 CS with very large numbers:

(for/first ([bit (in-range 0 32)] #:when (bitwise-bit-set? 645656621111111187822534459392 bit)) #t) The above code returns #f (meaning that none of the first 32 bits are set in that number?), however for a smaller number it seems to work: (for/first ([bit (in-range 0 32)] #:when (bitwise-bit-set? 45656621111111187822534459392 bit)) #t) The above is an order of magnitude smaller and returns #t


samth
2020-8-18 01:53:52

Are either of those fixnums?


notjack
2020-8-18 01:55:09

also, are you trying to use a number as a bitstring? if so, I made an actual bitstring? type you could use instead if you like


alexharsanyi
2020-8-18 02:01:10

The example I gave has nothing to do with what I try to acomplish, but in my code I seem to be unable to check if a bit is set for very large numbers, such as 645656621111111187822534459392. I don’t think this is a fixnum, but the documentation for bitwise-bit-set? does not seem to require a fixnum (and if it did, should it not fail?)


samth
2020-8-18 02:01:43

I agree that it should work on bignums, I’m just thinking about what the bug might be


alexharsanyi
2020-8-18 02:03:50

@notjack, no I am not trying to use a number as a bit string. I am trying to convert a latitude - longitude pair onto a distance on the Hilbert curve. The code works for small recursion levels, but fails when the numbers get big.


notjack
2020-8-18 02:05:47

that’s fascinating, why are you trying to do that?


alexharsanyi
2020-8-18 02:08:58

The end result will be code which can (quickly) find a segment defined by a list of GPS points among several thousand tracks with a few million data points. But this is still far away.


alexharsanyi
2020-8-18 02:15:17

Hi @samth, on a different note, can Typed Racket optimise away cond branches?


alexharsanyi
2020-8-18 02:17:08

Basically, in the plot package, I check for invalid parameters using: (cond [(and x-label (not (or (string? x-label) (pict? x-label)))) (printf "** boom = ~a~%" (and x-label (not (or (string? x-label) (pict? x-label)))))) but the branch does not seem to be taken even when x-label is a number (i.e. invalid). I printed out the condition before the cond and it is #t


jaz
2020-8-18 02:17:23

Neither of those are fixnums, so I think it’s subtler than that.


alexharsanyi
2020-8-18 02:18:34

my suspicion is that TR determines that the condition is always true based on the type of the arguments, than unsafe-provide throws away the contract…


mflatt
2020-8-18 02:33:46

I don’t think any of the low 32 bits are set in 645656621111111187822534459392, but the next-to-high bit is set in 45656621111111187822534459392: > (format "~x" 645656621111111187822534459392) "8263aa3ac6a75000000000000" > (format "~x" 45656621111111187822534459392) "93864595d9c8714040000000" Have I misunderstood the problem?


alexharsanyi
2020-8-18 02:35:11

> … if I use #lang typed/racket #:no-optimize than the check works…


jaz
2020-8-18 02:37:01

No, I don’t think you have. Doesn’t seem to be any problem here.


samth
2020-8-18 02:45:33

Then it’s definitely the optimizer


samth
2020-8-18 02:45:45

And yes, that’s what I would expect


samth
2020-8-18 02:46:47

The easiest way around that is probably to make the variable mutable (ie, the target of a set!)


alexharsanyi
2020-8-18 02:48:37

Looks like the problem was with my code, sorry for the trouble…


343519265
2020-8-18 03:45:05

It seems in racketcs, invoking an escape continuation using call-in-continuation is generally faster than calling it directly. And non-composable continuation is even more faster for escaping(assuming not be disturbed by other prompts).


alexharsanyi
2020-8-18 04:21:57

My thought is to just use the #:lang typed/racket/base #:no-optimize — the module does not benefit from any speed improvements anyway, as all it does it checks parameters and forwards the calls into other TR modules, which are optimized. Longer term, it would be good to get rid of the unsafe-provide the only bottleneck, as far as I understand is that the contracts attached to the snip instance are too costly


jestarray
2020-8-18 05:25:14

holy moly my stand alone executable with --embed-dlls is 34MB. how can I cut this down? I’m pulling in 2htdp/image as a dependency so I assume that is the main reason. either way, how do i cut this down? I don’t want other people needing to install racket to use this small cli app


jestarray
2020-8-18 06:07:28

i dont need to draw images really, just crop them