SRFI 141 (https://srfi.schemers.org/srfi-141/srfi-141.html) looks like it might be a later version of the r7rs page.
@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.
I love this!
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?
IIRC, Try raco test --use-errortrace file.rkt after deleting the compiled directory
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?
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<%>))
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
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: ).
Right. Try instead raco test -l errortrace file.rkt then maybe
(where is this --use-errortrace used then?)
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.
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]
...
By the way, this is Racket 8.0 cs, in case it’s relevant.
Oh right, yes, raco test -l errortrace file.rkt will test errortrace indeed. Maybe the --use-errortrace option is gone in CS?
ok, thx
I don’t think the option is there in the first place
A workaround: racket -l racket/init -l errortrace -e '(require (submod "file.rkt" test))'
From: https://docs.racket-lang.org/errortrace/quick-instructions.html?q=errortrace racket -l errortrace -t <prog> after deleting the compiled directory
(dang, I can’t have invented this --use-errortrace ! :smile: )
-t requires the main submodule, not test though.
@laurent.orseau Would be a nice invention though. :wink:
@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?
Ok, the mapping seems to be what @shu—hung wrote. But I wonder if there’s a simpler way?
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
You could isntall this wiht raco pkg install URL or download it and call raco pkg install in the local copy
@shu—hung Works as advertised (with a single file). :+1:
@joshuahoeflich2021 has joined the channel
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.
Hmmm…. Thanks @ryanc!
@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.