
Quiz of the day
Predict the result of (require math) (sgn –0.0)

How does the backing scale affect the look of DrRacket?

I’m putting together a list of tools that coudl be used for the summer picture competition;
Libraries that can be used to make images: * Pict: Functional Pictures - The pict
library is one of the standard Racket functional picture libraries. The other is 2htdp/image
. * Progressive Picts and Slides * Metapict - The metapict library provides functions and data structures useful for generating picts. * 2htdp/image - The 2htdp/image
library is one of the standard Racket functional picture libraries. The other is pict
. * Pict3D: Functional 3D Scenes - go 3D! * Plot: Graph Plotting - a graph plotting library that produces lovely plots. * Lindenmayer - The Lindenmayer language provides a language for running and interpreting Lindenmayer Systems. In general L-systems are useful for modeling plant growth, procedural content generation, and making pretty pictures: * Planet Cute Images - The 2htdp/planetcute library contains the Planet Cute art by Daniel Cook (http://Lostgarden.com\|Lostgarden.com).
is this comprehensive?

Yes. What I meant: When you e.g. run raco help
, it doesn’t expand then. It uses the result of a build-time expansion: the documention was stored in HTML files, and (IIUC) cross-reference info was stored in a sqlite database.

i.e. you wouldn’t want raco help
to be as slow as raco setup
building docs! :smile:

It seems using lazy-require
undermines --check-pkg-deps
. Is that as-expected? I think so: Any use of dynamic-require
shifts from compile- to run-time How could --check-pkg-deps
possibly work for that (without running the program, doing coverage checking to make sure all the dynamic requires are exercised — and even then, what if some dep uses dynamic requires!). But I wanted to confirm.

Oh re-reading the docs is a good idea: https://docs.racket-lang.org/raco/setup-check-deps.html#(part._.How_.Dependency_.Checking_.Works)

But although lazy-require
is implemented with dynamic-require
, it’s not “as dynamic”.

Maybe I could define a my-lazy-require
that expands to lazy-require
plus a submodule with a plain require
as a “signal” for the dep checker… something like that…

(“not ‘as dynamic’” = the module is a compile-time constant, not possibly a runtime variable as with dynamic-require)

As you say, dependency checking will not follow lazy-require
s. It’s possible to improve the dependency checker to detect references via lazy-require
— and, more generally, things that cooperate with raco exe
, such as define-runtime-module-path-index
. But that might be slow; supporting those kinds of references has created performance problems in raco exe
. Probably it’s not done the right way.

Was my guess as well.

The result does make sense - it just surprised me.

(sgn #e-0.0)

Hmm, the docs that Greg linked to claim that dependency checking follows define-runtime-module-path-index
, but lazy-require
already uses that. Is the documentation wrong?

I may misremember, but I think the documentation is probably wrong in suggesting that define-runtime-module-path-index
cooperates with raco make
.

I’d like to use plot
to create multiple subplots, i.e. showing multiple graphs, but not on the same set of axis, like this: http://www.gnuplotting.org/figs/multiplot1.png . I’ve been looking around the documentation of plot
package for quite some time, but I don’t know how to even come close to doing this. Would anyone have some pointers?

I start thinking about combining the plots as bitmaps, but I wonder whether that’s the best way to proceed

I recommend using the pict
library to combine them (see eg hc-append
and vc-append
). Then you can convert to a bitmap at the end if you need to.

It scales the display so that it is x times bigger. Otherwise, everything seems to be the same

Interesting, I hadn’t even considered the raco exe
aspect.

I guess, really, I don’t have an urgent practical need wrt this. At most I might say “well at least have a way for --check-pkg-deps
to warn or even optionally fail in the face of lazy-require
” … but even that is probably too low ROI to be worth doing. Sorry if this was noise.

Thanks for the explanation!

@mflatt If current-code-font
is set to a font with a specified font size, does it or get-current-code-font-size
take precedent?

(It also might make sense to put which it is in the docs?)

Since a font%
size takes precedence for text
, I think that means the size in a font%
for current-code-font
also takes precedence.

I have done this with picts and it works pretty good. You do lose the plots being interactive though iirc.


@mflatt Okay, next question, is there any reason the command-extras
style property takes a list of strings, rather than a list of elements?

It just seems like it becomes a problem when a latex command puts the prose in the second argument, rather than the first.

If I run make cs SCHEME_SRC=path/to/chez
does it expect chez to already be built in that path?

I guess we could make a command-pre-extras
in those cases?

Can there be ways to append arbitrary snips instead of just picts?

It’s arbitrary, but elements have the drawback that they get encoded (at least by default), which makes it difficult to pass some arguments to some Latex macros. If a command takes text as the non-first argument, I’d probably write a wrapper macro that reorders them.

I think aligned-pasteboard%
was supposed to do that, maybe, but I’ve never used it, and I don’t know if it still works.

On the other hand, if they’re the same width, you could just insert each snip in a row into the editor, insert a newline, insert each snip in the next row, and so on. Or just insert all of them and turn on line wrapping, and then it’s responsive :slightly_smiling_face:

Ah, that’s actually a good idea. I know how to do that in latex proper, but is there any way to do that with scribble directly?

(Without having to make an additional .tex
style file?

)

You can use tex-addition
with bytes instead of a path.

Attached to the title of the document?

Say like this:
@title[#:style (make-style #f
(list (tex-addition #"....")))]{Hello}

If I do that then it seems to put it in the middle of a comment in the resulting tex file.

Ah yes, a responsive chess board. It’s always got 64 squares but the number of columns is based on your screen width.

https://racket.slack.com/archives/C06V96CKX/p1590632571029700?thread_ts=1590557731.495100&cid=C06V96CKX @robby Actually is this even true? Would it be possible for me to define an implementation of the racket:text<%>
interface that does not need to require racket/gui
?
What with all the classes, mixins, and units, I’m getting lost. (I am starting to understand some of the pieces like syntax-color/module-lexer
and how lexers are used by color.rkt
. But there seem to be many other pieces, most of which I don’t (want to) need.)

I tried #lang scribble/base
@(require scribble/core
scribble/latex-properties)
@title[#:style (make-style #f
(list (tex-addition #"....")))]{Hello}
and scribble --latex
produces output with....
just before \begin{document}
.

I have no idea. I’ve only barely used racket/gui
:disappointed:

the class-based approach to everything is really difficult to learn

Odd…I wonder if its because I was using scribble/acmart
. I’ll have to look into this more later.

Anyway, thanks. :slightly_smiling_face:

For my above purposes I didn’t need them to be individually zoomable, because I was adding data and redrawing the plot/picts every second on a canvas


This is beautiful. How did you make it?

I think you would mostly (a) embed Racket in the app as if it were a C app, then (2) call parts of the outer application and system libraries using the Objective-C FFI

wasn’t me it was @ryanc using https://docs.racket-lang.org/ppict/index.html


The “simplest” may be calling scheme_eval
from a callback in the app. https://docs.racket-lang.org/inside/Evaluation.html

Presuming you’ve hooked into the application start up and set up Racket etc.

Ah - with scribble/acmart
, it does show up after a comment and before another comment for me. But it’s not commented out, which is what I thought you meant. Add "\n"
to avoid having the second comment continue on the same line.

No, the makefiles will build it.

I played with the parameters some more and found a loose spacing that I prefer. You can see it at the bottom of this page: https://rmculpepper.github.io/blog/2020/03/Jeremiah-was-a-Frog/ (Oh, and I have a blog again. Kind of.)

Ok, I’m getting an error /home/sam/projects/racket-dev/racket-godot/project/chezscheme/ta6le/bin/ta6le/scheme: not found
Let me try this again with a very clean source tree.

yes, what @samdphillips said. I think mostly it would go the same as embedding in a C app, except that some of the FFI calls from Racket to the outer app/system libraries would use Obj-C

You can poke the guts of the outer app easier.

easier == without serializing or weird protocols

Joy to the fishies!

Also you could cause crashes easier

also you can pass pointers from the outer app to the racket code

Call read
?

I think someone mentioned my name in this thread? I can’t seem to navigate slack’s UI properly but I think the question was about how some parts of the indentation work. FWIW, it doesn’t require you to use create any classes or methods. Just to provide a function that tells how many spaces go at the front of a given line (I suppose you’d need to invoke methods but that’s a lot simpler in general). And yes, the colorer has to run first (technically the language’s lexer) for the best use because that’s how the information about matching parens gets computed about the program you’re indenting. Running the colorer is a lot more lightweight than expanding the program, partly because it is a simpler thing and partly because it actually uses an incremental algorithm.

I can see how an indenter that would need to require racket/gui
is a lot to ask. The actual dependencies are on text%
which is smaller but the library currently isn’t broken up in a way that takes advantage of that.

One way to look at this is that the current interface is something that might be a useful piece to build upon something like what was being discussed above. It merely establishes a connection between the #lang line and a very general-purpose indentation function. There could be other layers that take into account scope and such things to do a better job.

Anyway, hope that’s useful.

Couldn’t get it to build from git. I probably have something subtly off. Building from the 7.7 source works and is probably what I should have used from the start.

The first is for the racket/math
module described in https://docs.racket-lang.org/reference/generic-numbers.html#%28part._.Extra_.Constants_and_.Functions%29 , the other is for the math
module described in https://docs.racket-lang.org/math/index.html .

@camoy has joined the channel

Thank you for you answers everyone! I was thinking about pict
, but pointing me directly to hc-append
and vc-append
is quiet helpful (I have already used similar functions in other languages’ drawing libraries)

I also thought about losing interactivity if I appended plots as pics, but that’s not a problem at the moment