Re: [racket-users] Real-world examples of XML usage?

2019-02-05 Thread David Storrs
On Tue, Feb 5, 2019 at 11:18 AM Konrad Hinsen wrote: > > David Storrs writes: > > > to type things. In addition, most developers that I've worked / > > talked with will typically reach for the JSON API before the XML one > > given the choice. I think the grou

Re: [racket-users] Real-world examples of XML usage?

2019-02-05 Thread David Storrs
On Tue, Feb 5, 2019 at 2:17 AM Konrad Hinsen wrote: > > David Storrs writes: > > > > I was specifically thinking of JSON. It allows for encoding all the > > essential structure of XML in far fewer characters, meaning there's > > less data to send over the

Re: [racket-users] Real-world examples of XML usage?

2019-02-04 Thread David Storrs
On Sun, Feb 3, 2019 at 7:22 AM Konrad Hinsen wrote: > > David Storrs writes: > > > What projects have y'all done where XML was the best choice for a > > reason other than "because we needed to interoperate with a service > > that required XML"?

Re: [racket-users] Real-world examples of XML usage?

2019-02-04 Thread David Storrs
On Sun, Feb 3, 2019 at 2:39 AM Neil Van Dyke wrote: > > David Storrs wrote on 2/2/19 11:57 PM: > > Are there angles here that I haven't encountered or thought about yet? > > As a fellow Racketeer with mixed feelings about XML, let me articulate > for the list an angle

[racket-users] Real-world examples of XML usage?

2019-02-02 Thread David Storrs
There was a discussion in another thread lately about various ways of representing XML. It got me thinking, and I wanted to ask about people's practical experience. What projects have y'all done where XML was the best choice for a reason other than "because we needed to interoperate with a

Re: [racket-users] Why would a value produced by eval-ing code not satisfy its type predicate? (Particularly, a SQL statement from the sql package)

2019-02-01 Thread David Storrs
Hey, neat. I did not know that there was a sql package; I should have thought to look. Ryan, is there a way to use PostgreSQL's "RETURNING" feature or other DB-specific items? RETURNING is insanely useful and I'd be sad to give it up. On Fri, Feb 1, 2019 at 5:12 AM hashim muqtadir wrote: > >

Re: [racket-users] updated Racket-on-Chez status

2019-01-31 Thread David Storrs
Thank you for all the hard work you've put into this, everyone. The benchmark graphs are impressive! One thing that surprised me is that there are a handful of tests (tak1, dynamic2, tak, mazefun, maze2, collatz-q, collatz) where Racket/CS actually outperformed CS. How is that possible? On Thu,

[racket-users] Re: [racket-money] near-term bootstrap monetizing blog to ??? to book to ???

2019-01-28 Thread David Storrs
These all sound like perfectly reasonable ideas. Advertising is a tough way to earn money these days, but it's easy to set up if you're willing to use a standard platform like AdSense. I recommend against managing it yourself and trying to personally locate advertisers so as to enable complete

Re: [racket-users] handin server stress testing

2019-01-25 Thread David Storrs
I don't know if this fits your use case, but one solution would be to break the app into a submission server and a handin server. The students log in to the submission server with an email and password; it does nothing except persist the code to disk in a temp file, then move it to a 'waiting'

Re: [racket-users] Collections and data structures wishlist?

2019-01-24 Thread David Storrs
> When it comes to collections and data structures, what would you all like to > see in Racket2? New APIs? Changes to existing APIs? Whole new paradigms? > Something else? I wrote the struct-plus-plus module (https://docs.racket-lang.org/struct-plus-plus/index.html) because I wanted some

Re: [racket-users] snake game

2019-01-23 Thread David Storrs
What happens when you run it? Are you getting any error messages? On Wed, Jan 23, 2019 at 1:01 PM orenpa11 wrote: > > Hi > I am trying to implemet this code of "snake game " > https://course.ccs.neu.edu/csu211/code/snake-full.ss > > in DrRacket (Pretty big) > But when I run it it is not

Re: [racket-users] Are the terms "function" and "procedure" synonymous in Racket?

2019-01-19 Thread David Storrs
On Fri, Jan 18, 2019, 6:36 PM George Neuner > witness the legions of newbies every > year who don't understand that computer arithmetic differs from the math > they were taught in school. > Does it? Bit of a philosophical question, it seems. I mean, so long as you stick with integers, if you

Re: [racket-users] [help?] Using match-define to generate lists of fields from a struct

2019-01-17 Thread David Storrs
On Thu, Jan 17, 2019 at 5:54 PM Matthew Butterick wrote: > > > On Jan 17, 2019, at 2:39 PM, David Storrs wrote: > > it would be nice to be able to do some slicing and dicing in the > parsing pattern as opposed to doing it manually afterwards. Is there > a way to do it? &

Re: [racket-users] [help?] Using match-define to generate lists of fields from a struct

2019-01-17 Thread David Storrs
On Thu, Jan 17, 2019 at 3:32 PM Neil Van Dyke wrote: > > Just one off-the-cuff alternative representation, with some properties > that might be useful to you... > [...much good stuff about string encoding...] Thanks, those are all good thoughts. We get to control how much data is sent so yes,

[racket-users] [help?] Using match-define to generate lists of fields from a struct

2019-01-17 Thread David Storrs
I'm shipping encrypted data between RAM, DB, and network and wondering if there's an efficient way to the parsing. (struct spec (type mode) #:transparent) ; cf 'cipher-spec' in crypto module (define s (spec "aes" "cbc")) (match-define (struct* spec ([type (app string->symbol type)]

Re: [racket-users] [meta] Tags for racket-users posts?

2019-01-16 Thread David Storrs
asking for help in > any of these places. > > For github, I added a wiki page: > https://github.com/racket/racket/wiki/How-to-get-help > > Kind regards > > Stephen > > On Wed, Jan 16, 2019 at 7:56 PM Neil Van Dyke wrote: >> >> >> David Storrs

[racket-users] [meta] Tags for racket-users posts?

2019-01-16 Thread David Storrs
Stephen de Gabrielle recently posted a thing about the racket tags on github, which made me thing of email list tagging. One of the other lists I'm on (cfar-alumni) tags location-specific posts like "[geo][Berkeley] Invitation to Rainbow Mansion" to make filtering (visual or automated) easy. I

Re: [racket-users] Escaping strings for the shell

2019-01-15 Thread David Storrs
Oh, neat. Thank you. On Tue, Jan 15, 2019 at 9:18 AM 'Paulo Matos' via Racket Users wrote: > > I am surprised nobody mentioned Rash. I have been using it for all my > shell scripting needs and it's awesome. > > https://pkgs.racket-lang.org/package/rash > > On 29/12/201

[racket-users] Dumb question about Windows paths

2019-01-08 Thread David Storrs
(build-path/convention-type type base sub ...) → path-for-some-system? type : (or/c 'unix 'windows) base : (or/c path-string? path-for-some-system? 'up 'same) sub : (or/c (and/c (or/c path-string? path-for-some-system?) (not/c complete-path?)) (or/c 'up 'same)) >

Re: [racket-users] Re: Functional augmenting

2019-01-08 Thread David Storrs
On Tue, Jan 8, 2019 at 12:47 PM Eric Griffis wrote: > Apologies for the backtracking, but I'm still having trouble understanding > before/after/between and ordinary function composition. For non-method > functions, what's the difference? > Easy extension of existing code. For example:

Re: [racket-users] Re: Functional augmenting

2019-01-08 Thread David Storrs
On Mon, Jan 7, 2019 at 9:58 PM Neil Van Dyke wrote: > George Neuner wrote on 1/7/19 4:49 PM: > > Though I mostly agree with you, your "advice" does have its uses: > > > > > http://www.gigamonkeys.com/book/object-reorientation-generic-functions.html > > in particular see the sections on

Re: [racket-users] Re: Functional augmenting

2019-01-07 Thread David Storrs
On Mon, Jan 7, 2019 at 1:12 PM George Neuner wrote: > Hi David, > > On 1/7/2019 12:57 PM, David Storrs wrote: > > I haven't worked with Racket's generics before, but a quick skim through > the documentation suggests that no, that's not it. Racket generics appear > to

Re: [racket-users] Re: Functional augmenting

2019-01-07 Thread David Storrs
On Sun, Jan 6, 2019 at 4:28 PM George Neuner wrote: > On Fri, 4 Jan 2019 13:30:43 -0500, David Storrs > wrote: > > >Racket's OO system has the 'augment' family of functionality that allows > >you to change how a function works. I'm wondering if there's a way to do

Re: [racket-users] Functional augmenting

2019-01-07 Thread David Storrs
(let ([inner-name name]) > (syntax-parameterize > ([inner (make-variable-like-transformer #'inner-name)]) > proc > > (define (greet name) > (string-append "Hi, " name "!")) > > (check-equal? (greet "Bob") &q

Re: [racket-users] Functional augmenting

2019-01-04 Thread David Storrs
Cool, thanks. I'll look into generics more. I've skimmed past them before this but never really dug in. On Fri, Jan 4, 2019 at 1:46 PM Neil Van Dyke wrote: > I don't know what all is currently available for Racket[1], but two > search keywords to slog through are "advice" and "aspect". > >

[racket-users] Functional augmenting

2019-01-04 Thread David Storrs
Racket's OO system has the 'augment' family of functionality that allows you to change how a function works. I'm wondering if there's a way to do something similar in functional Racket. For example, when I was working in Perl I used to be able to do something like this Racket pseudocode: >

Re: [racket-users] triggering servlet on GET parameters

2019-01-03 Thread David Storrs
Stephen, you might also find this useful as a reference to crib from: http://matt.might.net/articles/low-level-web-in-racket/ On Thu, Jan 3, 2019 at 11:10 AM Jay McCarthy wrote: > Use normal racket/base and web-server/servlet-env ‘s serve/servlet > > On Thu, Jan 3, 2019 at 10:53 AM Dav

Re: [racket-users] triggering servlet on GET parameters

2019-01-03 Thread David Storrs
On Wed, Jan 2, 2019 at 7:12 PM Jay McCarthy wrote: > You need to stop using `web-server/insta` What would you recommend he use instead of web-server/insta? > so you can customize more. > Then, you need to intercept ALL requests with your servlet. Then, your > servlet just needs to call

Re: [racket-users] Escaping strings for the shell

2019-01-01 Thread David Storrs
I agree with all of that -- it's definitely not a desirable thing on a general basis. For this single use, with a well-defined use case and known parameters, it would have been useful, but it's not critical. Thanks for clarifying about the system* thing with putting -O in a separate argument.

Re: [racket-users] Escaping strings for the shell

2018-12-30 Thread David Storrs
On Sat, Dec 29, 2018 at 2:25 PM Neil Van Dyke wrote: > > > > /tmp/Sara's birthday, 9/12/01-18/181: No such file or directory > > The "/" in the filename is a separate problem, which actually has > nothing to do with shell special character command line > escaping/quoting. If you're on a Unix

Re: [racket-users] Escaping strings for the shell

2018-12-29 Thread David Storrs
On Fri, Dec 28, 2018 at 11:34 PM Jack Rosenthal wrote: > > On Fri, 28 Dec 2018 at 23:09 -0500, David Storrs wrote: > > I am using 'system' to offload some work onto wget and other > > applications in a few one-off scripts. Is there an easy way to escape > > a string so

[racket-users] Escaping strings for the shell

2018-12-28 Thread David Storrs
I am using 'system' to offload some work onto wget and other applications in a few one-off scripts. Is there an easy way to escape a string so it's suitable for usage in the shell? Things like backwhacking all the quotes and relevant spaces and such. -- You received this message because you

Re: [racket-users] Reasons not to use match or define/match?

2018-12-20 Thread David Storrs
On Thu, Dec 20, 2018 at 1:08 AM Philip McGrath wrote: > > I would also note that, if you expose the struct-ness of your datatype to > clients, adding a field creates a similar compatibility problem with the > constructor. ; version 1 of your file: (require struct-plus-plus) (struct++ dog

Re: [racket-users] How do I (de)serialize PKI keys for storage?

2018-12-18 Thread David Storrs
for finding this. > On Tue, Dec 18, 2018 at 5:36 PM David Storrs > wrote: > > > > I'm trying to persist public/private keys to our database and having > some trouble: > > > > > > Welcome to Racket v6.11. > > > (require crypto crypto/gcrypt) >

Re: [racket-users] How do I (de)serialize PKI keys for storage?

2018-12-18 Thread David Storrs
Cool, thanks! You are, as always, fantastic. On Tue, Dec 18, 2018 at 7:47 PM Ryan Culpepper wrote: > On 12/18/18 23:36, David Storrs wrote: > > I'm trying to persist public/private keys to our database and having > > some trouble: > > > > > > Welcome to Rac

[racket-users] How do I (de)serialize PKI keys for storage?

2018-12-18 Thread David Storrs
I'm trying to persist public/private keys to our database and having some trouble: Welcome to Racket v6.11. > (require crypto crypto/gcrypt) > (crypto-factories gcrypt-factory) > (define key (generate-private-key 'rsa)) > key (object:gcrypt-rsa-key% ...) > (define pub (pk-key->public-only-key

[racket-users] How to get libsodium-factory on OSX?

2018-12-13 Thread David Storrs
https://docs.racket-lang.org/crypto/factory.html#%28def._%28%28lib._crypto%2Fsodium..rkt%29._sodium-factory%29%29 "Factory for Sodium (aka libsodium). This factory does not provide the high-level Sodium APIs; it only provides access to some of the low-level

Re: [racket-users] Racket Video

2018-12-03 Thread David Storrs
Awesome, thanks! On Mon, Dec 3, 2018 at 2:21 PM Leif Andersen wrote: > Glad you're interested in checking out Video. If you need a thing > that's not yet in the standard library, please poke me and I'll put it > in. Its usually pretty easy to add something at this point, and I tend > to do it

Re: [racket-users] Racket Video

2018-12-03 Thread David Storrs
uble click)) That would eliminate about 90% of the work and I could do the rest manually. On Sun, Dec 2, 2018 at 3:33 PM Matthias Felleisen wrote: > > On Dec 2, 2018, at 2:49 PM, David Storrs wrote: > > Hi all, > > I have some video (.mp4) and audio (.wav, although it's from Auda

[racket-users] Racket Video

2018-12-02 Thread David Storrs
Hi all, I have some video (.mp4) and audio (.wav, although it's from Audacity and could be exported in other formats) that I would like to sync up. At RacketCon I recall seeing Leif running a talk about the Racket Video language. I'm looking through the docs now and it's unclear to me what the

Re: [racket-users] Loggers that don't prepend?

2018-11-27 Thread David Storrs
Cool, thanks! On Mon, Nov 26, 2018 at 11:20 PM Greg Hendershott wrote: > make-log-receiver returns a synchronizable event; you start a thread > to loop and sync on that. Formatting and disposition is up to you. > > 1. Example from XREPL, displaying to stdout with `;` comment chars > prepended:

Re: [racket-users] Loggers that don't prepend?

2018-11-26 Thread David Storrs
ill be prefixed by the > topic and ": " or not. > I can't believe I missed that. Thanks. > On Mon, Nov 26, 2018 at 5:00 PM David Storrs > wrote: > > > > Is there a way to have a logger that prints the message I give it > without modification?

[racket-users] Loggers that don't prepend?

2018-11-26 Thread David Storrs
Is there a way to have a logger that prints the message I give it without modification? (i.e. without prepending the topic or anything else) -- 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] Re: Multiple places listening to a TCP port [was: Racket application servers]

2018-11-26 Thread David Storrs
On Sun, Nov 25, 2018 at 4:16 AM George Neuner wrote: > > On 11/25/2018 4:11 AM, Bogdan Popa wrote: > > Is there a way to fork(2) in Racket? > > Unfortunately, no. Racket is cross-platform, and Windows doesn't have the > concept of fork(). > As a point of information, Perl's approach is to make

Re: [racket-users] Posting Events To Window Asynchronously From Different Thread?

2018-11-19 Thread David Storrs
I haven't done a lot of work with the GUI so there might be a more appropriate mechanism that I'm not aware of, but I suspect that async channels would fit your needs: https://docs.racket-lang.org/reference/async-channel.html Define a channel, have one GUI element read from it and other GUI

Re: [racket-users] What is the expected PLT package catalog refresh rate? Is it not refreshing now?

2018-11-19 Thread David Storrs
de. * If you do have/add the 'introspect an existing DB' functionality, it would allow you to auto-generate DDL for upgrade / rollback on the schema. Is that a feature you might add? > Jay > On Mon, Nov 19, 2018 at 11:47 AM David Storrs > wrote: > > > > I tried to install it an

Re: [racket-users] What is the expected PLT package catalog refresh rate? Is it not refreshing now?

2018-11-19 Thread David Storrs
I tried to install it and got this: $ raco pkg install plisqin Resolving "plisqin" via https://download.racket-lang.org/releases/6.11/catalog/ Resolving "plisqin" via https://pkgs.racket-lang.org raco pkg install: cannot use empty checksum for Git repostory package source source:

Re: [racket-users] unit testing output

2018-11-08 Thread David Storrs
On Wed, Nov 7, 2018 at 3:45 PM Neil Van Dyke wrote: > Greg Hendershott wrote on 11/6/18 9:56 AM: > > I'd suggest writing to stderr the same location format used by rackunit. > > OK, thank you (and David Storr). I looked at the current RackUnit. How > about the following proposal? > > Proposal:

Re: [racket-users] unit testing output

2018-11-02 Thread David Storrs
On Fri, Nov 2, 2018 at 3:38 PM Neil Van Dyke wrote: > Anyone have info or preferences on what are good output conventions for > Racket package embedded unit tests? (For use with all of: `raco test`, > package catalog and other builds, DrRacket and other IDEs?) > > I intend to reimplement

Re: [racket-users] add set-subset?

2018-10-04 Thread David Storrs
I am so glad that I'm not the only one who does this. On Thu, Oct 4, 2018 at 2:16 PM 'John Clements' via Racket Users < racket-users@googlegroups.com> wrote: > D’oh! It’s just called subset? > > Sorry, > > John > > > > On Oct 4, 2018, at 11:16 AM, 'John Clements' via Racket Users < >

Re: [racket-users] Why does my package have no build status?

2018-10-04 Thread David Storrs
On Thu, Oct 4, 2018 at 9:34 AM Greg Hendershott wrote: > > As to the dependency, there's no reason that people need to have > handy/test-more (the testing framework I use for struct-plus-plus) > installed in order to use the module. > > Would it help to put `handy` in `build-deps` instead of

Re: [racket-users] Why does my package have no build status?

2018-10-03 Thread David Storrs
I use for struct-plus-plus) installed in order to use the module. It's not clear to me how to use compile-omit-files in an info.rkt file. Are there examples I could look at? On Wed, Oct 3, 2018 at 12:09 PM David Storrs wrote: > > > > Cool, thanks. How do I tell the server not t

Re: [racket-users] Why does my package have no build status?

2018-10-03 Thread David Storrs
ket-lang.org, but > here's the build status: > http://pkg-build.racket-lang.org/server/built/fail/struct-plus-plus.txt > > Sam > On Wed, Oct 3, 2018 at 10:45 AM David Storrs > wrote: > > > > During RacketCon I posted struct-plus-plus to the packages list: >

[racket-users] Why does my package have no build status?

2018-10-03 Thread David Storrs
During RacketCon I posted struct-plus-plus to the packages list: https://pkgs.racket-lang.org/ Sadly, in the Build column it doesn't say "succeeds", "fails", or anything else...it's just a blank. What do I need to do differently so that it can play all the reindeer games? -- You received this

Re: [racket-users] Capturar valor de retorno da query Racket

2018-09-27 Thread David Storrs
Some other thoughts for you, in no particular order: * I encourage you to always specify your field names in a SQL query, as it is both more readable and it will future-proof you against changes in the schema. So: Use this: INSERT INTO questions (description, qtext, author) VALUES

Re: [racket-users] Licence guidance

2018-09-24 Thread David Storrs
On Mon, Sep 24, 2018 at 6:03 AM, Stephen De Gabrielle < spdegabrie...@gmail.com> wrote: > Hi, > > I sometimes see Racket packages on PLaneT or Github, but lack a licence. > > I don’t feel I can redistribute or fork abandoned code if it lacks a > licence. (I can give an example of an 11yo

[racket-users] Re: Bug in table-panel% class, or in superclass?

2018-09-24 Thread David Storrs
On Tue, Sep 18, 2018 at 3:15 PM, David Storrs wrote: > The following is the example taken from the table-panel docs. ( > https://docs.racket-lang.org/table-panel/index.html) It displays a > frame with four sets of numeric keypads laid out in quadrants. If you > expan

Re: [racket-users] Re: How can I make GUI elements abut?

2018-09-20 Thread David Storrs
in Excel. I can obviously use something aside from a button but it would have been nice to have the already-built functionality > > Thanks, > Dave > > On Wed, Sep 19, 2018 at 11:05 AM David Storrs > wrote: > >> Hm. As to the stretching -- sounds like there may be

Re: [racket-users] colon keywords

2018-09-19 Thread David Storrs
For whatever it's worth, I don't care about this issue for it's own sake and would prefer that it not be implemented because (a) I would see it as a waste of resources, (b) it would have unpredictable effects on existing code, and (c) it means one more thing to keep in mind when reading other

Re: [racket-users] Re: How can I make GUI elements abut?

2018-09-19 Thread David Storrs
Hm. As to the stretching -- sounds like there may be a significant difference between Racket 6.11 and 7, or else a significant different between Racket's drawing on Windows and Mac. I'll try it under 7. As to the failure to touch, yes. That gap is the issue, although on 6.11 / Mac it's very

[racket-users] Bug in table-panel% class, or in superclass?

2018-09-18 Thread David Storrs
The following is the example taken from the table-panel docs. ( https://docs.racket-lang.org/table-panel/index.html) It displays a frame with four sets of numeric keypads laid out in quadrants. If you expand the window, the expectation, based on the docs, is that spacing between buttons will

[racket-users] How can I make GUI elements abut?

2018-09-18 Thread David Storrs
Given the following code, how can I (a) make the buttons actually touch one another when the panel comes up and (b) stretch horizontally and vertically when the window does? I thought that having (spacing 0) on the panel and (vert-margin 0) + (horiz-margin 0) on the buttons would do it, but nope.

Re: [racket-users] How do I specify a lib path for the SQLite FFI?

2018-09-12 Thread David Storrs
You are, as always, brilliant. Thanks, Matt, that fixed it. On Tue, Sep 11, 2018 at 9:04 PM, Matthew Flatt wrote: > At Tue, 11 Sep 2018 20:35:46 -0400, David Storrs wrote: > > If I get a new version of libsqlite3 and put it in some per-user > directory, > > how can I tell th

[racket-users] How do I specify a lib path for the SQLite FFI?

2018-09-11 Thread David Storrs
Current version of SQLite is 3.24, but OSX (in my case 10.11, El Capitan) comes with sqlite3 version 3.8.10 installed. I've downloaded the new sqlite3 et al and put them in my path so I can use the new features. Now I'd like to make Racket use the new code as well. I cannot update the actual

Re: [racket-users] How do I get negative blame information?

2018-09-10 Thread David Storrs
you behind > the scenes, and they usually cover all the potential use cases. If you > have some other use case that isn’t served by those contract attachment > forms, by all means share it, but it’s hard to advise how to use > `contract` properly in a vacuum. > Got it. Okay, that

[racket-users] How do I get negative blame information?

2018-09-10 Thread David Storrs
(define (my-func thunk-arg) (contract integer? (thunk-arg) 'my-func )) What should I replace with? NB: I know that in the example I could do (define/contract (my-func thunk-arg) (-> (-> integer?) integer?) (thunk-arg)) but I'm looking for an answer to the generic case. -- You

Re: Sealers/unsealers in Racket (Re: [racket-users] Questions about module encapsulation guarantees)

2018-09-10 Thread David Storrs
This is a very cool thing, but may I suggest choosing a different name than 'can'? '(can-unseal lunch)' reads less like a verb and more like a predicate where someone forgot the '?' -- "Are you able to unseal lunch?" as opposed to "Unseal my lunch now". On Mon, Sep 10, 2018 at 11:09 AM,

Re: [racket-users] What does `raco test file.rkt` do by default if no `test` submodule?

2018-09-06 Thread David Storrs
This isn't a direct answer to your question, but you might want to check out handy/test-more. Unlike the racket test system it always provides feedback on what tests have run and it will warn you if you did not run the expected number of tests. It also uses shorter names for the tests and each

Re: [racket-users] How to tighten the contract on a function

2018-09-05 Thread David Storrs
day, September 4, 2018 at 9:00:06 PM UTC-4, David K. Storrs wrote: >> >> >> >> On Tue, Sep 4, 2018 at 8:55 PM, Matthew Butterick >> wrote: >> >> >>> On Sep 4, 2018, at 3:54 PM, David Storrs wrote: >>> >>> Say I have this

Re: [racket-users] How to tighten the contract on a function

2018-09-04 Thread David Storrs
On Tue, Sep 4, 2018 at 8:55 PM, Matthew Butterick wrote: > > On Sep 4, 2018, at 3:54 PM, David Storrs wrote: > > Say I have this (possibly from a third-party module): > > (define/contract (foo arg) (-> string? #t) #t) > > I want to ensure that the argument is alw

[racket-users] How to tighten the contract on a function

2018-09-04 Thread David Storrs
Say I have this (possibly from a third-party module): (define/contract (foo arg) (-> string? #t) #t) I want to ensure that the argument is always non-empty, so I tighten the contract. I could do this: (set! foo (contract (-> non-empty-string? #t) foo 'foo 'neg)) Mutating the function is

Re: [racket-users] Using match on hash tables with optional keys

2018-08-31 Thread David Storrs
Summary of the thread: "Hey, here's this thing I'd like to do. Is there a way to do it?" T = : "Nope. Here's some suggestions, though." T = 22 hours: "Here, let me add that feature to the language." Man, I love this community. Thank you to everyone. On Fri, Aug 31, 2018 at 5:46 AM, Ryan

Re: [racket-users] Using match on hash tables with optional keys

2018-08-30 Thread David Storrs
On Thu, Aug 30, 2018 at 12:20 PM, Matthew Butterick wrote: > > On Aug 30, 2018, at 8:36 AM, David Storrs wrote: > > I'd like to be able to write something like this: > > (match (hash 'a 1 'b 2) > [(hash-table ('a a) ('b b) ('c c)) (list a b c)]) > > ...except with

Re: [racket-users] Using match on hash tables with optional keys

2018-08-30 Thread David Storrs
. > > Sam > On Thu, Aug 30, 2018 at 11:36 AM David Storrs > wrote: > > > > I'd like to be able to write something like this: > > > > (match (hash 'a 1 'b 2) > > [(hash-table ('a a) ('b b) ('c c)) (list a b c)]) > > > > ...except with somethin

[racket-users] Using match on hash tables with optional keys

2018-08-30 Thread David Storrs
I'd like to be able to write something like this: (match (hash 'a 1 'b 2) [(hash-table ('a a) ('b b) ('c c)) (list a b c)]) ...except with something that says "if 'c isn't present, that's fine. Use this value instead." I've gone through the page on pattern matching and been unable to find

Re: [racket-users] From Clojure to Racket

2018-08-23 Thread David Storrs
On Thu, Aug 23, 2018 at 1:02 PM Ben Kovitz wrote: > > In Clojure, the data structures of first resort are map and vector. > What's the equivalent in Racket--the short list of bread-and-butter data > structures that you reach for first when writing production code? How do > you, say,

Re: [racket-users] Is there a way to attach struct properties after struct definition?

2018-08-18 Thread David Storrs
On Fri, Aug 17, 2018 at 9:20 PM, Christopher Lemmer Webber < cweb...@dustycloud.org> wrote: > David Storrs writes: > > > I've been going through the docs on struct properties, both the Guide and > > the Reference. I can't see any way to add new properties to a struct at

[racket-users] Is there a way to attach struct properties after struct definition?

2018-08-17 Thread David Storrs
I've been going through the docs on struct properties, both the Guide and the Reference. I can't see any way to add new properties to a struct at runtime (i.e., after the type is defined); is there a way? -- You received this message because you are subscribed to the Google Groups "Racket

Re: [racket-users] What are disappeared-uses?

2018-08-17 Thread David Storrs
On Thu, Aug 16, 2018 at 5:28 PM, Alexis King wrote: > > On Aug 16, 2018, at 15:25, David Storrs > > wrote: > > > > I see 'record-disappeared-uses' and 'with-disappeared-uses' in the > > docs, but there's nothing that makes clear what you would use them

[racket-users] all-fields-visible? attribute of struct-id -- What is it?

2018-08-16 Thread David Storrs
struct-id from (require syntax/parse/class/struct-id

[racket-users] What are disappeared-uses?

2018-08-16 Thread David Storrs
I see 'record-disappeared-uses' and 'with-disappeared-uses' in the docs, but there's nothing that makes clear what you would use them for. Some digging around on the mailing list suggests that they allow Dr Racket to draw an arrow to a relevant source location. Do they have any use outside of Dr

Re: [racket-users] Confusion about attributes of struct-id

2018-08-16 Thread David Storrs
On Thu, Aug 16, 2018 at 12:19 PM, Ryan Culpepper wrote: > On 08/16/2018 06:04 PM, David Storrs wrote: > >> The struct-id syntax class from syntax/parse/class/struct-id is puzzling >> me. Given this preamble: >> >> >> (require (for

Re: [racket-users] Re: Confused by match

2018-08-16 Thread David Storrs
On Thu, Aug 16, 2018 at 12:08 PM, Alex Gian wrote: > Well, it's not often I'm happy when I see a bug, but thank Fog for that. > Thanks, gfb. > > @David K. Storrs. > I'm not sure your explanation is right, unless it's explaining the bug. > Surely the two values for 'x' must be the same! > Given

Re: [racket-users] Confused by match

2018-08-16 Thread David Storrs
On Wed, Aug 15, 2018 at 10:08 PM, Alex Gian wrote: > Normally in match... > > > (match '(a b b b b b b a) > [`(,x ,y ... ,x) (list 'x: x 'y: y)]) > '(x: a y: (b b b b b b)) > > > (match '(a b b b b b b d) > [`(,x ,y ... ,x) (list 'x: x 'y: y)] > [_ 'nope]) > 'nope > > > So far, so

Re: [racket-users] Re: How to resolve phase errors on require/provide for macros

2018-08-15 Thread David Storrs
On Wed, Aug 15, 2018 at 9:22 AM, Matthias Felleisen wrote: > > Also, do take a look at struct/c. > I don't think it covers the same need. It creates a contract that will review a struct after it has been created and identify whether or not it is well-formed, but it will not prevent you from

Re: [racket-users] Re: How to resolve phase errors on require/provide for macros

2018-08-15 Thread David Storrs
Brilliant. This is exactly what I needed, thank you. On Wed, Aug 15, 2018 at 1:31 AM, gfb wrote: > You're losing the binding information by doing syntax->datum. Here's a > quick change to get you unstuck: > > ... >(only-in racket/list partition flatten > append-map)))

[racket-users] How to resolve phase errors on require/provide for macros

2018-08-14 Thread David Storrs
I was impressed with Lexi's struct-update module and wanted to extend it a bit, so I've been working on a version of my own that exports a macro called 'struct++'. I'm having some issues with phase level when applying contracts to fields. Here are some examples: #lang racket (require struct++)

Re: [racket-users] parameterized logging

2018-08-07 Thread David Storrs
I realize it's not ideal Racket, but I've gotten a lot of mileage out of the following: ;;-- (define prefix-for-say (make-parameter "")) (define-syntax (say stx) (syntax-case stx () [(say a ...) #'(displayln (~a

[racket-users] How do I find the current phase level?

2018-08-05 Thread David Storrs
How can I answer the question "what phase level is this chunk of code running at?" For example: (displayln (~a "current phase level: " (current-phase-level))) ; outputs 0 (begin-for-syntax (displayln (~a "current phase level: " (current-phase-level))) ; outputs 1 ) Long version: I'm having

Re: [racket-users] Questions on functional-setter generator macro

2018-05-28 Thread David Storrs
self in the foot if you want the ability to do so. > > On May 26, 2018, at 10:46, David Storrs <david.sto...@gmail.com> > > wrote: > > > > A) Is there a way to test if a syntax class has a particular attribute > > before trying to use it? > > Yes, use

[racket-users] Questions on functional-setter generator macro

2018-05-26 Thread David Storrs
Hi folks, I am becoming more converted to the way of structs vs hashes as time goes on and so I sat down to write a macro that would generate functional setters as a convenience. Code is at bottom of email; I'd appreciate suggestions on how to improve it, in particular better ways of handling

Re: [racket-users] Unicode identifiers

2018-05-16 Thread David Storrs
On Wed, May 16, 2018 at 6:37 AM, Jens Axel Søgaard wrote: > and it converts the names to “camel case.” > Why do you hurt me, Jens? You always seemed like such a nice person. -- You received this message because you are subscribed to the Google Groups "Racket Users"

Re: [racket-users] How to handle circular 'requires'

2018-05-15 Thread David Storrs
Incidentally, sorry for the mangled formatting / narrow margins that my emails keep having. I'm not doing that, it's coming from GMail. On Tue, May 15, 2018 at 10:06 AM, David Storrs <david.sto...@gmail.com> wrote: > On Tue, May 15, 2018 at 1:28 AM, Matthew Butterick <m...@mbtyp

Re: [racket-users] How to handle circular 'requires'

2018-05-15 Thread David Storrs
think about them while dealing with the happy path. The 'pre', 'catch', and 'finally' blocks are all optional and leaving them out simply defatalizes and returns the exception if there is one. I should create a version that lets you put 'pre' ahead of the body if that's what you want, but I haven't done

Re: [racket-users] How to handle circular 'requires'

2018-05-14 Thread David Storrs
On Mon, May 14, 2018 at 10:07 PM, Greg Hendershott wrote: > David you wrote "both" so I just wanted to point out I read three ways: Good point; I misspoke. (Mistyped?) > 4. It doesn't sound like this is your case, but: If there are many > function calls where you

Re: [racket-users] How to handle circular 'requires'

2018-05-14 Thread David Storrs
of module initialization (that is, the > function isn’t called from the top level of a module). When it works, > though, it can be a less invasive solution to the problem. > > Alexis > >> On May 14, 2018, at 4:28 PM, David Storrs <david.sto...@gmail.com> wrote: >> >> My ap

[racket-users] How to handle circular 'requires'

2018-05-14 Thread David Storrs
My application retrieves chunks of files from the network and writes them to disk, as well as writing certain data about them to the database (e.g. where they are on disk and where they came from on the network). I've split these functions into separate files: app/network/chunks.rkt

Re: [racket-users] Please HELP ME! Programmers at scheme, i am calling you ! :D

2018-05-09 Thread David Storrs
Hi Patrik, >From what I've seen, people on this list generally don't help with homework assignments, especially not when the request is simply "please do this for me" as opposed to "please help me figure out this one piece that I'm stuck on". You'd probably get better answers if you specified:

Re: [racket-users] char-utf-8-length signature is surprising

2018-05-03 Thread David Storrs
return scheme_make_integer(3); > } else if (wc < 0x20) { > return scheme_make_integer(4); > } else if (wc < 0x400) { > return scheme_make_integer(5); > } else { > return scheme_make_integer(6); > } > } > > > On Thu, May 3, 2

[racket-users] char-utf-8-length signature is surprising

2018-05-03 Thread David Storrs
I noticed this in the docs and it surprised me: (char-utf-8-length char) → (integer-in 1 6) UTF-8 characters are 1-4 bytes, so why isn't it (integer-in 1 4)? I feel like this is probably obvious but I'm not coming up with the answer. -- You received this message because you are subscribed to

<    1   2   3   4   5   6   7   8   >