heefoo
2021-9-2 10:34:56

I am trying to compile the swig simple example for racket https://github.com/swig/swig/tree/master/Examples/mzscheme/simple Can anyone verify that it works ? It doesn seem to be compatible with latest bc racket


soegaard2
2021-9-2 10:35:28

Maybe @ryanc has tried recently?


heefoo
2021-9-2 10:36:19

I really don’t want to switch to python :confused: :confused:


ryanc
2021-9-2 12:12:09

I haven’t tried the mzscheme plugin, but I’m working on a new plugin that generates Racket code (ffi/unsafe): https://github.com/rmculpepper/swig. (I guess @soegaard2 saw the fork?) Draft docs are in racket.md in the main directory for now; I haven’t converted them to HTML yet.


soegaard2
2021-9-2 13:56:16

Hi All,

I need an extra pair of eyes to solve this problem. I am attempting to make Github Actions build my code each time I push to racket-cas. The build starts fine, but I am getting errors like: raco setup: --- summary of package problems --- [13:38:16] raco setup: undeclared dependency detected raco setup: for package: "racket-cas" raco setup: on packages: raco setup: "base" raco setup: "math-lib" raco setup: "rackunit-lib" raco setup: "scribble-lib" raco setup: on package for build: raco setup: "at-exp-lib" Error: Process completed with exit code 1. So … I add these to the info files, but it doesn’t seem to help. Obviously, I am missing something, but what?

The log file: https://github.com/soegaard/racket-cas/runs/3496243356?check_suite_focus=true The repo: https://github.com/soegaard/racket-cas


massung
2021-9-2 14:03:25

Maybe I’m wrong — hardly a raco expert — but is the error saying that it’s your package that has the missing deps or “at-exp-lib” (in racket-cas-doc as a dep) that has the issues?


soegaard2
2021-9-2 14:05:15

I believe so. The snippet above is the summary. Above the summary, there are loads of messages like: raco setup: found undeclared dependency: raco setup: mode: run raco setup: for package: "racket-cas" raco setup: on package: core raco setup: dependent source: /home/runner/work/racket-cas/racket-cas/racket-cas/compiled/trig-expand_rkt.zo raco setup: used module: (lib "racket/syntax.rkt")


greg
2021-9-2 14:18:40

I usually have raco pkg install --deps search-auto to install my own package and then raco test ___ to run tests. I’m not sure about your 3 separate raco pkg install steps (and their flags) followed by a raco setup? Maybe that’s trying to do something special I haven’t had to deal with, but, maybe that’s also contributing to the problem you’re seeing??


greg
2021-9-2 14:22:05

(With raco pkg install --deps search-auto, if I’ve ever gotten deps warnings, they’ve been genuine problems and fixed by updating my info.rkt.)


soegaard2
2021-9-2 14:24:00

- name: Register local packages run: \| cd ../.. raco pkg install -i --auto --no-setup --skip-installed rackunit-lib raco pkg install -i --auto --no-setup --skip-installed racket-cas/ raco pkg update --auto --no-setup racket-cas cd racket-cas - name: Setup Collections run: raco setup --check-pkg-deps racket-cas I simply copied the approach from one of my other packages. And now I can’t remember why I did it that way. I’ll try --deps search-auto.

I think, manually installing the packages can make the build step succeed without correct info files (in some cases) - maybe?.


soegaard2
2021-9-2 14:25:50

It’s worth noting that racket-cas isn’t on the package server.


greg
2021-9-2 14:31:46

FWIW I usually have a Makefile with targets for use locally, or for use by CI, or both. For example: https://github.com/greghendershott/sha/blob/master/Makefile


greg
2021-9-2 14:32:02

And then the GitHub Actions use of it is effectively just make install && make check-deps && make test. For example: https://github.com/greghendershott/sha/blob/master/.github/workflows/test.yml#L27-L32


greg
2021-9-2 14:33:50

(For raco pkg etc. sometimes I use command-line flags that are from older versions of Racket. Because I set it up then. And for some packages, I want them to keep working on older Rackets. So… there might be newer more-concise variations of these if you only care about newer Rackets, idk.)


soegaard2
2021-9-2 14:34:47

Thanks for sharing these.


soegaard2
2021-9-2 14:40:31

I think, it is working now. Thanks for the pointers.


jestarray
2021-9-2 20:06:29

wait, so with this: https://pkgs.racket-lang.org/package/c #lang c in main() {} you can write C code?! what compiler does it use?


sorawee
2021-9-2 20:08:35

It uses the cc program, which could be aliased to either gcc or clang or other compilers



jestarray
2021-9-2 20:09:23

guessing on windows it would use msvc? that’s pretty neat


jestarray
2021-9-2 20:09:39

is there a high cost to calling out to FFI ?


jestarray
2021-9-2 20:12:32

is there a program that auto-generates ffi bindings for racket based on a C header file? something akin to bindgen on rust?


jestarray
2021-9-2 20:13:08

sorawee
2021-9-2 20:14:49

As far as I know, that library works for Racket BC


jestarray
2021-9-2 20:15:04

works only for BC ? not CS?


sorawee
2021-9-2 20:15:36

yeah


jestarray
2021-9-2 20:15:42

awwww


samdphillips
2021-9-2 20:25:23

jestarray
2021-9-2 20:40:12

@ryanc tell us when its ready to use!


soegaard2
2021-9-2 22:10:25

Apropos previous discussion on Github Actions: A tool for running the actions locally (to get faster feedback) https://github.com/nektos/act


dan.ml.901
2021-9-3 00:34:40

Is there a Racket function that turns an absolute path into a relative path (given a path it should be relative to)?



dan.ml.901
2021-9-3 00:35:27

e.g. (find-relative-path (build-path "a" "b" "c" "file.txt") (build-path "a" "b")) -> #<path:c/file.txt>


dan.ml.901
2021-9-3 00:35:59

(in my scenario the first path is coming from glob so is absolute and constructed according to an arbitrary glob)


dan.ml.901
2021-9-3 00:41:07

That’s the one, thanks!


jestarray
2021-9-3 01:02:47

does BSL or any of the later variants provide a way to enforce the type signatures opposed to them just being comments?


sorawee
2021-9-3 01:06:41

In ASL, there’s a : form that allows you to check against a signature


sorawee
2021-9-3 01:06:55

E.g.,

(: x Integer) (define x "a")


jestarray
2021-9-3 01:08:54

ahh there we go, i was watching a talk about htdp taught by someone in germany i think and was wondering when that was introduced


jestarray
2021-9-3 01:09:09

so that’s only introduced in ASL? its stated in the book too ?


sorawee
2021-9-3 01:12:37

Correction: the “Available from Catalog” has a list of packages that can be selected


shu--hung
2021-9-3 01:27:03

Germany! Could be a different language. But I can’t read German :disappointed: https://www.deinprogramm.de/ and https://github.com/racket/deinprogramm


shu--hung
2021-9-3 01:28:41

I believe the deinprogramm-signature package does some signature checking


jestarray
2021-9-3 01:37:53

that doesnt come built in with racket though? hmm.. i guess i can jump to ASL pretty soon


shu--hung
2021-9-3 01:40:26

It does. It is in the main distribution. The DeinProgramm plugins are also loaded by default.


shu--hung
2021-9-3 01:43:10

It is in German. Not sure if it’s what you saw


jestarray
2021-9-3 01:43:31

how do i add it in BSL? (require deinprogramm-signature) ?


jestarray
2021-9-3 01:44:34

ahh.. if the error messages are in german then i think i might avoid it for ASL instead


shu--hung
2021-9-3 01:45:18

Sorry, my words are confusing. I mean it’s for a different teaching language…


jestarray
2021-9-3 01:45:28

ohhhhh, yeah.. nevermind then


shu--hung
2021-9-3 02:16:06

Is there an idiomatic way to put context information on a list-ish syntax object? That is, instead of #'(A B C), having something like (datum->syntax this-syntax (list #'A #'B #'C))

A related question: is there an idiomatic way to place source location on forms nested inside a syntax template, without having to introduce an extra pattern variable?


jestarray
2021-9-3 02:51:34

does racket doesnt have support for algebraic types in #lang racket ? or do you need a package for it?


jesse697
2021-9-3 06:14:18

@jestarray perhaps you might be interested in https://pkgs.racket-lang.org/package/algebraic