soegaard2
2020-5-28 12:34:33

Quiz of the day

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


soegaard2
2020-5-28 12:38:04

How does the backing scale affect the look of DrRacket?


spdegabrielle
2020-5-28 12:59:27

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?


greg
2020-5-28 13:07:04

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.


greg
2020-5-28 13:07:38

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


greg
2020-5-28 13:42:06

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.



greg
2020-5-28 13:43:34

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


greg
2020-5-28 13:45:22

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…


greg
2020-5-28 13:49:32

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


mflatt
2020-5-28 13:56:18

As you say, dependency checking will not follow lazy-requires. 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.


soegaard2
2020-5-28 14:23:17

Was my guess as well.


soegaard2
2020-5-28 14:36:23

The result does make sense - it just surprised me.


wanpeebaw
2020-5-28 14:50:21

(sgn #e-0.0)


ryanc
2020-5-28 15:07:37

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?


mflatt
2020-5-28 15:16:26

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


scolobb-slack
2020-5-28 16:03:38

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?


scolobb-slack
2020-5-28 16:04:39

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


ryanc
2020-5-28 16:13:25

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.


michaelmmacleod
2020-5-28 16:13:41

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


greg
2020-5-28 16:46:00

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


greg
2020-5-28 16:46:27

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.


greg
2020-5-28 16:46:52

Thanks for the explanation!


leif
2020-5-28 17:15:31

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


leif
2020-5-28 17:15:43

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


mflatt
2020-5-28 17:28:43

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


samdphillips
2020-5-28 18:28:19

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


samdphillips
2020-5-28 18:31:49

leif
2020-5-28 18:35:12

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


leif
2020-5-28 18:35:49

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


samdphillips
2020-5-28 18:36:52

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


leif
2020-5-28 18:37:32

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


notjack
2020-5-28 18:45:01

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


mflatt
2020-5-28 18:52:30

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.


ryanc
2020-5-28 18:55:27

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.


ryanc
2020-5-28 18:57:52

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:


leif
2020-5-28 19:02:08

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?


leif
2020-5-28 19:02:22

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


leif
2020-5-28 19:02:24

)


mflatt
2020-5-28 19:06:32

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


leif
2020-5-28 19:09:26

Attached to the title of the document?


leif
2020-5-28 19:09:48

Say like this:

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


leif
2020-5-28 19:10:14

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


notjack
2020-5-28 19:23:05

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


greg
2020-5-28 19:58:59

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


mflatt
2020-5-28 19:59:47

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


notjack
2020-5-28 20:04:54

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


notjack
2020-5-28 20:05:26

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


leif
2020-5-28 20:16:52

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


leif
2020-5-28 20:16:55

Anyway, thanks. :slightly_smiling_face:


samdphillips
2020-5-28 20:22:57

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


spdegabrielle
2020-5-28 20:51:48

notjack
2020-5-28 21:01:41

This is beautiful. How did you make it?


samth
2020-5-28 21:01:53

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


spdegabrielle
2020-5-28 21:07:01

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



samdphillips
2020-5-28 21:11:13

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


samdphillips
2020-5-28 21:11:34

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


mflatt
2020-5-28 21:14:15

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.


mflatt
2020-5-28 21:14:56

No, the makefiles will build it.


ryanc
2020-5-28 21:18:22

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


samdphillips
2020-5-28 21:21:49

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.


samth
2020-5-28 21:24:16

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


samdphillips
2020-5-28 21:27:52

You can poke the guts of the outer app easier.


samdphillips
2020-5-28 21:28:24

easier == without serializing or weird protocols


spdegabrielle
2020-5-28 21:28:52

Joy to the fishies!


samdphillips
2020-5-28 21:29:05

Also you could cause crashes easier


samth
2020-5-28 21:30:07

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


soegaard2
2020-5-28 22:32:35

Call read ?


robby
2020-5-28 22:53:05

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.


robby
2020-5-28 22:54:29

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.


robby
2020-5-28 22:55:34

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.


robby
2020-5-28 22:55:42

Anyway, hope that’s useful.


samdphillips
2020-5-28 23:03:18

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.


gfb
2020-5-29 00:14:58

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
2020-5-29 00:53:52

@camoy has joined the channel


scolobb-slack
2020-5-29 06:53:01

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)


scolobb-slack
2020-5-29 06:54:24

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