pihentagy
2021-1-19 09:49:12

Do you happen to figure out why it produces empty list?


soegaard2
2021-1-19 09:51:20

Yes, as @sorawee writes, I was supposed to use in-producer instead of in-generator .


gknauth
2021-1-19 17:21:58

Cool thread. I played a LOT of chess when I was 12–14 years old. I was at the US Junior Open when Richard Nixon resigned. The tournament was stopped so we could watch the news in all its solemnity. (Things were quite different then.) I remember when I was playing someone who was very good the intensity was incredible. I don’t know if I’ve experienced that level of concentration in anything else. I’ve flown and landed planes in difficult conditions and that certainly requires concentration, I’ve raced in (rowing) national and world championships, but even those experiences haven’t required the mental gymnastics needed to win against a superior opponent.


soegaard2
2021-1-19 17:23:01

gknauth
2021-1-19 17:23:34

And if you haven’t seen The Queen’s Gambit, I recommend it.


soegaard2
2021-1-19 17:23:46

Ditto!


badkins
2021-1-19 17:27:21

@soegaard2 you found my repo - it’s not quite ready yet, but I figured I’d put it on github anyway :)


gknauth
2021-1-19 17:27:55

When I was in Iceland in 2018 I made a special trip to the hall where Fischer & Spassky played in 1972. The guy who showed me around said that after Bobby Fischer moved to Iceland before he died, Fischer stopped by daily at the little restaurant his wife ran. Every day he ordered a cheerburger and a glass of milk. Anyway, back to the 1970s, there used to be chess houses all over New York City. That’s what started me on chess. I’ll repeat myself: (Things were quite different then.)


badkins
2021-1-19 17:28:38

When I started this, my goal wasn’t to make a competitive chess program, so I just used a 10x12 board. I think all the good engines use bitboards, but that seemed like too much work. I suppose I could always swap board representations later.


gknauth
2021-1-19 17:29:54

@badkins Just beat Deep Blue. I want Garry Kasparov to be happy again.


badkins
2021-1-19 17:30:38

I have a hunch that to be competitive, C/C++/Rust is required. Maybe Julia could do it, but I’m not sure about that.


gknauth
2021-1-19 17:31:06

Racket could write the Rust if required.


anything
2021-1-19 17:32:11

What do you mean things were quite different then? Can you elaborate on that? I don’t think I get it.


soegaard2
2021-1-19 17:32:26

A Dane (Bent Larsen - who lost in the candidates semi-final to Fischer) has the questionable honor of being the first GM to lose to a computer.


badkins
2021-1-19 17:35:01

re: “Racket could write the Rust if required.” @gknauth I’m skeptical of that approach :)


badkins
2021-1-19 17:35:53

I’d love to see examples of performant code in C/C++/Rust being generated by Racket.


badkins
2021-1-19 17:36:58

I remember watching the Deep Blue vs. Kasparov match “live” - exciting times :)


soegaard2
2021-1-19 17:43:14

Don’t forget, that these days, you can write bits and pieces in Chez Scheme and call them from Racket.


gknauth
2021-1-19 18:19:00

@badkins re: Racket writing Rust. Lisps are good at AI-type thinking. Talented humans are capable of great optimizations. How do humans do it? Heuristics? Flashes of insight? I think it’s mostly tricks they’ve learned over the ages, a bit like chess. If it’s possible to write a chess program that can beat the best human (even if only by brute force), the same sort of thing should be possible with writing Rust. Who knows, sprinkle in some machine learning and you could get chess games and Rust programs that no human has imagined (both good and bad). Maybe the human has a role in separating the good and the bad (“no, computer, that’s not what I meant!”).


pihentagy
2021-1-19 21:30:04

Hm, revisiting my program written 2 weeks ago, and getting the following error. It did work previously :thinking_face: open-input-file: cannot open module file module path: typed/algorithms path: /usr/share/racket/pkgs/rackunit-typed/algorithms.rkt system error: no such file or directory; rktio_err=3


pihentagy
2021-1-19 21:30:49

Just upgraded to Linux Mint 20.1


soegaard2
2021-1-19 21:31:05

Should typed/algorithms be rackunit-typed/algorithms ?


pihentagy
2021-1-19 21:31:26

This seems to be the offending line (require typed/algorithms) , yes typed/racket


soegaard2
2021-1-19 21:31:55

Is typed/algorithms your own library?


pihentagy
2021-1-19 21:32:15

No, it is a standard library.


soegaard2
2021-1-19 21:32:37

Hmm. Maybe check with raco which packages are installed?


soegaard2
2021-1-19 21:32:52

Did the update also update racket?


pihentagy
2021-1-19 21:34:06

not sure, so uninstalled and installed racket


pihentagy
2021-1-19 21:34:16

soegaard2
2021-1-19 21:34:36

just now, or before?


pihentagy
2021-1-19 21:34:43

before


soegaard2
2021-1-19 21:35:08

Maybe you need to reinstall some packages then.


soegaard2
2021-1-19 21:35:20

As in raco pkg install some-package


soegaard2
2021-1-19 21:35:51

I am unsure what the algorithms package is.


sorawee
2021-1-19 21:36:15

I searched typed/algorithms and found nothing in the doc



soegaard2
2021-1-19 21:36:46

Then try: raco pkg install algorithms


sorawee
2021-1-19 21:37:01

Shouldn’t that be (require algorithms)?


soegaard2
2021-1-19 21:37:05

It’s not part of the standard distribution.


pihentagy
2021-1-19 21:45:06

What is considered standard distribution then?


soegaard2
2021-1-19 21:45:51

Good question. The set of packages that are bundled with Racket, when you download it from the home page.


soegaard2
2021-1-19 21:46:21

Not sure where a complete list can be seen.



soegaard2
2021-1-19 21:47:13

pihentagy
2021-1-19 22:10:22

nicholas.faiz
2021-1-19 23:14:15

@nicholas.faiz has joined the channel


jestarray
2021-1-20 00:09:29

(string-split "{659ffea0-8381-42f9-ab19-c27085bf1445} bus:/" "} " #:trim? #f) it’s giving me: '({659ffea0-8381-42f9-ab19-c27085bf1445" "bus:/")


jestarray
2021-1-20 00:10:02

how do i make it so it doesn’t erease the close brace } ?


jestarray
2021-1-20 00:18:51

unsure if this is a bug with #trim or am i mis-reading what it does


me1890
2021-1-20 00:49:46

Why not just split on " "?


me1890
2021-1-20 00:50:03

Btw, #:trim just applies string-trim before splitting


jestarray
2021-1-20 00:53:46

i can’t split on space because there might be other spaces, e.g : ("{659ffea0-8381-42f9-ab19-c27085bf1445" "bus:/hello world")


me1890
2021-1-20 00:54:06

ah


jestarray
2021-1-20 00:54:39

passing #:repeat? #f doesn’t do what i think it does either lol…


jestarray
2021-1-20 00:54:54

welp, for now ill just string-append back the closing brace


me1890
2021-1-20 00:55:07

i would suggest taking two substrings instead


me1890
2021-1-20 00:55:24

because the thing in brackets is always a uuid right?


me1890
2021-1-20 00:57:32

if so, you could do (substring str 0 38) to get the first part, and (substring str 39) to get the second part


jestarray
2021-1-20 00:59:27

oo never thought of that


jestarray
2021-1-20 00:59:41

seems like it will always be 0–38


jestarray
2021-1-20 00:59:45

thanks!


me1890
2021-1-20 01:00:00

np


jestarray
2021-1-20 06:30:37

(struct bar (y z)) (define-syntax (get-bar-field-names stx) #`'#,(struct-field-info-list (syntax-local-value #'bar))) (get-bar-field-names) is there a way to pass in an instance of a struct and get its field names, (in this case ’(y,z)` ? at runtime


sorawee
2021-1-20 06:43:46

#lang racket (require (for-syntax racket/struct-info)) (struct bar (y z)) (define-syntax (get-field-names stx) (syntax-case stx () [(_ the-struct) #`'#,(struct-field-info-list (syntax-local-value #'the-struct))])) (get-field-names bar) ;=> '(z y)


jestarray
2021-1-20 07:06:55

sweet thanks! never heard of syntax-case before


jestarray
2021-1-20 07:08:08

oh wait! what about passing an instance of a struct?

e.g (get-field-names (bar 3 1)) ?


sorawee
2021-1-20 07:09:52

That’s not possible via the above protocol, but there might be other ways to do it.


sorawee
2021-1-20 07:10:56

It’s likely going to be very brittle though


jestarray
2021-1-20 07:11:06

tis outside my knowledge. either way thanks


sorawee
2021-1-20 07:12:46

Actually, jk, the way I thought would work doesn’t actually work


sorawee
2021-1-20 07:13:07

So yeah, I don’t know if it’s possible via the standard struct usage


jestarray
2021-1-20 07:13:22

ahh well thanks anyways


sorawee
2021-1-20 07:20:16

Here’s one easy way to do it if you can use non standard struct


sorawee
2021-1-20 07:20:20

#lang racket (require racket/generic) (define-generics field-name-reflectable (get-field-names field-name-reflectable)) (define-syntax-rule (my-struct name (fields ...) options ...) (struct name (fields ...) options ... #:methods gen:field-name-reflectable [(define (get-field-names self) '(fields ...))])) (my-struct bar (y z)) (get-field-names (bar 1 2)) ;=> '(y z)


sorawee
2021-1-20 07:22:09

If you want to use this solution, you might want to refine it further to support field options, super struct type position, etc.