
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

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

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

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?

It could very well be a difference due to CBLAS.

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

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 "...")

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!.

size 4 for example.

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

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.

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.

@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.

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

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)

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

@bedeke

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?

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

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)
)
)))))

@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.

(this is racket 6.8 btw)

Yes, you should probably look at https://github.com/racket/typed-racket/blob/master/typed-racket-lib/typed-racket/env/init-envs.rkt#L74

that’s how the type env is persisted between modules

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

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.

@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.

thinking about this today

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

@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:

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

Same error when running start.sh

Which version of this racket are you running?

7.2

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

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

Good idea. I’ll try that.

For reference, I ran in 7.7 ( I think)

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

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

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

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.

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

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.

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.

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

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

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

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…

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

Start with the scheme workshop 07 paper

Thanks!

@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.

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

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

@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?

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 has joined the channel

@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.

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?

(see Line Width in https://docs.racket-lang.org/style/Textual_Matters.html)

@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