Re: [racket-users] Combining contract checking with normalization?

2022-03-16 Thread jackh...@gmail.com
This is also something I want and have thought about for some time. My main use case is for functions that I want to accept an arbitrary sequence, but coerce the sequence to a list/set/etc. if it's not already a list/set/etc. I think one viable approach would be to do the following: 1. Add

[racket-users] Re: How to discover a struct's interface without Dr Racket?

2021-10-28 Thread jackh...@gmail.com
Are you intending to use the struct procedure names at compile time (such as in a macro) or runtime? On Tuesday, October 26, 2021 at 5:02:46 PM UTC-7 bc.be...@gmail.com wrote: > I understand why structs are opaque, by default, but I want to discover > the public interface of some struct type,

Re: [racket-users] rename-out not working as expected

2021-10-14 Thread jackh...@gmail.com
static-rename compiles down to something totally different, actually. It uses the 'inferred-name syntax property to get the Racket compiler to choose a

Re: [racket-users] Rationale for package structure

2021-10-14 Thread jackh...@gmail.com
I don't bother with the splitting because it's a *lot* of maintenance headache for little gain. My opinion is that we should take the collective effort we've poured into splitting packages and instead direct it at improving the compiler and package system to do a better job of automating this

Re: [racket-users] Re: Escape continuations for fussy code

2021-10-02 Thread jackh...@gmail.com
Here's my solution: (define/guard (f x) (guard (foo? x) else #false) (define y (bar x)) (define z (jazz x y)) (guard (loopy? z) else #false) (define a (yowza z)) (guard (string? a) else (error 'ugh)) (define b (bonkers a)) (guard (number? (hoop x b)) else (error

Re: [racket-users] New module log-bracketed; should probably be something else

2021-09-23 Thread jackh...@gmail.com
This looks quite a bit like you're trying to implement tracing, which is like logging, but instead of emitting messages associated with *points* in time, you emit messages for *ranges* of time. Rust has an excellent library for tracing. Perhaps that

[racket-users] Re: Re-entrant parameterize modification isolation when using shift/reset

2021-07-29 Thread jackh...@gmail.com
I don't fully follow the example you gave because I'm not super familiar with shift/reset, but would using continuation marks directly instead of parameters work for your use case? Continuation marks work like what you described, where data is stored directly on the stack rather than in a

Re: [racket-users] Speeding up the conversion of flvectors to string

2021-06-27 Thread jackh...@gmail.com
Anyone got an implementation of a mutable StringBuilder-like object? I could use it in Rebellion's implementation of `into-string` which currently isn't quadratic, but it definitely has the allocation problem. On Sunday, June 27, 2021 at 11:36:14 AM UTC-7 bogdan wrote: > While I think the

[racket-users] Re: stream leaking memory #2870

2021-04-28 Thread jackh...@gmail.com
Thankful comments on closed issues are definitely allowed and quite appreciated. Mailing list posts work too though. On Tuesday, April 27, 2021 at 8:16:38 AM UTC-7 jos.koot wrote: > Because the issue is closed I express my thanks to Matthew here. > > I am not sure it is allowed to add thanks to

Re: [racket-users] How to recover whitespace from syntax->string

2021-04-10 Thread jackh...@gmail.com
I had to build something for this in my Resyntax project. My takeaways were: - There's no substitute for just reading the file. If you have a `syntax-original?` subform, you can use the srcloc information to read

[racket-users] Re: mixfix and racket 2

2021-03-23 Thread jackh...@gmail.com
Honu's enforestation is approximately this. See https://www.cs.utah.edu/plt/publications/gpce12-rf.pdf. There's been some discussion about whether to base rhombus on a similar approach. On Tuesday, March 23, 2021 at 8:59:50 AM UTC-7 Roger Keays wrote: > From racket-news [1]: > > mixfix

[racket-users] Re: When are rackunit tests delayed? (different between 7.8 and 8)

2021-02-25 Thread jackh...@gmail.com
The test-suite semantics in rackunit are complex, under-specified, and quite brittle. I recommend avoiding them entirely and sticking entirely to test cases and test-begin. On Monday, February 22, 2021 at 10:19:04 PM UTC-8 William J. Bowman wrote: > Below is an example that behaves

Re: [racket-users] the future of #lang web-server

2021-02-25 Thread jackh...@gmail.com
Could you cryptographically sign the serialized form or something like that? On Monday, February 22, 2021 at 8:59:29 AM UTC-8 jay.mc...@gmail.com wrote: > On Sun, Feb 21, 2021 at 2:35 PM je...@lisp.sh wrote: > > > > #lang web-server is brilliant. This #lang is, in my view, a really > excellent

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

2021-02-19 Thread jackh...@gmail.com
This is great! Definitely send a PR for this. On Thursday, February 18, 2021 at 4:56:23 PM UTC-8 Ben Greenman wrote: > "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

[racket-users] Re: Looking for idiomatic way to represent very similar but different data types

2021-02-01 Thread jackh...@gmail.com
edicates, since vectors, points, and colors would all be Racket vectors. >>> >>> I could almost do structs with a fourth optional argument that holds a >>> Racket vector that never gets used explicitly by the "user" and build >>> helper functions to properly up

[racket-users] Re: Looking for idiomatic way to represent very similar but different data types

2021-01-31 Thread jackh...@gmail.com
I'd suggest just going with the structs and making them transparent. It's only three structs and only with a handful of fields, abstracting over them with map and fold doesn't seem worth the added complexity IMO. But if you'd really like to map and fold over structs, I highly recommend using

[racket-users] Resyntax: an automated refactoring tool for Racket

2021-01-24 Thread jackh...@gmail.com
Hello everyone! Just wanted to announce a neat project I've been working on: Resyntax , a tool for refactoring racket code. Currently the tool is able to replace various uses of `let` forms with `define`, as can be seen in this pull request

Re: [racket-users] Historical note.

2020-11-09 Thread jackh...@gmail.com
I'm glad, I didn't expect my comment to be so helpful :) For those curious, I have several examples of this pattern in Rebellion. The following constructs are all just structs of functions: - Comparators - Converters

[racket-users] Re: Generics vs. Classes?

2020-11-08 Thread jackh...@gmail.com
The typical use case for classes in Racket is writing GUIs, and that's mostly because the GUI framework is class based. For most other use cases, generics are a better choice than classes. They're simpler and have a less intrusive effect on your API surface. If you don't need to support

[racket-users] Re: Help implementing an early return macro

2020-11-04 Thread jackh...@gmail.com
for that. The last one is pretty easy to fix, but the other two I'm not sure how to fix. On Sunday, November 1, 2020 at 1:04:15 PM UTC-8 gneuner2 wrote: > On Sat, 31 Oct 2020 03:25:32 -0700 (PDT), > "jackh...@gmail.com" > wrote: > > >Wow, these are a lot of great responses.

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

2020-10-31 Thread jackh...@gmail.com
I have the same issue for ->i contracts. I'll write multiple #:pre/desc checks with nice messages, which are promptly rendered useless by the fact that ->i prints out the whole contract instead of just the precondition check that failed. On Friday, October 30, 2020 at 7:16:59 PM UTC-7 Ben

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

2020-10-31 Thread jackh...@gmail.com
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. I think it was about this particular symmetry: - A (list 1 'apple "banana") is a (list/c number? symbol? string?) - A (hash 'a 1 'b "foo") is a

Re: [racket-users] Re: Help implementing an early return macro

2020-10-31 Thread jackh...@gmail.com
Wow, these are a lot of great responses. First of all, *awesome* job Ryan. That implementation is exactly what I needed to figure out. I'm definitely starting there first. > Are you looking for `let/ec`? I'd forgotten about that one. That has the *syntax* I want. However my issue with

[racket-users] Re: hash-filter: PR or not PR

2020-10-31 Thread jackh...@gmail.com
This is definitely a useful thing to have and I've wanted it myself before. However I'm generally of the opinion that we should avoid making more collection manipulation functions that are unnecessarily specialized to one type of collection. I'd like to see functions that operate on all

Re: [racket-users] Re: Memory usage of (port->lines ...) is extreamly high

2020-09-29 Thread jackh...@gmail.com
I'm also guessing the jump from 600MB to 3GB is related to encodings. The file is probably UTF8/ASCII, and racket strings are a different encoding. I think they're one of the 32-bit encodings? So for ASCII text that alone would be a factor of four increase in memory usage. On Thursday,

Re: [racket-users] Why is get-impure-port* slower than a system call to curl?

2020-09-15 Thread jackh...@gmail.com
Curl supports http/2 (and even has experimental support for http/3 which is orders of magnitude faster than http/1.1. Depending on what protocols the server you're talking to supports, that could be part of it. On Monday, September 14, 2020 at 3:42:37 PM UTC-7 samdph...@gmail.com wrote: > Hi

Re: [racket-users] package manager woes on Windows 10?

2020-09-12 Thread jackh...@gmail.com
Could we make the "do what I mean" box just automatically strip any newlines pasted into it? It seems sensible to me to require that it only be a single line input. On Friday, September 11, 2020 at 6:22:59 AM UTC-7 hen...@topoi.pooq.com wrote: > On Thu, Sep 10, 2020 at 10:27:39AM -0400,

[racket-users] Re: hashcons

2020-09-12 Thread jackh...@gmail.com
Not automatically, but you can make your own wrapper function around cons that interns them using a weak hash table and then you can use that wrapper function everywhere. On Thursday, September 10, 2020 at 7:34:37 PM UTC-7 hen...@topoi.pooq.com wrote: > Is there a way to run Racket so that

[racket-users] Re: Pretty Printing for ASTs represented as structs

2020-08-16 Thread jackh...@gmail.com
I recommend using make-constructor-style-printer , which automates a lot of the fiddly indentation-handling you'd have to do otherwise. On Sunday, August 16, 2020 at