ryanc
2021-3-18 10:12:43

SRFI 141 (https://srfi.schemers.org/srfi-141/srfi-141.html) looks like it might be a later version of the r7rs page.


ben.knoble
2021-3-18 13:05:28

@panduwana Siyuan Chen is referring to the way, e.g., the fmap function is specialized for different instances of a type-class. When you use it, you effectively ask the compiler to find the “right” instance of fmap —this translates to an implicit dictionary of the member of the type-class being threaded through, so that you have access to the right functions.


anything
2021-3-18 13:14:57

I love this!


joel
2021-3-18 13:59:31

Update, I published it here: https://github.com/otherjoel/amulet-mining


sschwarzer
2021-3-18 16:38:42

I ran tests with raco test and got a contract violation, but no stacktrace. Following https://github.com/racket/rackunit/issues/97 I do get a stacktrace, but I wonder if adding errortrace to #lang on the “top” module level will prevent the compiler from making certain optimizations (e. g. inlining). I think there should be a way to get stacktraces in tests without impacting the normal program execution (i. e. when not running tests).

My tests are in a submodule (module+ test ...) in the module under test.

Is the explanation in https://github.com/racket/rackunit/issues/97 still best practice or is there another way to get stacktraces?


laurent.orseau
2021-3-18 16:40:18

IIRC, Try raco test --use-errortrace file.rkt after deleting the compiled directory


bedeke
2021-3-18 16:44:35

Hi all, if I create a (define-type Something% (Class ...)) in TR. Is it possible to link this to an interface that I can check in untyped racket?


bedeke
2021-3-18 16:45:01

I’m trying to do something like #lang racket/base (module tr typed/racket/base (require typed/racket/class) (provide Test<%> test%) (define-type Test<%> (Class (fct (-> Number Number)))) ;(define test<%> : Test<%> (interface () fct)) (define test% : Test<%> (class object% (super-new) (define/public (fct x) x))) ) (module rr racket/base (require (submod ".." tr) racket/class) (define t (new test%)) (is-a? t Test<%>))


ahnaaf20
2021-3-18 16:45:50

How do I write a function where I can match a list with another list and get the list as an output if that matches. For example INPUT - ( function ‘((#\a #\b #\c) (#\a #\c #\d) (#\d #\e #\f)) ‘(#\a #\b))

OUTPUT - (#\a #\b #\c)

I still couldn’t solve it. Please help


sschwarzer
2021-3-18 16:46:05

I get the error message raco test: unknown switch: --use-errortrace and I don’t see --use-errortrace in the output of raco test --help. When I run raco pkg install errortrace (just to verify), I get Resolving "errortrace" via <https://download.racket-lang.org/releases/8.0/catalog/> Using cached16145129791614512979994 for <https://download.racket-lang.org/releases/8.0/pkgs/errortrac> e.zip raco pkg install: package is currently installed in a wider scope package: errortrace installed scope: installation given scope: user so the errortrace package seems to be there (which should be the case anyway since I could the stacktrace with #lang errortrace racket/base :slightly_smiling_face: ).


laurent.orseau
2021-3-18 16:47:46

Right. Try instead raco test -l errortrace file.rkt then maybe


laurent.orseau
2021-3-18 16:48:06

(where is this --use-errortrace used then?)


samth
2021-3-18 16:49:00

No, that’s not possible. Types and interfaces are pretty different — interfaces have to be declared up-front and are runtime values, class types are neither of those.


sschwarzer
2021-3-18 16:49:37

raco test -l errortrace file.rkt gives me raco test: "/home/.../racket/current/share/pkgs/errortrace-lib/errortrace/main.rkt" raco test: @(test-responsible '(mflatt robby florence)) raco test: module not found module path: task.rkt context...: .../private/map.rkt:40:19: loop [repeats 1 more time] ...


sschwarzer
2021-3-18 16:50:37

By the way, this is Racket 8.0 cs, in case it’s relevant.


laurent.orseau
2021-3-18 16:52:49

Oh right, yes, raco test -l errortrace file.rkt will test errortrace indeed. Maybe the --use-errortrace option is gone in CS?


bedeke
2021-3-18 16:58:42

ok, thx


shu--hung
2021-3-18 16:59:07

I don’t think the option is there in the first place


shu--hung
2021-3-18 16:59:48

A workaround: racket -l racket/init -l errortrace -e '(require (submod "file.rkt" test))'


laurent.orseau
2021-3-18 17:03:21

From: https://docs.racket-lang.org/errortrace/quick-instructions.html?q=errortrace racket -l errortrace -t &lt;prog&gt; after deleting the compiled directory


laurent.orseau
2021-3-18 17:03:49

(dang, I can’t have invented this --use-errortrace ! :smile: )


shu--hung
2021-3-18 17:10:39

-t requires the main submodule, not test though.


sschwarzer
2021-3-18 17:10:41

@laurent.orseau Would be a nice invention though. :wink:


sschwarzer
2021-3-18 17:11:52

@laurent.orseau But I want to use errortrace with raco test, not with with racket. :slightly_smiling_face: Or is there a way to “map” the raco test invocation to a racket invocation?


sschwarzer
2021-3-18 17:13:11

Ok, the mapping seems to be what @shu—hung wrote. But I wonder if there’s a simpler way?


shu--hung
2021-3-18 17:16:18

I’ve got this when your are testing for exactly one file without parallelization https://github.com/shhyou/raco-test-with-errortrace but it doesn’t work in general


shu--hung
2021-3-18 17:18:03

You could isntall this wiht raco pkg install URL or download it and call raco pkg install in the local copy


sschwarzer
2021-3-18 17:40:02

@shu—hung Works as advertised (with a single file). :+1:


joshuahoeflich2021
2021-3-18 17:56:44

@joshuahoeflich2021 has joined the channel


juanesgonzalez746
2021-3-18 20:21:22

Hello colleagues could you help me to do a job that I have no idea how to do it, and it is this below …

The Chamber of Commerce of the city of Tuluá has registered an amount N of micro-businesses dedicated to the sale of minutes, for which you need a program to control these businesses, and produce the following data as a result: 1. (1.5 points) Number of sales made by all companies in one or more given weeks. 2. (1.5 point) Profit obtained by all companies detailing the company that sold the most (name and quantity), the least sold (name and quantity) and the average sales of all of them. Each one of the businesses is identified by a code, name and a list of the operators it uses, since in Tuluá there are 5 operators and each business works with two or more operators. Information is saved for each of the operators specific, such as code, name, cost minute, sale value per minute and sale, where sale is a list with each of the weeks worked and the number of minutes sold in this one. It should be taken into account that a year has 52 weeks and a company can work 5 or more weeks.


tov
2021-3-19 02:20:31

Hmmm…. Thanks @ryanc!


philip.mcgrath
2021-3-19 04:15:17

@massung According to https://youtu.be/EZD3Scuv02g?t=989 the Fortress type system could assert properties like commutativity. They apparently had a unit testing system to dynamically check that the properties held, but didn’t get as far as trying to make a theorem prover verify them at compile-time.