[racket-users] editor-canvas% questions

2020-04-21 Thread Emma Borhanian
Hi if I have a simple editor-canvas% with text% in it: (define editor-canvas (new editor-canvas% [parent frame])) (define text (new text%)) (send editor-canvas set-editor text) 1. How do I make the standard right click menu with copy, paste, etc.? I've seen this example of a custom popup menu:

[racket-users] hash-ref in typed Racket

2020-04-21 Thread Hendrik Boom
In typed Racket I define a hashtable: (: vector-to-contract (HashTable TType CContract)) (define vector-to-contract (make-hash (cast '( (_bytes . bytes?) (_s8vector . s8vector?) (_u16vector . u16vector?) (_s16vector . s16vector?)

Re: [racket-users] hash-ref in typed Racket

2020-04-21 Thread Sam Tobin-Hochstadt
The problem here is with the optional third argument to `hash-ref`. Typed Racket only allows `#f` or functions as the third argument. Plain Racket allows any non-function value as a default, or a function which is called to produce the default. Since "any non-function" is not expressible in Typed

Re: [racket-users] hash-ref in typed Racket

2020-04-21 Thread Hendrik Boom
On Tue, Apr 21, 2020 at 10:50:44AM -0400, Sam Tobin-Hochstadt wrote: > The problem here is with the optional third argument to `hash-ref`. > Typed Racket only allows `#f` or functions as the third argument. > Plain Racket allows any non-function value as a default, or a function > which is called

Re: [racket-users] Typed version of sxml?

2020-04-21 Thread Hendrik Boom
On Tue, Apr 21, 2020 at 05:30:40PM -0400, John Clements wrote: > Are you asking because you’d like your own code using SXML to be typed, or > because you’d like the sxml implementation to be typed? I think another way > of asking this is: are you worried about bugs in your code, or about bugs in

Re: [racket-users] [racket users] struct #:methods question

2020-04-21 Thread David Storrs
On Mon, Apr 20, 2020 at 6:50 PM Jon Zeppieri wrote: > There's no trick to it: > > #lang racket/base > > (require racket/generic) > > (define-generics foo > (foo-do foo x)) > > (struct thing (x) > #:methods gen:foo > [(define (foo-do f x) > (thing x))]) > > > On Mon, Apr 20, 2020 at

Re: [racket-users] visit a sequence of files

2020-04-21 Thread 'John Clements' via Racket Users
Well, sure… once you open all the files. Opening all the files is the painful part. Also, the display of tabs is not totally great when you have sixty or seventy of them open. Sorry, it might not have been clear that I want a list of sixty or seventy files. John > On Apr 21, 2020, at 1:34 PM,

Re: [racket-users] Typed version of sxml?

2020-04-21 Thread 'John Clements' via Racket Users
Are you asking because you’d like your own code using SXML to be typed, or because you’d like the sxml implementation to be typed? I think another way of asking this is: are you worried about bugs in your code, or about bugs in Oleg’s code? I think that rewriting the sxml library into TR would

[racket-users] visit a sequence of files

2020-04-21 Thread 'John Clements' via Racket Users
Here’s a question I have about both DrRacket and Emacs. It often happens in my workflow (grading files, for instance) that I want to set up a list of files, and then have an easy way to move forward or back in that list (“next file”, “previous file”). I see that emacs has a function called

Re: [racket-users] visit a sequence of files

2020-04-21 Thread David Storrs
Ah, got it. Well, as to opening all the files, you can select them all in Finder and Cmd+O. (Presumably the equivalent works on Windows.) Can't help you with the aesthetics, sorry. On Tue, Apr 21, 2020 at 4:38 PM John Clements wrote: > Well, sure… once you open all the files. Opening all the

[racket-users] Typed version of sxml?

2020-04-21 Thread Hendrik Boom
Is there a typed version of sxml? Its data representation would seem to be fairly easy to specify by a few corecursice define-type's. I's like to get the result of (ssax:xml->sxml in '()) as a typed value without having to waste time doing an exhaustive run-time type-check on its output.

Re: [racket-users] visit a sequence of files

2020-04-21 Thread David Storrs
I don't use DrRacket much, but would the normal 'previous / next window' commands work for you? On Mac it's: previous window: Shft + Cmd + ~ next window: Cmd + ~ or previous window: Cmd + next window: Cmd + On Tue, Apr 21, 2020 at 4:29 PM 'John Clements' via Racket Users <

[racket-users] Re: New week, new Racket! What are you folks up to?

2020-04-21 Thread Ryan Kramer
I'm finally finishing up a major overhaul of Plisqin, my alternative to SQL. I don't think I will consider it "stable" just yet, but it is getting much closer. The biggest new feature is a type system that prevents the three-valued logic mistakes that are too easy to make in SQL. I also hope

[racket-users] Lightweight, lazy trees (new package)

2020-04-21 Thread Siddhartha Kasivajhula
Hi folks, Here is a new package providing lightweight, general purpose utilities for working with tree-structured data: https://docs.racket-lang.org/lazytree/ It allows you to take any data exhibiting tree structure and lazily construct a stream representation of it using functions that

Re: [racket-users] visit a sequence of files

2020-04-21 Thread 'John Clements' via Racket Users
I would love that, but they’re not all in one directory. Maybe the easiest solution would be to write a script to temporarily move them all into one directory. In fact, as I think about this harder, I realize that the biggest problem may be that Apple’s file dialog doesn’t facilitate moving

Re: [racket-users] visit a sequence of files

2020-04-21 Thread Robby Findler
A (Racket) script that calls "open" (on a mac) and uses some state to keep track of what "next" means seems straightforward. Probably this can also be integrated via quickscript so It becomes a key binding. And maybe you want some small number of key bindings that assign grades and then move on to