[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

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

2020-10-30 Thread unlimitedscolobb
Hi, I am currently using hash tables a lot, so inevitably I end up writing general functions. I wrote the following `hash-filter`: ``` (define (hash-filter ht #:predicate [predicate #f] #:predicate/key [predicate/key (if predicate

Re: [racket-users] [racket users] Pollen tag question

2020-10-30 Thread Matthew Butterick
> On Oct 30, 2020, at 1:46 PM, Kevin Forchione wrote: > > Thanks, Matthew! Understanding dawns. So the padding of lines is relative to > the “{“ and not from the beginning of the editor line as I was assuming. How > very clever. That makes alignment much easier than I’d thought! > > Is

[racket-users] Racket CPU Graphics Engine - Time to Share

2020-10-30 Thread Dominik Pantůček
Hello fellow Racketeers, during the spring and summer I worked on a side project to test what can be done in pure Racket when it comes to raster graphics rendering. You can imagine it like demo or game programming before the advent of GPUs. It turned out that quite a lot can be achieved and it

Re: [racket-users] [racket users] Pollen tag question

2020-10-30 Thread Kevin Forchione
> On Oct 30, 2020, at 12:25 PM, Matthew Butterick wrote: > > Spaces at the beginning of body lines do not appear in the resulting > S-expressions, but the column of each line is noticed, and all-space > indentation strings are added so the result has the same indentation … If the > first

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

2020-10-30 Thread William J. Bowman
Thanks for the feedback! Some of these were not concerns for my use case, so I’ll do a bit more design before submitting something. -- Sent from my phoneamajig > On Oct 30, 2020, at 12:36, George Neuner wrote: > >  >> On 10/30/2020 3:08 PM, William J. Bowman wrote: >> Let me aid this

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

2020-10-30 Thread George Neuner
On 10/30/2020 3:08 PM, William J. Bowman wrote: Let me aid this discussion by copying in the ~10 lintes of code in question: > (define-syntax (dictof syn) > (syntax-parse syn > [(_ (k:id pred?) ...) > (quasisyntax/loc syn >(dictof/proc `((k . ,pred?) ...)))])) > > (define

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

2020-10-30 Thread Robby Findler
On Fri, Oct 30, 2020 at 2:08 PM William J. Bowman wrote: > Let me aid this discussion by copying in the ~10 lintes of code in > question: > > > (define-syntax (dictof syn) > > (syntax-parse syn > > [(_ (k:id pred?) ...) > > (quasisyntax/loc syn > >(dictof/proc `((k . ,pred?)

Re: [racket-users] [racket users] Pollen tag question

2020-10-30 Thread Matthew Butterick
> On Oct 29, 2020, at 9:04 PM, Kevin Forchione wrote: > > I’ve noticed that the elements being sent to a pollen tag don’t preserve the > spacing when the text spans multiple lines for any space occurring before > characters on the subsequent line, although does preserve the spacing between

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

2020-10-30 Thread William J. Bowman
Let me aid this discussion by copying in the ~10 lintes of code in question: > (define-syntax (dictof syn) > (syntax-parse syn > [(_ (k:id pred?) ...) > (quasisyntax/loc syn >(dictof/proc `((k . ,pred?) ...)))])) > > (define ((dictof/proc spec) h) > (and (eq? (dict-keys h)

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

2020-10-30 Thread George Neuner
On 10/30/2020 1:14 PM, William J. Bowman wrote: Thanks! One follow-up: > 1. make these functions, not macros The main implementation is a procedure, but I think I need a macro to get the syntactic interface I want. Is there some reason to avoid macros? You certainly can use macros in the

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

2020-10-30 Thread Philip McGrath
I've wanted this several times (and written more than one ad-hoc partial version): a general-purpose combinator would be great! On Fri, Oct 30, 2020 at 1:14 PM William J. Bowman wrote: > > 1. make these functions, not macros > The main implementation is a procedure, but I think I need a macro

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

2020-10-30 Thread Robby Findler
I didn't look at the code yet myself, but generally you want to minimize the amount of code you compile into (and so using a function is pretty minimal). Another reason is that a lot of stuff "just works" when you use functions (because they would be documented as functions and so come with

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

2020-10-30 Thread William J. Bowman
Thanks! One follow-up: > 1. make these functions, not macros The main implementation is a procedure, but I think I need a macro to get the syntactic interface I want. Is there some reason to avoid macros? -- You received this message because you are subscribed to the Google Groups "Racket

Re: [racket-users] [racket users] Pollen tag question

2020-10-30 Thread Kevin Forchione
If I remove my pollen.rkt from the directory and use: #lang pollen A B C D I get: '(root "A B" "\n" "C D”) But if I use: #lang pollen ◊(define foo "foo") A B C D I get: '(root " " "A B" "\n" " " "C D")

Re: [racket-users] [racket users] Pollen tag question

2020-10-30 Thread Kevin Forchione
> On Oct 29, 2020, at 9:21 PM, Sorawee Porncharoenwase > wrote: > > Whoops. I meant: > > #lang pollen > > ◊(define (vb . s) s) > > ◊vb{ A B >C D} > and the output is: > > '(" A B" "\n" " " "C D") > > On Thu, Oct 29, 2020 at 9:19 PM

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