samth
2021-2-1 12:25:18

In which Racket is 16x (or maybe 149x) faster than it was in 2004: https://gist.github.com/samth/2f0996c80ef7e81f8e0aaba32fd7aaf1


spdegabrielle
2021-2-1 12:34:17

I think that is worthy of a Racket News submission @pocmatos


samth
2021-2-1 12:45:52

I did that already


pocmatos
2021-2-1 14:13:32

Thanks for the ping on this… Just preparing today’s issue!


mflatt
2021-2-1 15:27:31

I was curious to confirm where the improvements happened for this program. The JIT in v350 (measured with v352 on Linux i386, release 2006) was responsible for 2.3x improvement, and then flonum unboxing in 4.2.4 (measured with v4.2.5, released 2010) was the remaining 8x improvement. That version is also able to deal with the modern implementation with the same improvement, but not the futures version. The futures version worked with improvement by v5.3 (released 2012) and probably earlier.


samth
2021-2-1 15:30:40

so 4.2.4 performs the same as 8.0 for you?


mflatt
2021-2-1 15:32:01

Close, at least. I didn’t measure precisely. For one thing, I was comparing old 32-bit runs to new 64-bit runs.


samth
2021-2-1 15:32:59

striking that 10 years of compiler change and the switch to CS didn’t change it much


mflatt
2021-2-1 15:34:09

True, but this benchmark is about unboxed floating-point arithmetic. The pattern would be different for different kinds of programs.


a73cram5ay
2021-2-1 16:57:22

@a73cram5ay has joined the channel


a73cram5ay
2021-2-1 16:59:48

Experienced Slack user but relatively new to Racket and newbie on this workspace:

What’s the protocol for asking a question? Just post it here? Thanks …


jestarray
2021-2-1 17:01:40

dont think there is one, just fire away here!


a73cram5ay
2021-2-1 17:07:21

Cool.

I’m trying to this:

(load file)

where file is the fully-qualified path to a file that I’ve confirmed exists (with file-exists?), and I’m getting this:

equality.spec.rkt:1:6: #%top-interaction: unbound identifier;

When I open the file in DrRacket and Run it, it works just fine. The file looks like this:

#lang racket ... some requires ... ... some top-level forms (function calls), no definitions ...

When I run it in DrRacket, the forms just execute as I expect, but I can’t load this file. I want to accomplish the same thing programmatically, i.e., run this file.

What am I missing? Thanks!


mflatt
2021-2-1 17:12:56

Use dynamic-require to load a module dynamically.

The reason load fails is that it evaluates (usually individual expressions) in the current namespace, and the default namespace is empty.


temurson047
2021-2-1 18:55:32

@temurson047 has joined the channel


biogoog
2021-2-1 21:43:44

@biogoog has joined the channel


a73cram5ay
2021-2-1 21:57:02

Bingo! Many thanks.

On a related note (perhaps), when you press the Run button in DrRacket, what operation is it performing on the file that is open/active?


mflatt
2021-2-1 21:59:33

That’s a dynamic-require combined with module->namespace to get a namespace for evaling interactive expressions.


badkins
2021-2-1 22:11:12

I love the line: > I brought up monads above, so it’s a good idea to talk a little about them since they are the pure-functional way of gaining effects. Having written a Ph. D. thesis about them, I think I have some idea about them. :)


a73cram5ay
2021-2-2 00:29:03

:thumbsup:


sorawee
2021-2-2 03:51:24

@jbclements do you mean to pick https://github.com/racket/racket/commit/a5b14d74b7f75e2386dd845413d2ac81c89e6c80 to the release branch as well?


jestarray
2021-2-2 03:51:34

how would I make a struct from a list of values ?


jestarray
2021-2-2 03:52:22

e.g (list 1 2) -> (point 1 2) ?


sorawee
2021-2-2 03:52:36

(apply point (list 1 2))


yilin.wei10
2021-2-2 03:56:10

Just in case I’m duplicating work - I’ve got an implementation for TOTP/HOTP as defined by the IETF RFC’s https://github.com/yilinwei/racket-otp; does this already exist somewhere?


yilin.wei10
2021-2-2 03:56:59

Otherwise I’ll add docs etc…


samth
2021-2-2 03:57:51

I don’t know of one


gknauth
2021-2-2 04:06:39

That’s very useful to me for something I happen to be doing, thanks!


jestarray
2021-2-2 04:07:03

i keep forgetting about apply lol…


notjack
2021-2-2 05:22:12

made a neat thing (define into-average (reducer-zip / into-sum into-count)) > (transduce (list 1 2 3 4 5) #:into into-average) 3


samth
2021-2-2 05:48:55

is that one pass or two?


notjack
2021-2-2 05:49:24

Single pass