jcoo092
2020-5-26 07:42:24

I imagine it almost certainly is a bug leftover from my original program, but I haven’t been able to work out where it comes from either


soegaard2
2020-5-26 07:45:08

Just ran it here. Both “mixed” and “mixed!” works.


jcoo092
2020-5-26 07:46:07

Presumably then it’s some difference between our respective CBLAS implementations, I would guess


soegaard2
2020-5-26 07:46:55

What happens if you try this in the repl. (define c (random-column-vector size)) (define r (random-row-vector size)) (define A (random-square-matrix size)) (list c r A) (flmatrix*! A c c) (flmatrix*! r A r) (flmatrix*! c r A) One at a time?


soegaard2
2020-5-26 07:47:19

It could very well be a difference due to CBLAS.


jcoo092
2020-5-26 07:59:12

No errors that time around ¯_(ツ)_/¯


jcoo092
2020-5-26 07:59:27

Welcome to Racket v7.6. > (require "flmatrix.rkt") > (define (rando) (* 1.0 (random 2 256))) > (define (remainder-or-random numerator denominator) (match (remainder numerator denominator) [0.0 (rando)] [rem rem])) > (define (rem-all-by-256! A) (flmatrix-map! A (λ (x) (remainder-or-random x 256)))) > (define (rem-all-by-256 A) (rem-all-by-256! (copy-flmatrix A))) > ;*************************** (define (random-column-vector size) (for/flmatrix size 1 ([_ size]) (rando))) > (define (random-row-vector size) (for/flmatrix 1 size ([_ size]) (rando))) > (define (random-square-matrix size) (for/flmatrix size size ([_ (sqr size)]) (rando))) > (define c (random-column-vector size)) ; size: undefined; ; cannot reference an identifier before its definition ; in module: top-level ; [,bt for context] > (define size 100) > (define c (random-column-vector size)) > (define r (random-row-vector size)) > (define A (random-square-matrix size)) > (list c r A) '((flmatrix 100 1 "...") (flmatrix 1 100 "...") (flmatrix 100 100 "...")) > (flmatrix*! A c c) (flmatrix 100 1 "...") > (flmatrix*! r A r) (flmatrix 1 100 "...") > (flmatrix*! c r A) (flmatrix 100 100 "...")


soegaard2
2020-5-26 08:00:53

Okay. Try a smaller size so you can see the elements. Then try (rem-all-by-256! (flmatrix*! A c c)) and similar for the others. There must some value that trips up rem-all-by256!.


soegaard2
2020-5-26 08:02:27

size 4 for example.


jcoo092
2020-5-26 08:09:21

Hmmm, no issues on one run: > (rem-all-by-256! (flmatrix*! A c c)) (flmatrix: ((148.0) (38.0) (64.0) (70.0))) > (rem-all-by-256! (flmatrix*! r A r)) (flmatrix: ((190.0 213.0 84.0 56.0))) > (rem-all-by-256! (flmatrix*! c r A)) (flmatrix: ((221.0 97.0 48.0 48.0) (206.0 16.0 191.0 234.0) (24.0 119.0 201.0 161.0) (27.0 19.0 78.0 114.0))) I’ll try repeating them a few times and see if anything trips


soegaard2
2020-5-26 08:10:55

That’t the problem with random tests :slightly_smiling_face: I tried to figure out where the +inf.0 came from - but since all numbers are smaller than 256, I can’t see it.


jcoo092
2020-5-26 08:16:01

Yeah, repeated it a bunch of times and didn’t get any errors. I still would guess that it’s some error in my program.


bedeke
2020-5-26 08:56:01

@joe https://github.com/bdeket/RackGame For an RPG game I guess you will only need the first layer (connection-server.rkt) If you want to try it out, let me know then then I’ll start up the server send you my current address.


joe
2020-5-26 09:15:37

@bedeke ok I’ll take a look today. Thanks. Can I host my own server?


bedeke
2020-5-26 09:24:51

I don’t see why not. My start script for windows is laptop.bat, on linux look I use the start.sh After starting, just go to 127.0.0.1/index.html (with firefox or chrome, I didn’t bother to check other browsers)


joe
2020-5-26 09:30:15

bdeket: ok seems simple enough. Thanks very much for this. Will let you know how I get on.


joe
2020-5-26 09:30:33

@bedeke


pocmatos
2020-5-26 15:30:16

I am attempting to reuse pieces of scribble to use scribble/examples in a blog post. What I need is a way to convert the result of examples (which is a compound-paragraph ) to html. My investigation led me to look into the code of render from https://github.com/racket/scribble/blob/9051e6d882b341a29dc37eb95fcf237ab0b9161e/scribble-lib/scribble/render.rkt#L33 However, I keep thinking there must be a more straightforward way than just picking bits and pieces of render to transform the compound-paragraph to html. Does anyone have any insight into this?


cowbs
2020-5-26 16:44:26

Kind of a long shot but is there a way to promote the current parameterization to the macro transformer? I have some parameters defined in a module being referred to by a macro, all inside a module that’s behind a dynamic-require which is itself inside a call to parameterize but since it’s in a different expansion level I’m at a loss as to how to enforce a consistent view


cowbs
2020-5-26 16:46:22

I thought putting the dynamic-require inside something like this might work but to no avail

(define-syntax (call-with-param stx) (syntax-case stx () ((_ stmt0 ...) (quasisyntax/loc stx (call-with-parameterization #,(current-parameterization) (let ([ret (begin stmt0 ...)]) (thunk ret) ) )))))


ben
2020-5-26 16:47:19

@samth does typed racket have any tools / examples for serializing types?

I tried looking at the parse-type tests, but those start with syntax objects. Since then I’ve been trying & failing to read an S-expression like '(-> Symbol Symbol) as a type.


cowbs
2020-5-26 16:47:37

(this is racket 6.8 btw)



samth
2020-5-26 16:48:59

that’s how the type env is persisted between modules


ben
2020-5-26 16:49:34

ok! I’ll check & write back if I get stuck


ryanc
2020-5-26 17:04:07

Basically, no, Racket’s phase separation is designed to prevent that. (There are exceptions involving eval, but eval is usually also the wrong solution.) If you pop up a level and explain what you want to do, maybe we can suggest another way to do it.


cowbs
2020-5-26 17:11:34

@ryanc there’s not much more to it, unfortunately. we have a build system that brings in modules via dynamic-require and we use parameters to control the context (in this case we have multiple projects and the project name is defined as a parameter). The parameters are defined in their own module, which, some levels down in particular place, is brought via (require (for-syntax ...)) because we’re trying to read that parameter in a macro.


notjack
2020-5-26 18:24:10

thinking about this today


notjack
2020-5-26 18:25:49

Stack traces are useful things that ought to be surfaced in more places


joe
2020-5-26 19:09:06

@bedeke so I’m trying to follow the Github instructions step-by-step. Successfully started a pollen server with sudo -E on port 80. Ran a raco pkg install rfc6455 followed by racket games-server.rkt, which returns:


joe
2020-5-26 19:09:49

util.rkt:311:58: Type Checker: parse error in type; type name `A’ is unbound


joe
2020-5-26 19:11:06

Same error when running start.sh


bedeke
2020-5-26 19:12:26

Which version of this racket are you running?


joe
2020-5-26 19:13:18

7.2


bedeke
2020-5-26 19:13:43

I tried running it ( on windows) and it went ok


bedeke
2020-5-26 19:15:12

Maybe you can open the file server/games-server.rkt in drracket and try to run like that


joe
2020-5-26 19:15:30

Good idea. I’ll try that.


bedeke
2020-5-26 19:16:47

For reference, I ran in 7.7 ( I think)


joe
2020-5-26 19:18:04

Same issue. OK. I’ll try to install 7.7. Thanks for the help.


bedeke
2020-5-26 19:36:47

I tried again, and for me this is working without problems. Also the line-number is a bit strange… Typevar A is referenced in the lines before, apparently without problem


joe
2020-5-26 19:38:32

bdeket: I will try again soon. Just trouble installing Racket 7.7 on Ubuntu.


sorawee
2020-5-26 21:00:44

How does Typed Racket “attach” static information to an existing binding?

(: a Number) (define a 1) Expanding (: a Number) to (define-syntax a ... Number ...) doesn’t seem to work because (define a 1) exists already, so that would result in “identifier already defined” error. I suppose I could use #%module-begin to collect both (: a Number) and (define a 1) before expanding to (define-syntax a ... Number ... 1 ...), but then I also need to do the same for every form with the internal definition context, which sounds really painful.


samth
2020-5-26 21:03:23

@sorawee it uses a mutable hash table, keyed on identifiers. We wrote two papers about it, which I recommend.


samth
2020-5-26 21:04:46

Probably the “easiest” thing to do to cheat the system is to persist the data externally to racket — in a file, or an environment variable, or something else like that. The grossness of that solution basically indicates the degree to which it’s probably a bad idea.


cowbs
2020-5-26 21:21:46

Since the current parameters default to environment variables the hack workaround I’m using for now is to putenv the current parameter value before dynamic-require. so, yeah, gross.


alexknauth
2020-5-26 21:39:13

So Typed Racket uses a mutable table, but other typed languages based on Turnstile/Type-Systems-as-Macros can still have (: a Number) (define a 1) With the (define-syntax a ... Number ...) method. They can avoid the “identifier already defined” error by changing define so that it recognizes when an identifier has already been declared by :, and defines a different identifier instead, set up so that the define-syntax a earlier is an identifier macro that can expand to that different identifier to be defined later


alexknauth
2020-5-26 21:41:27

@sorawee I’m curious are you asking about this because of Typed Racket specifically, or another language you’re working on?


sorawee
2020-5-26 21:42:05

I’m thinking of how to attach the indentation information (https://github.com/racket/rhombus-brainstorming/issues/108)


sorawee
2020-5-26 21:43:00

Actually, I did even try the syntax/id-table approach, but two different bindings with the same name are considered the same. I guess I did something wrong…


sorawee
2020-5-26 21:43:34

And yes, I should have read the Typed Racket papers…


samth
2020-5-26 21:48:17

Start with the scheme workshop 07 paper


sorawee
2020-5-26 21:50:51

Thanks!


notjack
2020-5-26 22:26:24

@sorawee You can also arrange for module-begin to locally expand the body and look for annotations to attach to definitions within the body. This is also how you can implement static overloads or case-by-case definitions of functions that pattern match on their arguments.


notjack
2020-5-26 22:28:01

Avoids the global state of an identifier table and avoids conditional definition logic (like “define this unless it’s already defined”)


samdphillips
2020-5-26 22:59:54

Minimal Racket CS 7.7 doesn’t appear to provide libracketcs.a ?


greg
2020-5-27 01:14:02

@sorawee Regardless of how it is expressed in syntax and handled in expansion, it might be worth having a discussion about what the result is, where it is stored, and how it is accessed by tools? For example that Clojure macro indent spec thing is defined by CIDER mode for Emacs, not by Clojure. Also their indent info cannot be accessed unless you have a live REPL namespace in which the macro is defined. Is that desirable, for us? I’m not sure. As a possible alternative, what if indentation information were handled more like documentation — i.e. extracted as part of building, and stored in a “database”? So that tools and editors could access it without needing to instantiate, or even fully-expand, a module that defines it?


greg
2020-5-27 01:16:01

I don’t know the right answer. I mean, of course I lean toward things that are easier to do outside of Dr Racket. Meaning, generally, some sort of data representation (vs. “call this Racket function to indent”), and easy to access and marshal across non-Racket process boundaries. I lean that way, but that way has pros and cons, both.


naoyafurudono
2020-5-27 01:51:02

@naoyafurudono has joined the channel


notjack
2020-5-27 05:35:31

@greg @sorawee I think “attached to bindings” and “easy to serialize” are both necessary features for indentation information. I can’t see how to make a good language-agnostic indenter without either. If it’s not attached to bindings, it’s hard to get tools to find the information, especially for local macros. If it’s not easy to serialize, it’s hard to make tools fast and resilient in the face of code that doesn’t compile.


notjack
2020-5-27 05:37:26

Slightly related: why on earth does the racket style guide recommend wrapping lines at the seemingly bizarre number of 102 columns? 80, 100, and 120 all seem like sensible numbers… where did 102 come from?


notjack
2020-5-27 05:37:43

jesse
2020-5-27 05:45:53

@spdegabrielle any plans for a second Standard Fish Competition? I believe you mentioned at the last Racketfest that you were tentatively thinking of doing a second round