Re: [racket-users] Syntax Parse Bee 2021

2021-09-15 Thread Ben Greenman
are syntax classes. Still others are more like starter code for a new DSL. The code inside these submissions is **very** informative. Whether you're new to macros or a seasoned syntax parser, there is a lot to learn from. - Ben + Stephen On 8/26/21, Ben Greenman wrote: > On 8/25/21, Stephen De Gabrie

Re: [racket-users] How to set type signature for recursive lazy list

2021-07-14 Thread Ben Greenman
On 7/14/21, Kiong-Gē Liāu wrote: > Thanks, following Ben's suggestion that follow code works Great! -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to

Re: [racket-users] How to set type signature for recursive lazy list

2021-07-13 Thread Ben Greenman
On 7/13/21, Kiong-Gē Liāu wrote: > Ben, > > Thanks, changing "stream" to "stream apply" does solve the issue. > > I tried to push it further little bit with the following code to see if > typed racket can support generic like Haskell or Scala: > > #lang typed/racket > > (require pfds/stream) > >

Re: [racket-users] How to set type signature for recursive lazy list

2021-07-12 Thread Ben Greenman
On 7/11/21, Kiong-Gē Liāu wrote: > Hi, in non-typed racket, I can define a generalized Fibonacci sequence > > X[n+k] = f(X[n], X[n+1], , X[n+k-1]) > > using the following code > > #lang racket > > (require racket/stream) > > (define (gfib f xs) > (define (gfib_t xs) > (stream-cons

[racket-users] Syntax Parse Bee 2021

2021-06-30 Thread Ben Greenman
Hi folks, *Write a macro with Racket this summer! Win stickers!* The purpose of this event is to grow the syntax-parse-example documentation and repository to grow as a resource for the Racket community. But you do not need to submit a full example to win stickers --- any syntax-parse macro

Re: [racket-users] Plot Problem: No Line; Bounds not found

2021-06-15 Thread Ben Greenman
On 6/15/21, Britt Anderson wrote: > Thanks for the help to my specific problem. More generally, what should > have clued me in to a contract or type error when the only message received > had to do with y plot bounds? Just looking for practical advice to help me > figure out things on my own

Re: [racket-users] Plot Problem: No Line; Bounds not found

2021-06-15 Thread Ben Greenman
On 6/15/21, Britt Anderson wrote: > > I was starting to explore plot and I am getting a behavior I do not > understand. plot doesn't seem to be able to figure out the bounds for > something that seems pretty straight-forward. When I give bounds as an > optional argument I don't see the line I

Re: [racket-users] Can a new user defined pkg encompass nothing more than references to previously defined pkgs?

2021-06-06 Thread Ben Greenman
On 6/6/21, Don Green wrote: > > Can a new user defined pkg encompass nothing more than references to > previously defined pkgs so that every user created module references a > single user defined pkg? Yes. You can make a new package whose main.rkt provides lots of identifiers from other

Re: [racket-users] Is there a good Racket DSL alternative to Image Magick?

2021-05-12 Thread Ben Greenman
On 5/12/21, Robert Haisfield wrote: > Daniel, that's awesome. How would I filter down this list according to the > regex? > > (define list-of-files (map path->string (directory-list starting-path))) You can wrap it in a filter: (define list-of-files (filter (lambda (str) (regexp-match?

Re: [racket-users] student produces absolutely bonkers environment lookup code

2021-05-07 Thread Ben Greenman
On 5/7/21, Shu-Hung You wrote: > Not that I have any idea of what's going on, but interestingly, Typed > Racket's second ->* example has (1)(3)(4). The use of list* may be > possible if one follows the type (List* String Natural x) in the > example. > >

Re: [racket-users] Package install conflicts on the Racket package catalog

2021-05-05 Thread Ben Greenman
On 5/5/21, Siddhartha Kasivajhula wrote: > Thank you, that helped me understand the issue. I've made the appropriate > changes so hopefully that'll do it. > > This is reminding me that in python package distribution land, you are able > to explicitly indicate which files make it into the package

Re: [racket-users] Typed Racket: type relations

2021-04-19 Thread Ben Greenman
3. I don't see any boundaries where you describe -- can you say more? >>> >>> Run typed-performance.rkt and see: >> >> This might be related to >> https://github.com/racket/typed-racket/issues/289. >> > > So basically my unsafe-reprovide module should probably use some syntax > trickery to

Re: [racket-users] Re: How do I debug this performance problem?

2021-04-05 Thread Ben Greenman
> I've noticed that Typed Racket adds seemingly unnecessary chaperones when > the Any type is involved, but maybe they are necessary for some reason? The > following code tries to create a chaperone that I don't think is necessary. > > #lang racket > > (module m typed/racket > (provide f) > (:

Re: [racket-users] Sticky scrollable nav bar in docs

2021-02-18 Thread Ben Greenman
"sticky" looks worse to me on that example page --- I have to scroll to the bottom of all the set docs before I can read the navbar On 2/18/21, Yury Bulka wrote: > I agree this is a useful improvement. I would consider using "position: > sticky" instead of "position: fixed" as that is generally

Re: [racket-users] file/gzip trouble reading

2021-02-16 Thread Ben Greenman
On 2/16/21, Dominik Pantůček wrote: > > On 16. 02. 21 22:27, Matthew Flatt wrote: >> At Tue, 16 Feb 2021 16:03:29 -0500, Ben Greenman wrote: >>> Sadly, I've already compressed a few files using >>> `call-with-output-string` ... is there an easy way to decompr

Re: [racket-users] file/gzip trouble reading

2021-02-16 Thread Ben Greenman
On 2/16/21, Matthew Flatt wrote: > At Tue, 16 Feb 2021 15:44:54 -0500, Ben Greenman wrote: >> But in my compressed string, the second >> byte is #o357 for some reason. I'm not sure how that could have >> happened ... some kind of encoding issue with string ports? > &

[racket-users] file/gzip trouble reading

2021-02-16 Thread Ben Greenman
I'm trying to use `gzip-through-ports` and I haven't been able to unzip compressed data. Here's a tiny example. I think this should print "hello world": ``` #lang racket (require (only-in file/gzip gzip-through-ports) (only-in file/gunzip gunzip-through-ports)) (define src "hello world")

Re: [racket-users] History changes

2021-01-10 Thread Ben Greenman
> It would be nice if I don’t have to modify scribble-lib, or, failing that, > avoid touching documenting forms. Isn’t it possible for history to know > which defform it’s under? A history might not appear under a defform (for better or worse). Maybe it's easier to give a list of links to the

Re: [racket-users] Scribble and main.rkt

2020-12-22 Thread Ben Greenman
> Is it correct that calling the main file of the package something else than > main.rkt is bad style, unsupported by Scribble? It's okay to call the main file something else, but you'll have to tell Scribble about it. Right now, I guess you have a @defmodule[typed-compose]{} somewhere. That

Re: [racket-users] compose in Typed Racket

2020-12-10 Thread Ben Greenman
>> A package for compose-n and compose-3 to like 10 or 20? Yes I like the idea of _small packages that do one thing_ better than _one-stop all-utility packages_ ... but do what you think makes sense. >> Someday later, perhaps poly dots and #:rest-star can combine to >> improve the built-in

Re: [racket-users] compose in Typed Racket

2020-12-09 Thread Ben Greenman
> If the answer is no, is there any interest in including these three > functions (as well as compose-5, 6, 7, 8) into Typed Racket? I think these would be excellent in a package. Someday later, perhaps poly dots and #:rest-star can combine to improve the built-in type. -- You received this

Re: [racket-users] multi line scribble text body in web-server template

2020-11-01 Thread Ben Greenman
Thats the nor On 11/1/20, krs...@gmail.com wrote: > > Hi!, > > I am using web-server/templates > . > I am confused why this just displays the last line?: > > @when[#t]{ > first > second > } That's normal "when" behavior ```

Re: [racket-users] Contracts for (partially) specifying dictionary key -> value-predicates

2020-10-31 Thread Ben Greenman
On 10/31/20, jackh...@gmail.com wrote: > I'm not sure, but I have a feeling Ben's suggestion to make them functions > instead of macros wasn't about the performance implications of macros. Right. I was only thinking that macros are hard to build on. But then, I can use dictof/proc here. -- You

[racket-users] large hash/dc errors (was: Contracts for (partially) specifying dictionary key -> value-predicates)

2020-10-30 Thread Ben Greenman
> Ben: if you have an example of the bad hash/dc error message I'd be > interested to see it. > > Robby Here's the kind of message that turned me off: ``` ctc.rkt:34:0: broke its own contract promised: (hash/dc (k (or/c (quote a) (quote b) (quote c))) (v (k) (config-value/c k)) #:immutable #t

Re: [racket-users] Contracts for (partially) specifying dictionary key -> value-predicates

2020-10-30 Thread Ben Greenman
On 10/29/20, William J. Bowman wrote: > I'm considering implementing, maybe as a library or a pull-request to > racket/dict, contracts for (partially) specifying which keys exist in a > dictionary and a contract for the value on that key. Great! Please make the contract error messages point out

[racket-users] Re: Typed Racket Survey — RSVP

2020-10-23 Thread Ben Greenman
Reminder: the survey will close at the end of this weekend (Sunday Oct 25 11:59pm anywhere on earth). Thank you to everyone that's filled it out so far! On 10/17/20, Ben Greenman wrote: > Hi Racketeers, > > Hope you are having a great RacketCon weekend. > > Typed Racket was de

Re: [racket-users] [racket users] Macros sharing data?

2020-10-21 Thread Ben Greenman
You can use syntax-local-value to communicate across macros. Here's an example: https://docs.racket-lang.org/syntax-parse-example/index.html?q=cross-macro#(mod-path._syntax-parse-example%2Fcross-macro-communication%2Fcross-macro-communication) On 10/21/20, Kevin Forchione wrote: > Hi

[racket-users] Typed Racket Survey — RSVP

2020-10-17 Thread Ben Greenman
. Thank you, Ben Greenman & Shriram Krishnamurthi -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. To view t

Re: [racket-users] [scribble] Are nested lists possible?

2020-10-13 Thread Ben Greenman
On 10/13/20, David Storrs wrote: > @itemlist[ > @item{The size cage needed depends on the type of dog > @itemlist[ > @item{Pug: Small} > @item{Collie: Medium} > @item{Mastiff: Large}]}] > > I would like to produce something that looks like this: > >- The size cage needed

Re: [racket-users] Scribbling hexadecimal values

2020-09-18 Thread Ben Greenman
+1 For now, I've used hacks like `(string->number "#x...")` for typesetting https://docs.racket-lang.org/pict-abbrevs/index.html On 9/18/20, Dominik Pantůček wrote: > Hello Racketeers, > > I am struggling to make scribble typeset default values in > proc-doc/names in hexadecimal. An example

Re: [racket-users] Advice for beginner

2020-09-08 Thread Ben Greenman
The student languages are not subsets of Racket. On 9/7/20, Denis Maier wrote: > > Hi, > > I've started working with the Htdp textbook as I'd like to acquire a solid > foundation in (functional) programming. The approach to teaching > programming looks very promising. Having this ressource

Re: [racket-users] Proper place to store log file

2020-08-24 Thread Ben Greenman
On 8/24/20, Thomas Del Vecchio wrote: > Hi everyone! > > I'm currently working on some usage logging for a language we're > developing. We need to store a persistent file that is shared across a > given device (so that the same log file is used regardless of where you are > > working). Is there a

Re: [racket-users] Replace pre-installed rackunit with git source

2020-07-22 Thread Ben Greenman
On 7/22/20, Sam Tobin-Hochstadt wrote: > To figure out where things are, I recommend the `raco fc` command, > which is in the `raco-find-collection` package. > > Almost certainly what went wrong is that you installed the cloned > `rackunit` directory as a package. Instead, you need to install all

Re: [racket-users] require and syntax-case

2020-07-13 Thread Ben Greenman
On 7/13/20, Roman Klochkov wrote: > I tried > ``` > (define-syntax my-file > (make-require-transformer >(lambda (stx) > (syntax-case stx () >[(_ path) > (printf "Importing: ~a~n" #'path) > (expand-import #'(file path))] > (require (my-file "test.rkt")) > ```

Re: [racket-users] "is not in my domain"

2020-06-01 Thread Ben Greenman
On 5/29/20, Beatriz Moreira wrote: > > > Hi, im a beginner with racket and im using it to implement a language in > order to test its operational semantic rules. > > This is the function where i keep having the error: > > (define-metafunction FS > > call : env-ß classes address f ((x v)...) -> e

Re: [racket-users] Inference for polymorphic functions not supported?

2020-05-18 Thread Ben Greenman
On 5/18/20, Hendrik Boom wrote: > I keep getting the messages like > > Type Checker: Inference for polymorphic keyword functions not supported in: > (sort hash-list string (symbol->string (car p))) #:cache-keys? #t) The way to avoid guesswork here is `inst`: ((inst sort (Pair Symbol Natural)

Re: [racket-users] Mysterious multiple values in a typed-racket program

2020-05-09 Thread Ben Greenman
On 5/9/20, Hendrik Boom wrote: > I get the message > > readspec.rkt:195:8: Type Checker: Expression should produce 3 values, but > produces 1 values of types String in: (for/set : (Setof String) (((l : > String) (cast (in-lines input-port) (Sequenceof String (cast > (string-trim l) String)) >

Re: [racket-users] Rhombus project plan

2020-04-30 Thread Ben Greenman
On 4/29/20, Sorawee Porncharoenwase wrote: > (Not directly related to Rhombus) Speaking of “how to contribute”, I find > that it is not friendly at all to setup stuff in order to contribute to > Racket core and main distribution. According to >

Re: [racket-users] Location grabbing in typed/rackunit

2020-04-28 Thread Ben Greenman
On 4/28/20, shane c wrote: > I think require/typed/provide in typed/rackunit is affecting the location > grabbing feature. Hoping someone can provide a suggested path forward. When > > I run this program, > > #lang typed/racket/base > > (require typed/rackunit) > (check-true (string (check-true

Re: [racket-users] Functions not being linked in scribble

2020-04-28 Thread Ben Greenman
On 4/28/20, David Storrs wrote: > According to what I see in Scribble, both actual examples and in the > documentation, I had thought that if I did @defproc[func-name] then > func-name would become a link target and later uses of @racket[func-name] > would automatically link to that site. I'm

Re: [racket-users] a question or two regarding Gregor

2020-04-27 Thread Ben Greenman
On 4/27/20, Tim Hanson wrote: > > I thought I'd check here: > - does this seem like a reasonable idea? > - is mine an unusual use case and most folks know what format to expect and > the exception approach is fine? I've written code like this before and used it in a contract. ``` (define

Re: [racket-users] Gradual Typed Racket?

2020-04-17 Thread Ben Greenman
On 4/17/20, Sorawee Porncharoenwase wrote: >> >> My understanding is that contract-out only provides protection against >> inappropriate calls from clients *outside* the module, whereas >> define/contract enforces the contract against everyone, including things >> inside the module. Do I have

Re: [racket-users] Gradual Typed Racket?

2020-04-17 Thread Ben Greenman
Hi Marc, >> For contracts, though, (provide (contract-out ...)) gives better error >> messages than define/contract. >> > > In what sense is this the case, and where can I read more about the > differences, as well as how to improve errors of contracts? contract-out gives better error messages

Re: [racket-users] Unfinished S-Expressions in scribbled code blocks

2020-04-12 Thread Ben Greenman
> What is the proper way of typesetting (in scribble) parts of racket code > which do not form complete S-expression? The proper way is to make a #lang (in particular, a `read-syntax`) that deals with incomplete S-expressions. I don't know if anyone has done / attempted this. An improper way is

Re: [racket-users] typed mutable fields in structures.

2020-04-12 Thread Ben Greenman
Yes, that's right. I think TR could support this choice ... the typechecket (tc-structs.rkt) seems to know about the per-field mutability that comes from a struct info. On 4/11/20, Hendrik Boom wrote: > I noticed that in regular Racket, when defining a structure, it is > possible for each field

Re: [racket-users] Suggestions for "The Racket Guide"

2020-04-08 Thread Ben Greenman
On 4/8/20, Stephen De Gabrielle wrote: > That’s a good suggestion! Do you know the relevant JavaScript we can try it > out with. Might be an easy PR. > Beware that snippets are not always self-contained. A button should grab any requires and earlier code needed to make the example run. That'd

Re: [racket-users] Scribble for literate dotfiles?

2020-04-07 Thread Ben Greenman
On 4/5/20, Karl Meakin wrote: > I want to write my dotfiles in literate programming style. As far as I can > > tell, everyone does this using Emac's org-mode. I'd rather use a > fully-fledged programming language (and not be tied to a particular > editor). Is it possible to achieve this using

Re: [racket-users] Issue with define-type and typed classes

2020-03-31 Thread Ben Greenman
On 3/5/20, hashim muqtadir wrote: > So I have this file, found here: > https://gitlab.com/hashimmm/remap/-/blob/3682db9fff3bc5007833e07bf9a9ed6e8e0170a9/private/tables.rkt > > Lines 51 through 55 say: > > (define-type (Func<%> A) (BaseFunc<%> A FuncAnyParam))(define-type > BoolFunc<%> (Func<%>

Re: [racket-users] HTDP2e Exercise 342 find-all

2020-03-31 Thread Ben Greenman
On 3/21/20, Aron Zvi wrote: > Hi guys, > > Can I get a hint for Exercise 342 find-all > Don't use `find` as a helper function; instead, design a function that returns a list of successes -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To

Re: [racket-users] HTDP2E 22.3 Domain-Specific Languages: Configurations

2020-03-31 Thread Ben Greenman
On 3/30/20, Aron Zvi wrote: > Hey guys > > In 22.3 Domain-Specific Languages: Configurations, the book introduces the > following data example and data definitions for FSM configurations > > > (define >

Re: [racket-users] Best way to handle different versions of Racket?

2020-03-30 Thread Ben Greenman
On 3/30/20, Siddhartha Kasivajhula wrote: > Hi there, > Is there a standard/recommended way to handle multiple versions of Racket > in library code? If you're planning to ship the library as a package, you can also: 1. make 2 versions of the library (maybe as two branches in the same git repo)

Re: [racket-users] Switch off type checking via typed/racket/no-check fails on typed big-bang

2020-03-30 Thread Ben Greenman
On 3/25/20, Marc Kaufmann wrote: > Hi, > > I am trying to switch off type checking on a file so that I can prototype > faster without the wait for the type checker. However, my code also uses > typed/2htdp/universe and typed/2htdp/image, and I get an error on > `big-bang`: > >> Type Checker:

Re: [racket-users] Reflecting on context arity

2020-03-27 Thread Ben Greenman
procedure-result-arity is very limited if you can find a way to call `f` once, though, you could assume that its result arity never changes -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving

Re: [racket-users] TR: Occurrence Typing with custom predicate

2020-03-24 Thread Ben Greenman
On 3/24/20, mmcdan wrote: > Hello, > > I'm trying to use occurrence typing for (Vectorof Symbol) or (Boxof > Symbol). > > Creating a custom predicate for (Listof Symbol) seems to work: > --- > #lang typed/racket > > (: los? (-> Any Boolean : (Listof Symbol))) > (define los? > (lambda (seq) (and

Re: [racket-users] Contracts on parameters

2020-03-23 Thread Ben Greenman
On 3/23/20, David Storrs wrote: > (define/contract (foo x) > (-> boolean? any) > 'ok) > > (foo #t) > 'ok > (foo 7) > ; foo: contract violation > ; expected: boolean? > ; given: 7 > ; in: the 1st argument of > ; (-> boolean? any) > ; contract from: (function foo) > ; blaming:

Re: [racket-users] Gradual Typed Racket?

2020-03-23 Thread Ben Greenman
On 3/21/20, unlimitedscolobb wrote: > Hello, > > I come to Racket from Haskell and so far I am quite happy, as I feel freer > to do some weird stuff from time to time, and I am absolutely in love with > the Lisp-parens syntax. > > As a former Haskeller, one of the first things I tried was Typed

Re: [racket-users] trace facility in Racket?

2020-03-21 Thread Ben Greenman
On 3/21/20, dgtlcmo wrote: > Does anyone know how to trace functions inside a closure? I would like to > trace hanoi-move, however find that with MIT Scheme I need to place (trace) > > within the closure (hanoi n), otherwise the trace will not occur. > > Can a trace like this be performed in

Re: [racket-users] Load and execute files

2020-03-20 Thread Ben Greenman
On 3/20/20, Alexandre Rademaker wrote: > > It works! Thank you. The B.rkt (or check.rkt in my last message) can’t have > the `#lang racket` line. I am still confused about the implications of the > `#lang racket` line in the file and the module system of Racket. Great! In this case, adding

Re: [racket-users] Re: HTDP2e part 4: 20.3 Refining Functions dir.rkt

2020-03-20 Thread Ben Greenman
On 3/20/20, Aron Zvi wrote: > Thanks for your reply Ben. > > I understand that I am supposed to be getting a Dir instance. > My confusion is indeed regarding the value of the name field of Dir for > which I get a (full) path symbol of the directory and not just the folder > name as I would

Re: [racket-users] Load and execute files

2020-03-20 Thread Ben Greenman
g to avoid the necessity of adding the > (require …) commands in the check.rkt so I can select the student files to > test in the command line. The -r or -f option cause the same error. The > (provide …) forms are presented in the ex* files. > > Best, > Alexandre > > >>

Re: [racket-users] Load and execute files

2020-03-19 Thread Ben Greenman
> But I was really expecting that the option -t in the racket command should > replace the explicit (require…) in B.rkt. Something like > >> racket -t A.rkt -f B.rkt > default-load-handler: expected a `module' declaration, but found something > else Yes that almost works, but A.rkt needs to

Re: [racket-users] Load and execute files

2020-03-19 Thread Ben Greenman
On 3/19/20, Alexandre Rademaker wrote: > > Suppose I have some functions defined in a file A.rkt and some tests defined > in the file B.rkt. How can I execute the tests in the command line? > > I was expecting to be able to run > >> racket A.rkt B.rkt > > But this does not evaluate the

Re: [racket-users] HTDP2e part 4: 20.3 Refining Functions dir.rkt

2020-03-19 Thread Ben Greenman
On 3/19/20, Aron Zvi wrote: > Hey guys, > > In part 4 section 20.3 Refining Functions I am using (require htdp/dir) > and (create-dir DIR-PATH). I get back a Dir instance with name value being > a full path symbol of the folder. ie. (make-dir > '/Users/SSS/Documents/xyz empty empty). > This does

Re: [racket-users] Logger shows lots of info messages about collapsible-contract-bailout and collapsible-value-bailout

2020-03-14 Thread Ben Greenman
>> I don't know what triggers it and google does not return any results. >> Just curious, is it something I should be worried about? >> I am using Racket v7.5 if it helps. Searching google for "collapsible contract" should point to these pages, at least:

Re: [racket-users] HTDP2e Exercise 320 help

2020-03-12 Thread Ben Greenman
Those data definitions seem to match what the exercise is asking for. But I think the second one is not what the exercise intends because there are some data examples that match the 2nd definition but not the 1st. My guess is that "integrate the definition of SL" means something less drastic than

Re: [racket-users] TR dependent types cannot check equality of symbols

2020-02-24 Thread Ben Greenman
On 2/24/20, Marc Kaufmann wrote: > Very nice, adding > > (: get-user-var (case-> ...)) > > indeed does the trick. So I can use `case->` to do overloading (if that's > what it is called), by defining different functions for different type > signatures, and then put them together into a single

Re: [racket-users] TR dependent types cannot check equality of symbols

2020-02-23 Thread Ben Greenman
Try this case-> type instead: (case-> (-> Integer 'name Symbol) (-> Integer 'age Integer) (-> Integer Symbol (U Symbol Integer))) I don't know what it would take to add refinements for symbols, but that might be useful. Andrew Kent's dissertation may have some pointers:

Re: [racket-users] How do I just run the type checker?

2020-02-21 Thread Ben Greenman
On 2/21/20, 'David Florness' via Racket Users wrote: > Sam Tobin-Hochstadt writes: > >> If you compile the file with `raco make server.rkt` then it will run >> the type checker as part of compilation. Furthermore, it will run >> faster the next time since it won't have to re-compile. > >

Re: [racket-users] Typed Racket: Casting to types containing type variables

2020-02-19 Thread Ben Greenman
On 2/19/20, unlimitedscolobb wrote: > > [] > > ;Type Checker: Type a could not be converted to a contract because it > contains free variables. > ; in: a > > Does this mean that I can never cast to types containing type variables? Yes > My original problem comes from playing around with

Re: [racket-users] Typed code from untyped code

2020-02-17 Thread Ben Greenman
On 2/17/20, Bertrand Augereau wrote: > Hello and thank you Ben for the explanation, > > I had already implemented the workaround, I'll keep it :) > It seems that wrapping every binding access in a function is seen as > unnecessary in Scheme and Common Lisp ("Reference needed" :) ) but > it's a

Re: [racket-users] Typed code from untyped code

2020-02-17 Thread Ben Greenman
If you export a "getter" function instead of the list, both modules have the same behavior: ``` #lang racket/base (module racket_mod racket (provide (struct-out s)) (provide get-s) (provide set-list-of-s!) (struct s (a)) (define list-of-s '()) (define (get-s) list-of-s) (define

Re: [racket-users] TR: cast on mutable hash table...

2020-02-14 Thread Ben Greenman
On 2/14/20, 'John Clements' via users-redirect wrote: > I think I may understand what’s going on here, but a student and I worked on > this for quite a while today before I found the problem. > > > > In this case, one easy error is to change the ‘cast’ into an ‘ann’, which > works fine. You

Re: [racket-users] How to convert String to Integer

2020-02-11 Thread Ben Greenman
You may want `exact-integer?` -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. To view this discussion on the web

Re: [racket-users] How to use dates (especially gregor) with Typed Racket?

2019-12-11 Thread Ben Greenman
Thanks for the feedback! I opened a pull request for the docs: https://github.com/racket/typed-racket/pull/886 Happy to continue the discussion over there. (The example I added to the guide is maybe too simple.) -- You received this message because you are subscribed to the Google Groups

Re: [racket-users] How to use dates (especially gregor) with Typed Racket?

2019-12-07 Thread Ben Greenman
On 12/7/19, Marc Kaufmann wrote: > Thanks Ben and Jon, that did the trick. > > I realized when following the code that the structure wasn't exported - but > > I didn't know how to work around that. I now also checked the > documentation, and the only thing I found on opaque types is >

Re: [racket-users] How to use dates (especially gregor) with Typed Racket?

2019-12-03 Thread Ben Greenman
The error is because gregor/time doesn't export a struct. But nevermind that, because you're probably best off with an opaque type: ``` #lang typed/racket (require/typed gregor/time [#:opaque Time time?] [time (->* [Integer] [Integer Integer Integer] Time)] [time->iso8601 (-> Time

Re: [racket-users] contract for an "overloaded function"

2019-11-29 Thread Ben Greenman
Try ->i. I wouldn't worry about performance until makes itself a problem. On 11/29/19, Ryan Kramer wrote: > Thanks, but I don't think `case->` works for me. It looks like it chooses a > > case purely based on the number of arguments. The following example, when > given two arguments, will always

Re: [racket-users] Typed Racket needs annotation to realize (Mutable-HashTable Symbol Symbol) is of a more general type

2019-11-06 Thread Ben Greenman
On 11/6/19, Marc Kaufmann wrote: > I assumed it was something to do with mutability, but I don't understand > what you mean when you say there is a two-way channel. The reference in > typed racket ( >

Re: [racket-users] Re: [standard-fish] Summer competiton 2019

2019-10-25 Thread Ben Greenman
On 8/17/19, Philip McGrath wrote: > This contest is a bright idea, so here's a standard lightbulb: > [image: default-lightbulb.png] > The code is at > https://gist.github.com/LiberalArtist/4d0059f5af23043515a3cc74bd4928c2 > > -Philip I used standard-lightbulb in a slideshow [1]. Thank you Phil

Re: [racket-users] Is there a trick to know which types to specify when importing untyped racket into typed racket?

2019-10-06 Thread Ben Greenman
On 10/6/19, Raoul Schorer wrote: > Hi, > > I would very much like to import the package multimethod > > > into a typed module. Unfortunately, the symbols exported by this module are > >

Re: [racket-users] Fwd: Re: Racket code query

2019-10-03 Thread Ben Greenman
I opened a pull request with a suggestion https://github.com/conniepocky/Waffle-Lang/pull/1 On 10/3/19, Stephen De Gabrielle wrote: > Hi > > Please see the thread below for a query from Connie who is trying to make > her own language (11yo?!) > > I believe this is her code; >

Re: [racket-users] Re: Macro behaves differently when run from different modules

2019-09-28 Thread Ben Greenman
On 9/28/19, Jonathan Simpson wrote: > It works when I change my mag-line syntax class to: > > (define-syntax-class mag-line > (pattern (line expr ...))) > > So removing the literal specifier on line seems to work. I'm still not sure > why the two modules behave differently though. It seemed

Re: [racket-users] scribble/srcdoc raised exception fix and class-doc syntax form

2019-09-25 Thread Ben Greenman
> Should I include a brief documentation in > scribble-doc/scribblings/scribble/srcdoc.scrbl within the same PR as well? Yes! And if there are tests for scribble/srcdoc, it'd be good to add some for `class-doc` before merging -- You received this message because you are subscribed to the

Re: [racket-users] scribble/srcdoc raised exception fix and class-doc syntax form

2019-09-25 Thread Ben Greenman
These changes look great. Can you open a pull request for the racket/scribble repo? https://github.com/racket/scribble Some comments below > Also I implemented a simple defclass wrapper as a provide form named > class-doc: > > class-doc syntax form > (define-provide/doc-transformer

Re: [racket-users] transparency of structs?

2019-09-07 Thread Ben Greenman
I see the same results on Racket 7.0 and 6.5, so I don't think anything has changed. Maybe the trouble is that (make-inspector) makes a subinspector of (current-inspector), which has the same value for both the main module & the submodules. Switching to (make-sibling-inspector) causes (struct?

Re: [racket-users] Borders in pict

2019-09-02 Thread Ben Greenman
Inside Welcome to Racket v7.4.0.1. > (require pict) > (pict-width (rectangle 100 100 #:border-width 5)) 100 > (pict-height (rectangle 100 100 #:border-width 5)) 100 -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group

Re: [racket-users] [racket users] Contracts and make-keyword-procedure question

2019-08-24 Thread Ben Greenman
The -> combinator doesn't support unspecified keywords. ->* won't work either. Instead, you can try writing a new contract combinator (keyword-procedure/c ?) Or, don't use define/contract and put the domain checks in the function body. -- You received this message because you are subscribed to

Re: [racket-users] Seeking good benchmark code for immutable hash and hash set usage

2019-08-21 Thread Ben Greenman
A few of the GTP benchmarks [1] use immutable hashes. Here's a link with the ones that look most interesting: http://ccs.neu.edu/home/types/tmp/gtp-hash.tar.gz And here's a small (untyped) program that uses code from the tr-pfds library to make a trie:

Re: [racket-users] Splicing the result of one macro into another

2019-08-20 Thread Ben Greenman
On 8/20/19, Brian Adkins wrote: > Consider the following two macros: > > (require (for-syntax syntax/parse)) > > (define-syntax (phone-numbers stx) > (syntax-parse stx > [(_ ((~literal number) phone) ...) > #'(list phone ...)])) > > (define x (phone-numbers >(number "1212")

Re: [racket-users] SOLVED: Calling function with Scribble text as argument(s)

2019-07-31 Thread Ben Greenman
>> At the beginning of every inclided file (and there are more than fifty >> of them) I have to place the lines >> >> #lang scribble/base >> @(require "pfx.scrbl") >> >> where pfx.scrbl contains the definitions of my new @ commands. You could replace those lines with a custom #lang:

Re: [racket-users] Calling function with Scribble text as argument(s)

2019-07-30 Thread Ben Greenman
> Now for the next problem. If I @include-section, an occurrence of > redtext in the included section is recognised as an unbound identifier. > Evidently I need to say something to get included sections to inherit > bindings fro the main file. `include-section` is much closer to Racket's

Re: [racket-users] tail-nesting recursive syntax

2019-07-24 Thread Ben Greenman
On 7/24/19, Mike G. wrote: >> My proposal is to pick a currently underused character (I picked '/' 30 >> years ago but amost anything would do) and use it to replace the >> tail-nesting '(', and remove its corresponding ')'. >> >> Suddenly visual parenthesis-matching becomes an order of magnitude

Re: [racket-users] Scribble reinstallation

2019-07-22 Thread Ben Greenman
You should be able to keep the current Racket, download a snapshot build, and run the `/bin/drracket` inside the snapshot https://www.cs.utah.edu/plt/snapshots/ -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group

Re: [racket-users] using scribble for everything from category theory to poetry

2019-07-16 Thread Ben Greenman
More answers: On 7/15/19, Hendrik Boom wrote: > (1) How does scribble handle mathematical notation? Presumably there's a > hack > for when I'm generating TeX, but is there anything reasonable when > generating > HTML? Mathjax is somewhat tolerable, but mathML would be nice. For TeX, I tell

Re: [racket-users] Seeking users to try file monitoring package

2019-07-10 Thread Ben Greenman
> I'm particularly curious if the (robust-watch) procedure provided by the > package in particular behaves consistently across operating systems. I do > not have a Mac and was hoping that a Mac+Racket user would be willing to try > this out and report his or her experience. (robust-watch) worked

Re: [racket-users] Trouble documenting a form with Scribble

2019-06-26 Thread Ben Greenman
Here's a small package that gets the link right (attached). If the example doesn't help, can you share your code? -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email

Re: [racket-users] Re: Request for Feedback (SQL, Plisqin)

2019-06-22 Thread Ben Greenman
I don't know if I understood the "Aggregates are self-contained" section. The SQL looks self-contained, as long as you read the whole query. And one has to read the whole query in the Plisquin version too (but definitions come first). In the last section, I'm not sure what a "scalar" or "plural

Re: [racket-users] Relative Pathname problem

2019-06-22 Thread Ben Greenman
I tried to reproduce this problem, but wasn't able to. Which version of Racket are you using? How did you run the program? On 6/20/19, Amir Teymuri wrote: > I have the following situation: > > mylibrary: > >-src > - font.rkt > - gui.rkt >- scratch.rkt > > > So the src/

Re: [racket-users] Why struct type doesn't include field names?

2019-06-15 Thread Ben Greenman
On 6/15/19, Sorawee Porncharoenwase wrote: > First of all, . won’t work in standard Racket because . has a special > meaning (see > https://docs.racket-lang.org/reference/reader.html#%28part._parse-pair%29). The `read-cdot` parameter can change the standard meaning

Re: [racket-users] The search for routy

2019-06-14 Thread Ben Greenman
On 6/14/19, Gregor Kopp wrote: > Hi! > I found here docs: https://docs.racket-lang.org/routy/ > I'd like to try this for fast prototyping, but can't find the package as my > > google-fu is sloppy I guess. > Any help please, sirs and madams? Another option: search for "routy" at

  1   2   3   >