soegaard2
2020-7-3 09:15:10

@alexharsanyi Nice blog post on Ishido. I am wondering whether the part, where you make sure the first six tiles have unique colors and images could be done easier. Instead of “moving” things, I’d shuffle until I get a usuable order:

(define shuffled (let loop ([candidate (shuffle all)]) (if (six-unique candidate) candidate (loop)))


soegaard2
2020-7-3 09:17:39

I am thinking the proportion of shuffles where the first 6 tiles are unique are so large, that the number of retries will be low.


alexharsanyi
2020-7-3 10:01:42

I’m not sure I like algorithms that are not guaranteed to terminate. Also, I’m not sure how you define “easier” — you would have to show how six-unique is implemented, so you might not save on the lines of code and the complexity of the explanation.


soegaard2
2020-7-3 10:07:09

I am not worried about the random nature of “randomize, test and repeat if necessary”. (I have used that trick multiple times). Yes, it is only the “moving” part that disappears. My thinking is that six-unique will be simpler without the “moving” part.


soegaard2
2020-7-3 10:07:30

Is it a popular game?


soegaard2
2020-7-3 10:07:41

I didn’t know about it.


alexharsanyi
2020-7-3 10:10:25

at work I have to deal with a lot of things that “statistically should never happen”, so I have a strong dislike for such things :slightly_smiling_face:


alexharsanyi
2020-7-3 10:10:48

also, the game is one of the very few that I ever played ( I am not a game person )




spdegabrielle
2020-7-3 10:16:39

@jcoo092


soegaard2
2020-7-3 10:16:56

I am working on a math web-site with lot of random exercises. Here is how I find a random circle with center (a,b) and radius r where the center is close to (0,0) and the circle itself doesn’t extend too far:

(defr [(a b) (random-small 5)] [(r) (random-small 5)] #:where (and (> r 0) (<= (+ (* a a) (* b b)) 16) (<= (+ r (+ (* a a) (* b b))) 7))) Here the clauses of defr will find random a, b and r. Then the where-predicate is checked. If the predicate fails, defr will loop and find new values for a, b and r.


soegaard2
2020-7-3 10:19:56

So far the generate-and-test approach has worked pretty well.


popa.bogdanp
2020-7-3 10:29:52

From the reference it sounds like fixnums should be 62 bits + 1 bit for the sign and that appears to be the case on BC, but not on CS:

Welcome to Racket v7.7.0.10 [cs]. > (fixnum? (sub1 (expt 2 62))) #f > (fixnum? (sub1 (expt 2 61))) #f > (fixnum? (sub1 (expt 2 60))) #t Is this expected?


soegaard2
2020-7-3 10:32:02

I believe fixnums are one bit smaller on CS.


soegaard2
2020-7-3 10:33:06

Chez Scheme has most-positive-fixnum if you need to check.


popa.bogdanp
2020-7-3 10:34:30

Looks like it:

> ((vm-primitive 'most-positive-fixnum)) 1152921504606846975 > (sub1 (expt 2 60)) 1152921504606846975 Thanks


popa.bogdanp
2020-7-3 10:35:44

Is this because chez uses the extra bits to tag more primitive values than Racket BC does?


soegaard2
2020-7-3 10:39:14

I think so - I don’t know which tag scheme CS uses.


mflatt
2020-7-3 13:04:35

Yes, it’s due to more bits for tags.



mflatt
2020-7-3 13:06:46

Three bits are used for tags, fixnums effectively get two patterns (000 and 100) on 32-bit machines, so that’s why there’s 1 bit less room for fixnums on a 32-bit machine, but 2 bits less on a 64-bit machine.


mflatt
2020-7-3 13:07:39

It looks like I fixed the guide but not the reference, so I’ll fix the reference now.


popa.bogdanp
2020-7-3 13:08:46

Makes sense. Thanks for the link!


samth
2020-7-3 13:58:34

Yep, those


soegaard2
2020-7-3 14:32:25

I am trying to build racket from source on mac. I get this error: a - src/validate.o a - src/vector.o a - ../foreign/foreign.o ranlib libracket.a /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libracket.a(unwind.o) has no symbols /Library/Developer/CommandLineTools/usr/bin/make racketcgc mkdir -p Racket.framework/Versions/5.1.1.7 gcc -o Racket.framework/Versions/5.1.1.7/Racket -pthread -framework CoreFoundation -dynamiclib -all_load libracket.a libmzgc.a -ldl -lm -liconv -lffi rm -f Racket.framework/Racket ln -s Versions/5.1.1.7/Racket Racket.framework/Racket gcc -I. -I../../racket/include -g -O2 -Wall -DOS_X -D_DARWIN_UNLIMITED_SELECT -pthread -fno-common -DINITIAL_COLLECTS_DIRECTORY='"'"`cd ../../racket/../../collects; pwd`"'"' -c ../../racket/main.c -o main.o gcc -o racketcgc -pthread main.o -Wl,-headerpad_max_install_names -F. -framework Racket -ldl -lm -liconv -lffi /usr/bin/install_name_tool -change "Racket.framework/Versions/5.1.1.7/Racket" "@executable_path/Racket.framework/Versions/5.1.1.7/Racket" "racketcgc" cd gc2; /Library/Developer/CommandLineTools/usr/bin/make all mkdir xsrc /Library/Developer/CommandLineTools/usr/bin/make xsrc/precomp.h env XFORM_PRECOMP=yes ../racketcgc -cqu ../../../racket/gc2/xform.rkt --setup . --cpp "gcc -E -I./.. -I../../../racket/gc2/../include -DOS_X -D_DARWIN_UNLIMITED_SELECT -pthread -fno-common " --keep-lines -o xsrc/precomp.h ../../../racket/gc2/precomp.c Copying tree... make[4]: *** [xsrc/precomp.h] Abort trap: 6 make[3]: *** [all] Error 2 make[2]: *** [3m] Error 2 make[1]: *** [3m] Error 2 make: *** [all] Error 2 Any ideas?


greg
2020-7-3 14:44:40

When non-termination is a concern I guess there is call-with-limits and friends. https://docs.racket-lang.org/reference/Sandboxed_Evaluation.html#(def._((lib._racket%2Fsandbox..rkt)._call-with-limits))


greg
2020-7-3 14:45:22

That might already be covering @soegaard2 in the context of a web server? I vaguely recall something to do with terminating HTTP responses that take “too long”.


greg
2020-7-3 14:46:37

Anyway I can appreciate @alexharsanyi not wanting to see more of the bane of his professional existence. :slightly_smiling_face:


soegaard2
2020-7-3 15:17:40

Good advice. I chose to generate the exercises off-line as a bunch of data files - and then let he web-server pick randomly from the available exercises.


mflatt
2020-7-3 15:17:53

I think racketcgc must be hitting an abort() call, but since it doesn’t print anything before, we’ll need a stack trace to figure out this one.


mflatt
2020-7-3 15:18:06

Go to racket/src/build/racket/gc2


mflatt
2020-7-3 15:18:17

Run env XFORMPRECOMP=yes lldb ../racketcgc


mflatt
2020-7-3 15:18:59

Then run -cqu ../../../racket/gc2/xform.rkt --setup . --cpp "gcc -E -I./.. -I../../../racket/gc2/../include -DOS_X -D_DARWIN_UNLIMITED_SELECT -pthread -fno-common " --keep-lines -o xsrc/precomp.h ../../../racket/gc2/precomp.c


mflatt
2020-7-3 15:19:17

I expect that lldb will break at an abort signal, and then bt will give us some hints


soegaard2
2020-7-3 15:21:49

Good news and bad news. I have gotten past the problematic point, but I changed two things at once. I fetched the pmatos new commits and used make in-place instead of just make.


soegaard2
2020-7-3 16:13:32

I am a bit confused. The build is done. It looked as everything went fine. Packages were downloaded and built. Docs were rendered. But the bin directory is empty and build only contains config. Am I looking the wrong place?


soegaard2
2020-7-3 16:13:59

The build command was simple make in-place .


mflatt
2020-7-3 16:21:26

The more interesting build is racket/src/build. But it’s puzzling if racket/bin is empty.


soegaard2
2020-7-3 16:22:06

soegaard@mbp2 GitHub % cd racket/src/build soegaard@mbp2 build % ls Makefile config.log config.status foreign gracket plot racket


soegaard2
2020-7-3 16:23:31

soegaard@mbp2 GitHub % ls racket/build config soegaard@mbp2 GitHub % ls racket/bin


soegaard2
2020-7-3 16:24:54

Does make in-place depend in any way of the racket that happens to be in the terminal path? (it happens to be a racket 7.5).


soegaard2
2020-7-3 16:26:18

Found it!


soegaard2
2020-7-3 16:26:42

Don’t know why, but the result inded in racket/racket/bin and not racket/bin


soegaard2
2020-7-3 16:32:24

Okay - I think what broke the build in the first place. I did a: git fetch upstream pull/30/head:pr30 thinking it would fetch PR 30 from racket/math, but it of course fetched PR 30 from racket/racket.


soegaard2
2020-7-3 16:41:05

A git / Github question. I have a cloned and build racket/racket from Github. Now I want to test PR30 from racket/math. I have added a remote upstream-math pointing to racket/math. And now I attempt to fetch PR30 using git fetch upstream-math pull/30/head:pr30 following https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/checking-out-pull-requests-locally

However, I get the following error:

soegaard@mbp2 racket % git remote -v origin git@github.com:soegaard/racket.git (fetch) origin git@github.com:soegaard/racket.git (push) upstream <https://github.com/racket/racket> (fetch) upstream <https://github.com/racket/racket> (push) upstream-math <https://github.com/racket/math> (fetch) upstream-math <https://github.com/racket/math> (push) soegaard@mbp2 racket % git fetch upstream-math pull/30/head:pr30 fatal: Refusing to fetch into current branch refs/heads/pr30 of non-bare repository


soegaard2
2020-7-3 16:43:17

It may be due to racket/racket and racket/math being to separate repos. But if I clone racket/math locally, how to do I get the local clone of racket/racket use my clone of racket/math?


mflatt
2020-7-3 16:57:32

In the root directory of your racket checkout, use racket/bin/raco pkg update —clone extra-pkgs/math . Then work in extra-pkgs/math.


soegaard2
2020-7-3 16:57:46

Thanks!


mflatt
2020-7-3 16:59:34

Should be raco pkg update above


soegaard2
2020-7-3 17:05:22

racket/bin/raco pkg update --clone extra-pkgs <https://github.com/racket/math>


soegaard2
2020-7-3 17:06:52

Seems to work, but I get this in the end: ... raco pkg update: package conflicts with existing installed item  package: <https://github.com/racket/math>  item category: doc  item name: "math" Do I need to link math to the folder extra-pkgs/math ?


sorawee
2020-7-3 17:09:43

Found the cause: somehow, links.rktd contains both (root "pkgs/drracket") and (root "../../../racket-repos/drracket/drracket") (along with similar packages). Deleting the former fixes the problem.


mflatt
2020-7-3 17:23:29

That looks like you may have two maths installed somehow. When you use raco pkg update --clone, it makes the clone the installed package.


mflatt
2020-7-3 17:23:44

Do you have anything in ~/Library/Racket/development?


soegaard2
2020-7-3 17:24:57

soegaard@mbp2 development % cd ~/Library/Racket/development soegaard@mbp2 development % cat links.rktd (("math" "../../../Dropbox/GitHub/racket/extra-pkgs/math")) soegaard@mbp2 development % cat share/info-cache.rktd (((rel up up up up #"Dropbox" #"GitHub" #"racket" #"extra-pkgs" #"math") (collection deps implies pkg-desc pkg-authors) (lib "math") 1 0))


soegaard2
2020-7-3 17:25:13

That looks ok.


mflatt
2020-7-3 17:26:13

I don’t think you want that “links.rktd”.


mflatt
2020-7-3 17:27:28

Do you once use raco link with a Git checkout of racket? If so, raco pkg generally doesn’t see non-package links, so that would explain what went wrong.


soegaard2
2020-7-3 17:28:46

Yes, before the raco pkg update tip, I make a git clone copy of racket/math and then used raco link. Then I removed the link, and used raco pkg update instead.


soegaard2
2020-7-3 17:29:02

Should I just remove links.rktd ?


mflatt
2020-7-3 17:34:43

Yes. And never use raco link again. :slightly_smiling_face:


soegaard2
2020-7-3 17:35:46

ok!


soegaard2
2020-7-3 19:03:49

I decided to start from scratch. Cloned soegaard/racket. Did a make in-place. Then racket/bin/raco pkg update --clone extra-pkgs <https://github.com/racket/math> After that: cd extra-pkgs, git remote add upstream-math <https://github.com/racket/math> git fetch upstream-math pull/30/head:pr30 git checkout pr30 Then cd .. racket/bin/raco setup

But it seems that the changes from pr30 isn’t picked up. (I am testing with (require math) (gamma 1+i). Theraco pkg show -l mathcommand still refers to the checksum before pr30 is applied:soegaard@mbp2 racket % racket/bin/raco pkg show -l mathInstallation-wide: Package[*=auto]  Checksum                  Source math*       ad61293060bc718f3628e17a673658337fb7f187  (catalog “math” "<git://github.com/racket/math/?path=math>")User-specific for installation “development”: `


soegaard2
2020-7-3 19:34:38

The output of racket/bin/raco pkg update -h says:

`--clone &lt;dir&gt; : Clone Git and GitHub package sources to &lt;dir&gt; and link`

And it did clone both math-lib and friends:

soegaard@mbp2 racket % cd extra-pkgs          soegaard@mbp2 extra-pkgs % ls math math-doc math-lib math-test


soegaard2
2020-7-3 19:35:35

And checking with less math-lib/math/special-functions.rkt I can see that pr30 has been fetched.


soegaard2
2020-7-3 19:36:43

Hmmm. soegaard@mbp2 racket % racket/bin/raco link -l \| grep math  root path: "/Users/soegaard/Dropbox/GitHub/racket/racket/share/pkgs/math"  root path: "/Users/soegaard/Dropbox/GitHub/racket/racket/share/pkgs/math-test"  root path: "/Users/soegaard/Dropbox/GitHub/racket/racket/share/pkgs/math-lib"  root path: "/Users/soegaard/Dropbox/GitHub/racket/racket/share/pkgs/math-doc"  root path: "/Users/soegaard/Dropbox/GitHub/racket/racket/share/pkgs/math-x86_64-macosx"


soegaard2
2020-7-3 19:37:32

So it keeps using the math lib under /racket/share/.


maueroats
2020-7-3 19:38:54

In my clone I don’t have the math packages under racket/share after I clone them.


maueroats
2020-7-3 19:39:48

Will setup -c clean up that problem?


samth
2020-7-3 19:39:53

First, that’s odd. Second, as @maueroats says, usually you create a subdirectory of extra-pkgs for things. Third, I strongly recommend using one of the GitHub command line tools (either hub or gh) for merging pull requests easily.


maueroats
2020-7-3 19:40:35

Aha, though I had been doing it wrong so I deletd my comment. :slightly_smiling_face:


soegaard2
2020-7-3 19:41:30

So not `racket/bin/raco pkg update --clone extra-pkgs <https://github.com/racket/math> but instead: racket/bin/raco pkg update --clone extra-pkgs/math <https://github.com/racket/math> ?


maueroats
2020-7-3 19:43:21

I just do raco pkg update --clone math and I think it uses the package repo to figure out where to get it from.


soegaard2
2020-7-3 19:44:26

In time, I probably want it to fetch from soegaard/math instead of racket/math on Github.


soegaard2
2020-7-3 19:46:28

I am trying raco setup -c now.


maueroats
2020-7-3 19:47:20

Sounds like the problem is that it is cloning but does not recognize what package should be removed from pkgs/share? My pkgs/share have none of the packages I cloned, but I think I also did the clone before the first build… maybe…


samth
2020-7-3 20:01:23

@soegaard2 usually I do cd extra-pkgs; raco pkg update --clone math


samth
2020-7-3 20:01:48

ah, probably the issue is that racket/math does not refer to any of the packages you want


samth
2020-7-3 20:02:02

they are all subdirectories of that repo


maueroats
2020-7-3 20:09:01

^^ Nailed it. Watch for the step where raco trashes the old packages before going through everything. (This one makes a folder at the top level, oops.) raco pkg update --clone sgl <https://github.com/racket/sgl> Querying Git references for sgl at <https://github.com/racket/sgl> Updating: sgl Querying Git references for sgl at <https://github.com/racket/sgl> Cloning remote repository <https://github.com/racket/sgl> to /home/.../racket/sgl git clone -b master <https://github.com/racket/sgl> . Fetching from remote repository <https://github.com/racket/sgl> git fetch <https://github.com/racket/sgl> master Cloning repository locally for staging git clone --shared /home/.../racket/sgl /var/tmp/15938065091593806509794-sgl git checkout 7999abdf79058cc709da0e49dee4ec0569249085 Merging commits at /home/docmo/Documents/2020b/racket/sgl git merge --ff-only 7999abdf79058cc709da0e49dee4ec0569249085 Already up to date. Uninstalling to prepare re-install of sgl Moving sgl to trash: /home/.../racket/racket/share/pkgs/.trash/1593806511-0-sgl Re-installing sgl


samdphillips
2020-7-3 20:11:02

There’s a bit in this video where Andy talks about the tagging in Chez https://youtu.be/BcC3KScZ-yA\|https://youtu.be/BcC3KScZ-yA


soegaard2
2020-7-3 20:11:13

I didn't the "Uninstalling" part. I got: soegaard@mbp2 racket % racket/bin/raco pkg update --clone extra-pkgs <https://github.com/racket/math>  Querying Git references for math at <https://github.com/racket/math> Updating:  math Querying Git references for math at <https://github.com/racket/math> Cloning remote repository <https://github.com/racket/math>  to /Users/soegaard/Dropbox/GitHub/racket/extra-pkgs git clone -b master <https://github.com/racket/math> . Fetching from remote repository <https://github.com/racket/math> git fetch <https://github.com/racket/math> master Cloning repository locally for staging git clone --shared /Users/soegaard/Dropbox/GitHub/racket/extra-pkgs /var/folders/01/7wc7rqn95cl_2w6wvjt2_x440000gn/T/15938054081593805408714-math git checkout ad61293060bc718f3628e17a673658337fb7f187 raco pkg update: package conflicts with existing installed item  package: <https://github.com/racket/math>  item category: doc  item name: "math"


soegaard2
2020-7-3 20:14:22

Wait - racket/math and math are different.


soegaard2
2020-7-3 20:14:47

I am working on math.


samth
2020-7-3 20:15:09

http://github.com/racket/math\|github.com/racket/math contains a bunch of subdirectories, one of which is called math and corresponds to the math package. Others are called things like math-lib and math-doc and correspond to those packages.


soegaard2
2020-7-3 20:15:25

Oooh.


samth
2020-7-3 20:15:53

I think what you did was replace the “math” package (which is empty and just depends on other things) with a package that contains a collection named “math” that has subcollections named “math-lib” etc


samth
2020-7-3 20:15:59

which is not what you want.


samth
2020-7-3 20:17:38

You might try the following: raco pkg remove --force --no-setup math rm -rf extra-pkgs mkdir extra-pkgs cd extra-pkgs raco pkg install --clone math


soegaard2
2020-7-3 20:21:51

I get: soegaard@mbp2 extra-pkgs % ../racket/bin/raco pkg install --clone math Inferred package name from given—clone’ path package: math given path: mathResolving “math” via https://pkgs.racket-lang.orgpackages from a Git repository would not share a local clone repository: <git://github.com/racket/math/> local clone: /Users/soegaard/Dropbox/GitHub/racket/extra-pkgs/math/ packages for local clone:  math non-clone packages:  math-doc  math-test  math-libConvert the non-clone packages to clones, too? [Y/n/a/c/?]`


soegaard2
2020-7-3 20:22:20

I suppose Y is the right choice?


maueroats
2020-7-3 20:30:30

Definitely


maueroats
2020-7-3 20:31:55

Imo better to have a bunch of extras than go through the pain of fixing it later… like I end up wanting to edit the docs, which would never happen if that repo was not just sitting there.


soegaard2
2020-7-3 20:34:29

Still recompiling. :slightly_smiling_face:


mflatt
2020-7-3 20:41:01

What Sam means is that <https://github.com/racket/math> is not the package source for the math package. The simplest thing is to use just math.


soegaard2
2020-7-3 20:42:37

Okay - that explains (part of at least) my confusion.


soegaard2
2020-7-3 20:49:06

Success! ./racket/bin/raco pkg install --clone math worked.


soegaard2
2020-7-3 20:49:12

I better write this down…


mflatt
2020-7-3 20:50:04

You could also use <https://github.com/racket/math?path=math>, but the intent of raco pkg update --clone is that you don’t have to go find the original package path. Let raco pkg update can infer a clone source from the current math installation.


soegaard2
2020-7-3 20:51:21

Suppose I clone racket/math on github to soegaard/math also on github. Then I would need to use `<https://github.com/soegaard/math?path=math> ?


mflatt
2020-7-3 20:57:20

You could do that, but I generally find it easier to leave the clone attached (on the sense of the Git origin) to the repo that is registered with the package server. That way, any updates to the main repo get pulled by raco pkg update. To pull and push at a different repo, I specify it explicitly in Git commands, such as git pull git@github.com:mflatt/math bug-fix-for-pr or git push git@github.com:mflatt/math master:bug-fix-for-pr.


samth
2020-7-3 20:57:37

Best to write it down in docs


mflatt
2020-7-3 20:59:35

I also have things configured so that I can push to git@github.com:racket/math but not <https://github.com>:racket/math, where the https form is what raco pkg update --clone sets at the origin. That way, it’s much more difficult for me to accidentally push to the main branch. But I guess that trick won’t work for anyone who has https authentication set up properly.


sorawee
2020-7-3 21:04:27

What I did is git remote add patch git@github.com:sorawee/typed-racket.git


soegaard2
2020-7-3 21:04:56

Thanks for the advice. I like pushing to the soegaard/x first before making a pull request to racket/x. The github diffs helps catching silly mistakes.

Thanks also to @samth and @maueroats .

I see that raco pkg update pulling any updates is a good thing. But doesn’t that imply ( if origin points to racket/math ) that a git push will push directly to the racket repo. (something I’d like not to do by mistake).


sorawee
2020-7-3 21:05:40

Then you can git push patch branchname


sorawee
2020-7-3 21:06:31

@soegaard2 you can git push -u patch branchname


sorawee
2020-7-3 21:06:50

This will set default push to patch


sorawee
2020-7-3 21:06:59

rather than origin


soegaard2
2020-7-3 21:09:02

That matches git remote add upstream-math <https://github.com/racket/math> Just with patch instead of upstream-math ?


sorawee
2020-7-3 21:09:32

When you raco pkg update --clone


sorawee
2020-7-3 21:09:57

racket/math is already your origin, I believe


sorawee
2020-7-3 21:10:13

So you should git remote add to your local repo


soegaard2
2020-7-3 21:11:14

Just checked. And yes --clone makes racket/math the origin.


nata.chaykivska
2020-7-3 21:21:04

@nata.chaykivska has joined the channel


samth
2020-7-3 21:55:11

Usually the remote set up by raco pkg update —clone is not pushable


samth
2020-7-4 01:32:25

Now that I’m finally back at my computer, my usual steps are: 1. Update to use a clone: cd extra-pkgs; raco pkg update --clone math (and answer yes to the prompts) 2. Do some work, commit changes. 3. Set up a remote for my fork: hub fork (the hub tool is really great) 4. git push samth (pushes to my fork) 5. hub pull-request (creates a pull request using the current branch I’m on) Alternatively, if I want to be able to push directly to racket/math, I would do hub remote add -p racket/math, which creates a remote called racket that I can push to, and keeps origin the same and thus I can’t just accidentally do a git push to the upstream repo.


jcoo092
2020-7-4 01:52:32

Thanks @spdegabrielle :slightly_smiling_face:


xiaobaoispig
2020-7-4 02:21:07

@xiaobaoispig has joined the channel