maxim_jaffe
2018-7-24 11:36:32

@maxim_jaffe has joined the channel


maxim_jaffe
2018-7-24 11:39:06

Hello, everyone! New to Racket (about 2 weeks), long-time programmer (mostly python)


soegaard2
2018-7-24 11:39:31

Hi!


maxim_jaffe
2018-7-24 11:40:35

Hey :slightly_smiling_face:


maxim_jaffe
2018-7-24 11:41:52

Apart from being a LISP dialect I became interested because Racket has some great plotting and image libraries as well as a nice PDE (DrRacket). I was wondering if I could get some help figuring out what would be the best way to go about the following


maxim_jaffe
2018-7-24 11:42:42

I am working on a dynamic land use model, I initially built it on NetLogo and wanted to make some sort of port of it for Racket


maxim_jaffe
2018-7-24 11:43:43

My first goal is plotting the land use, each cell/patch has a number value and I want it to be displayed with a certain color


maxim_jaffe
2018-7-24 11:43:58

would be nice to have something reasonably fast to render


maxim_jaffe
2018-7-24 11:45:03

From what I’ve seen the plot library might not be the best option (I started implementing something like this in python with matplotlib), guessing the image libraries would be the best approach


maxim_jaffe
2018-7-24 11:45:20

is there a simple function that just converts a matrix of these land use values


maxim_jaffe
2018-7-24 11:45:29

into an image, mapping the numbers to colors?


soegaard2
2018-7-24 11:45:42

How large is the matrix?


maxim_jaffe
2018-7-24 11:45:59

upper limit about 1000 x 1000


maxim_jaffe
2018-7-24 11:46:11

but closer to 800 x 800


soegaard2
2018-7-24 11:47:24

One option is to use the draw library and simply draw squares on a canvas.


soegaard2
2018-7-24 11:47:41

But maybe you can use … what they called …


maxim_jaffe
2018-7-24 11:50:12

yes :slightly_smiling_face:?


maxim_jaffe
2018-7-24 11:50:57

I thought about drawing squares after I saw the checkerboard example of the quick introduction with images, was just wondering if it made sense and if it was fast enough with that amount of data


soegaard2
2018-7-24 11:51:29

pocmatos
2018-7-24 11:53:19

I have a computation that’s consuming too much memory and blowing up the limits. Is there a way inside DrRacket to break the computation and get a backtrace of where the computation broke - which might give me an idea of where the memory consumption is coming from?


maxim_jaffe
2018-7-24 11:54:10

@soegaard2 thanks I’ll look into flomaps :slightly_smiling_face:!


soegaard2
2018-7-24 11:54:27

@maxim_jaffe I am not sure they are the best fit.


soegaard2
2018-7-24 11:54:47

Low level drawing to a canvas can be done using a dc (drawing context): http://docs.racket-lang.org/draw/dc___.html


pocmatos
2018-7-24 11:54:57

hummm, I think I found the culprit actually, although I haven’t found how to get the backtrace in DrRacket.


soegaard2
2018-7-24 11:55:52

@maxim_jaffe It is worth playing around with some options first. Also make sure to check out the pict library: http://docs.racket-lang.org/pict/index.html?q=pict


soegaard2
2018-7-24 11:56:51

@pocmatos In DrRacket click the image with the three red signs.


soegaard2
2018-7-24 11:57:05

read with white cross


soegaard2
2018-7-24 11:57:10

read -> red


soegaard2
2018-7-24 11:57:40

Also: in the language menu: choose “Debugging” (I think it is on as default)


maxim_jaffe
2018-7-24 11:58:42

@soegaard2 thanks will have a look


pocmatos
2018-7-24 11:58:54

@soegaard2 ah, yes, I had debugging off. Thanks for the reminder.


soegaard2
2018-7-24 11:59:06

@maxim_jaffe A quick example of how to use the low level drawing library: http://soegaard.github.io/blog/2013/06/27/drawing-bezier-curves/


pocmatos
2018-7-24 11:59:06

it’s on by default but at some point I must have disabled it.


soegaard2
2018-7-24 11:59:34

Maybe you were benchmarking something?


pocmatos
2018-7-24 12:00:42

Likely. :slightly_smiling_face:


maxim_jaffe
2018-7-24 12:07:06

By the way is there a simple way of combining the canvas created by 2htdp/universe with a regular gui, with sliders and buttons?


soegaard2
2018-7-24 12:09:44

not sure


maxim_jaffe
2018-7-24 12:11:20

oh well


maxim_jaffe
2018-7-24 12:12:01

Will keep going :wink:, hopefully I can get something reasonable working


maxim_jaffe
2018-7-24 12:12:09

I love the language and the environment


maxim_jaffe
2018-7-24 12:12:27

I haven’t felt this good since I first learned Python


maxim_jaffe
2018-7-24 14:14:33

by the way when I generate a large array using math/array


maxim_jaffe
2018-7-24 14:14:42

It prints out in a long sequence


maxim_jaffe
2018-7-24 14:15:03

is there a way of changing how it prints (maybe omitting middle values?)


maxim_jaffe
2018-7-24 14:16:30

a bit like in numpy of Python?


soegaard2
2018-7-24 14:26:05

Do you need matrix operations - or just something to store 2d data?


maxim_jaffe
2018-7-24 14:38:57

hum mostly pointwise operations, although I would need something like a kernel/window operation


soegaard2
2018-7-24 14:39:22

Consider using a vector instead then.


maxim_jaffe
2018-7-24 14:39:54

actually there is one calculation that I need some broadcasting for example


maxim_jaffe
2018-7-24 14:40:15

basically multiplying a 3d array


maxim_jaffe
2018-7-24 14:40:17

by a 1d


maxim_jaffe
2018-7-24 14:40:35

and then doing and argmax or argmin


maxim_jaffe
2018-7-24 14:40:41

on one of the axes


maxim_jaffe
2018-7-24 14:44:31

basically I have a main land use matrix


maxim_jaffe
2018-7-24 14:44:40

and then a bunch of layers to determine the next land use


maxim_jaffe
2018-7-24 14:45:39

would be nice to be able to calculate a softmax too


maxim_jaffe
2018-7-24 15:46:04

I couldn’t find a random array generator (maybe my google-fu wasn’t good enough). If it really is the case that there isn’t one, would such a function be useful in the base math/array library? It’s quite a common thing in Python, Julia and I think R and Matlab..!


jerome.martin.dev
2018-7-24 16:00:56

That could be useful. I worked a bit with the matrix features of Racket (for deep learning) and found a lack of some useful functions like that. Didn’t quite got the time do do PRs, as I was learning the language in the same time, so I wasn’t ready to make changes to racket’s core. But “making Racket a cool language for AI by improving racket/math” is on my list of things to contribute :wink:


maxim_jaffe
2018-7-24 16:15:09

yeah would be great


maxim_jaffe
2018-7-24 16:15:13

:slightly_smiling_face:


maxim_jaffe
2018-7-24 16:15:49

I’ll collect some of the functions I write, maybe in future I can contribute


maxim_jaffe
2018-7-24 16:17:26

Still learning too


maxim_jaffe
2018-7-24 16:27:32

By the way is there a quick way of finding the code for a particular function of racket?


lexi.lambda
2018-7-24 16:31:04

@maxim_jaffe in DrRacket, you can right click on identifiers and select “open defining file”, and in racket-mode, you can use racket-visit-definition


maxim_jaffe
2018-7-24 16:32:07

Thanks :slightly_smiling_face:!


maxim_jaffe
2018-7-24 16:35:17

that’s really helpful :slightly_smiling_face:


maxim_jaffe
2018-7-24 16:35:30

DrRacket really is great


lexi.lambda
2018-7-24 16:39:45

DrRacket won’t be able to find the source for some of the core functions because they’re defined in C at the level of the runtime, but it will find the source for anything defined in Racket.


ben
2018-7-24 18:43:40

wait — raco te is a synonym for raco test ???


samth
2018-7-24 18:45:56

@ben any unambigouous prefix can be used with raco


ben
2018-7-24 18:46:29

wow


markx
2018-7-24 20:39:26

Hello hello, any recommendation for terminal UI libs? I’m looking for something like this in racket: https://github.com/rivo/tview


samth
2018-7-24 20:56:10

@markx there’s nothing as feature-full as that, but you might be interested in the “charterm” pkg


markx
2018-7-24 21:18:32

@samth Thanks. It doesn’t seem to support creating boxes… That’s what I really want.


lexi.lambda
2018-7-24 21:42:26

@leif This commit of yours appears to have broken the build on Windows. https://github.com/racket/racket/commit/eaaede9c2c40f40e9f322998a5a876a3b5170ccb


lexi.lambda
2018-7-24 21:43:21

I haven’t looked into it enough to know if it’s an issue with the test suite or an actual problem, but it would be nice if you could resolve it, especially if that commit is going into the Racket 7 release.


greg
2018-7-25 00:07:22

wonders, “If I have to ask what a :kidney: reaction means, does that make me an oldster?”


zenspider
2018-7-25 00:20:19

how come they don’t have :liver: emoji ?


lexi.lambda
2018-7-25 00:46:55

I haven’t the foggiest idea what it means, either, so you can probably rest easy.


ben
2018-7-25 04:38:13

The kidney above is basically the same as the foggy/panda/cocktails on this message, except Leif and I have used the kidney as a "+1" before. I’m hoping Leif goes “oh Ben sent a kidney hahahahahaha okay I better go fix the build (and then maybe replies with a matching kidney)”