[racket-users] Re: [scribble] code:hilite for binders

2020-08-23 Thread Ryan Kramer
You might also be able to use make-element-id-transformer like this #lang scribble/manual @(begin (require scribble/racket scribble/eval

[racket-users] Announce: Plisqin 0.4

2020-08-09 Thread Ryan Kramer
ll be fine. A big "Thank You!" to everyone who has made the Racket ecosystem so great, and special thanks to everyone who helped me with my questions. - Ryan Kramer -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubs

Re: [racket-users] How can I increase expansion+compilation speed?

2020-07-20 Thread Ryan Kramer
Thanks Ryan, the macro profiler is great! It quickly identified a macro that I was able to convert to a procedure. (I'm not sure why I made it a macro in the first place.) And the .zo file decreased from about 910KB to 130KB, and the compilation speed went from 40 seconds to about 8 seconds

[racket-users] Re: How can I increase expansion+compilation speed?

2020-07-20 Thread Ryan Kramer
Thanks to both of you. It does expand to a reasonably large amount of code, a small example is below. The processing that define-schema does shouldn't be worse than O(N*M) where N is the number of tables and M is the number of unique procedure names. Which is not linear, but also probably not

[racket-users] How can I increase expansion+compilation speed?

2020-07-19 Thread Ryan Kramer
Using DrRacket, the following file takes 18 seconds to compile without debugging, or about 40 seconds to compile with debugging: https://raw.githubusercontent.com/default-kramer/plisqin-tutorials/e844825b48137553246c64e73516d880b9068825/define-schema-answer-key/aw-schema.rkt When I say

[racket-users] Re: Scribble: customizing table borders

2020-07-19 Thread Ryan Kramer
This isn't the most ideal way, but it might work for you: CSS: .LongMult td[data-underline="yes"] { border-bottom: 1px solid red; } Code: #lang scribble/manual @(require scribble/core scribble/html-properties) @(tabular #:sep @hspace[2] #:style (style "LongMult" null)

[racket-users] Re: scribble: how to put a bar above text?

2020-06-16 Thread Ryan Kramer
Oh my gosh, I almost forgot about Unicode tricks! (I wish I knew more about Unicode). Here is a macron: ā. And it seems there's a lot more you can do: https://qualityandinnovation.com/2014/11/22/typing-x-bar-y-bar-p-hat-q-hat-and-all-that/ These will work just fine inside a Racket source file.

[racket-users] Re: scribble: how to put a bar above text?

2020-06-16 Thread Ryan Kramer
Something things in scribble have a `#:style` argument. And most things in scribble can be contained inside a `nested` or `elem`, to which you could apply your custom #:style. You can use this as a hook to a custom CSS file, where you could maybe use "text-decoration: overline;" if that looks

Re: [racket-users] Re: local variables are hyperlinkedinscribble/manual

2020-06-13 Thread Ryan Kramer
wrote: > > defaul...@gmail.com gave me a clear and usable answer. > > His email follows below. > > Best wishes, Jos > > > > > > > > From Ryan Kramer > > You can also use make-element-id-transformer, like this: > > > >

[racket-users] How can source-omit-files exclude a directory?

2020-05-27 Thread Ryan Kramer
I have a multi-collection package and I wanted to exclude a certain directory (plisqin-test) from being a package. I found the relevant documentation here: https://docs.racket-lang.org/pkg/strip.html. The first thing I tried was simply adding a `~` to the end of the directory. This worked.

[racket-users] Re: local variables are hyperlinked in scribble/manual

2020-05-25 Thread Ryan Kramer
My favorite way to avoid this problem is simply to choose another name, or use `except-in` to avoid importing `set` for-label. But if you must use the name `set` and you want it linking to racket/set most of the time (but not this time), here is a technique I've used in the past: #lang

[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

Re: [racket-users] How can I write a macro that recognizes arbitrary other macros?

2020-04-17 Thread Ryan Kramer
Thanks! That was much easier than I was expecting. For posterity, here is some working code but be warned that I don't know whether 'module is the best expansion context to use. But this is a toy example anyway. #lang racket (define-syntax (collect stx) (syntax-case stx (define-values)

[racket-users] How can I write a macro that recognizes arbitrary other macros?

2020-04-16 Thread Ryan Kramer
The following code produces '(1 2 3 4) (define-syntax (collect stx) (syntax-case stx (define) [(_ (define id val) rest ...) #'(let ([id val]) (collect rest ...))] [(_ (macro arg ...) rest ...) (syntax-local-value #'macro (lambda () #f)) (let ([expanded

[racket-users] Re: `raco test` seems slower, not caching any compilation results?

2020-03-19 Thread Ryan Kramer
On Wednesday, March 18, 2020 at 7:47:22 PM UTC-5, Ryan Kramer wrote: > > I'm currently using Racket 7.6 (non-CS) on Windows, and it feels like > `raco test` is much slower these days. > My mistake, it seems `raco test` never created the "compiled" directories with the dep

[racket-users] `raco test` seems slower, not caching any compilation results?

2020-03-18 Thread Ryan Kramer
I'm currently using Racket 7.6 (non-CS) on Windows, and it feels like `raco test` is much slower these days. Specifically I am seeing `raco test tests.rkt` takes 10 seconds. This is fine the first time, but repeating the test immediately also takes 10 seconds. It never creates any "compiled"

[racket-users] Re: Help with simple macro transformation

2020-02-17 Thread Ryan Kramer
Gah, of course it's possible with patterns. For some reason I just didn't think of matching `(id rest ...)` (define-syntax (rearrange stx) (syntax-case stx () [(_ [(id rest ...) body] more ...) #'(cons '[id body] (rearrange [(rest ...) body]

[racket-users] Help with simple macro transformation

2020-02-17 Thread Ryan Kramer
I'm 95% sure I've done this before, but for some reason I am really stuck right now. Given (rearrange ([(a b c) 1] [(d e) 2])) I would like any kind of shape containing [a 1] [b 1] [c 1] [d 2] [e 2]. Any kind of nesting should be fine as long as the ids are matched up 1:1 with the

[racket-users] Surprising behavior in The Printer

2020-01-10 Thread Ryan Kramer
I have a small program that demonstrates some surprising behavior regarding `prop:custom-print-quotable 'never`. Perhaps it could be considered a bug, although I haven't seen anything in the docs that this violates. I've found that 1. When I call `(println y)`, my `custom-display` is called

[racket-users] Re: Can `parameterize` work with pretty printing?

2020-01-03 Thread Ryan Kramer
I found `make-tentative-pretty-print-output-port` and `tentative-pretty-print-port-transfer` which looks like it might be the right way to go. I changed `write-now` as follows: (define (write-now proc x port mode) (if (pretty-printing) (let* ([alt-port

[racket-users] Can `parameterize` work with pretty printing?

2020-01-03 Thread Ryan Kramer
I am `gen:custom-write` and `make-constructor-style-printer` on an object graph that may contain cycles. Within my custom write procedure, I use `parameterize` to register an object into dictionary and later in the writing process I can check that dictionary, detect the cycle, and do more

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

2019-11-29 Thread Ryan Kramer
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 choose the integer? case even if both arguments are strings. (case-> [-> integer? integer? list?] [->

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

2019-11-29 Thread Ryan Kramer
I'm not exactly sure what I mean by "overloaded function", but I think you will understand. I'm looking for something that would allow me to write a function contract like (magic-> [integer? integer? -> integer?] [string? symbol? -> string?] [string? ...+ -> string?]) The

[racket-users] Re: GitHub ‘template repository’ functionality

2019-08-12 Thread Ryan Kramer
Ah, that makes sense. I guess I didn't realize (or took for granted) that `raco pkg new` was doing all that. With that in mind, it certainly does make more sense to run `raco pkg new` locally. -- You received this message because you are subscribed to the Google Groups "Racket Users" group.

[racket-users] Re: GitHub ‘template repository’ functionality

2019-08-09 Thread Ryan Kramer
Thanks Stephen, this looks useful. I don't understand why you say "I think the template should only have the things that `raco pkg new` doesn't do." Wouldn't the intent be that I use the template to create my own repo, clone it onto my local machine, and then run `raco pkg install`? In that

[racket-users] Re: Racket + Graphviz

2019-08-01 Thread Ryan Kramer
This looks interesting! I have thought about trying to generate Entity Relationship diagrams given a database schema, but assumed that laying out the boxes would be a hard problem. Looks like GraphViz might do a decent job at this. I'll try it out and let you know how it goes. -- You received

[racket-users] Re: define/contract for private functions

2019-07-24 Thread Ryan Kramer
On Wednesday, July 24, 2019 at 12:55:58 AM UTC-5, Roman Klochkov wrote: > > I propose to use submodules like in > https://github.com/Kalimehtar/binary-class/blob/master/binary-class/base.rkt > > So you may in test module (require mod/safe) and in normal operation > (require mod). > Sorry, I

[racket-users] define/contract for private functions

2019-07-23 Thread Ryan Kramer
I've found myself wanting to write contracts on private functions, but I don't want to pay the performance cost during normal operation. What I've been doing is making a `def/c` macro which looks exactly like `define/contract` but is wired up to `define` and discards the contract. When I want

Re: [racket-users] datatypes

2019-07-17 Thread Ryan Kramer
> > Still, variant reports ‘(a . b) as a ‘pair. and that’s amazing. How is it > obtaining that information? > I just looked it up and yeah, it is pretty cool: (struct->vector '(a . b)) is doing most of the work. See the comments and implementation here:

Re: [racket-users] can Typed Racket handle this function type safely?

2019-07-06 Thread Ryan Kramer
> > (ann ((ann maybe-car (All (a b) (-> a a))) (list 1 2)) (Listof Integer)) > Aha! That seems to answer my next question "is it truly unsafe?" with a Yes. Thanks Sam. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this

[racket-users] can Typed Racket handle this function type safely?

2019-07-05 Thread Ryan Kramer
In the code below, can `maybe-car` have the given type without using typed/racket/unsafe? #lang typed/racket (require typed/racket/unsafe) (module untyped racket (provide maybe-car) (define (maybe-car x) (cond [(pair? x) (car x)] [else x]))) (unsafe-require/typed 'untyped

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

2019-06-21 Thread Ryan Kramer
Thanks Alex, that was very helpful. > it is not clear from the document how any of it can be useful. > I got this same feedback from some friends on the 0.1 release. Also, it is not clear > what `Department?` and `Course?` are in the first code snippet -- are they > functions that the user

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

2019-06-21 Thread Ryan Kramer
Oops, I got the link wrong: https://github.com/default-kramer/plisqin/wiki/Towards-Better-Relational-Query-Languages On Friday, June 21, 2019 at 11:41:31 AM UTC-5, Ryan Kramer wrote: > > Target Audience: you have 10 minutes and you're familiar with libraries > that do SQL k

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

2019-06-21 Thread Ryan Kramer
Target Audience: you have 10 minutes and you're familiar with libraries that do SQL kinda like this: (from i "Item" (where i".ReleaseDate > '2018-01-01'") (select i".ItemName")) Article: https://github.com/default-kramer/plisqin/wiki/Towards-Better-Relational-Query-Language

[racket-users] Re: grammar-based fuzzing

2019-06-12 Thread Ryan Kramer
Thanks everyone for the good suggestions. Xsmith looks particularly appealing, looking forward to 1.0! -- 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] grammar-based fuzzing

2019-06-06 Thread Ryan Kramer
Does Racket have any grammar-based fuzzing utilities? I'm probably going to play around with this either way, but if there is an existing solution I'll quit after I've had my fun. If, however, people think Racket could use something like this I may attempt to make it into a usable package. I'm

Re: [racket-users] Macro guards question

2019-05-29 Thread Ryan Kramer
#'arg is a syntax object, therefore (number? #'arg) or (string? #'arg) will always be false. If you are trying to dispatch based on literals, you could use e.g. (number? (syntax-e #'arg)) to identify a numeric literal. But it is not very common that a macro handles a numeric literal differently

[racket-users] Re: catch and bind an unbound id in a macro

2019-04-20 Thread Ryan Kramer
Below is a short example showing that identifier-binding doesn't seem to work quite right with Scribble's make-base-eval. It works fine with make-evaluator from racket/sandbox. I'm not sure why this is, but using syntax-local-value instead works everywhere. (Implementation here:

[racket-users] Re: catch and bind an unbound id in a macro

2019-04-19 Thread Ryan Kramer
For what it's worth, Matthias' original answer has solved an issue I had. I was using identifier-binding for something very similar and it worked fine, except in my scribble examples. I had example 1 define foo, but then example 2 (with the same evaluator) would not "see" foo via

[racket-users] bracket generator

2019-03-20 Thread Ryan Kramer
Anyone need to pseudo-randomly generate a bracket for march madness (or any other occasion)? Here you go: https://gist.github.com/default-kramer/073b68122ea047ac46b33af20cb1eba1 The data I used is too averse to upsets for my taste. If I were going to generate another bracket, I would add some

Re: [racket-users] Re: Pretty display of tabular data?

2019-03-14 Thread Ryan Kramer
maybe this list is not the right place. (Also, Ryan, if you think our goals are more similar than I do, I'd be happy to work with you. You're definitely a more experienced Racketeer and it would surely boost my code quality.) - Ryan Kramer -- You received this message because you are subscrib

[racket-users] lightning talk ideas?

2019-02-25 Thread Ryan Kramer
Thinking about evangelism... I go to a functional programming meetup and we usually do "lightning talks" which are described as: "Sticking with our short talk/demo format, we will once again have 3 - 5 > slots available for you to show what you're working on, share something you > learned, or

[racket-users] Re: Use cases for tables and records

2019-02-22 Thread Ryan Kramer
On the topic of tables, I recently thought "It would be nice if DrRacket had some awareness of tabular data, in the same way that picts and syntax objects get special treatment." For my project, I just wrote a quick-and-dirty function to make an ASCII art table and moved on:

[racket-users] Re: "raco test" causes my reader to fail on carriage return (but newline works)

2019-02-03 Thread Ryan Kramer
Progress! Either rebooting, upgrading to 7.2, or something else caused DrRacket to start failing in the same way that raco does*. Now it feels like a normal problem I can solve using my normal techniques (of scattering printlns everywhere). (* I was wrong when I said that "raco setup" was

[racket-users] "raco test" causes my reader to fail on carriage return (but newline works)

2019-02-02 Thread Ryan Kramer
I have a scribble document with a string representation of some code. The string is "(+ 1 2) \r\n (* 2 3)" which eventually gets sent through my reader. When I run "Scribble HTML" in DrRacket it works. When I run "raco setup" it works. But when I run "raco test" my reader fails with

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 Ryan Kramer
> > PS There's also a racket package called plisqin which seemed closer to > what I was looking for. Maybe in a few months or so if it clicks I'll see > if I can add to that package everything I need (things like limit and > distinct) and it might work out. > Good news, limit and distinct are

Re: [racket-users] Scribble examples for languages other than Racket

2019-01-25 Thread Ryan Kramer
On Thursday, January 24, 2019 at 9:45:39 PM UTC-6, Alex Knauth wrote: > > Would the `scribble-code-examples` package work for you? > https://docs.racket-lang.org/scribble-code-examples/index.html > > Looks like yes, it will! Thanks. -- You received this message because you are subscribed to the

[racket-users] Re: Scribble examples for languages other than Racket

2019-01-23 Thread Ryan Kramer
OK, I found a much better way. Rather than trying to tweak a syntax object to pass in to "examples", it's much easier to use the Low-Level Scribble API to rebuild a document fragment that looks like what the built-in "examples" would build. What I have now just needs a little CSS and it looks

[racket-users] Scribble examples for languages other than Racket

2019-01-22 Thread Ryan Kramer
I was thinking about how to document #lang plisqin, a language I am working on. I wanted to use the "examples" procedure from scribble/example. But it looks like when you use the #:lang option, it disables evaluation and printing of results. (The typesetting works fine though.) I came up with

[racket-users] Re: Is Racket a good fit for my application?

2019-01-09 Thread Ryan Kramer
Scribble is awesome, but I don't think it's the first tool I would reach for in this situation. I'm assuming your reports will be mostly tabular and not very much prose, in which case Scribble might become an unnecessary layer that gets in the way of what you are really trying to do, which is

Re: [racket-users] How to disallow certain characters in identifiers?

2018-12-20 Thread Ryan Kramer
Interesting. I had never heard of 3d syntax before. But I'm not sure what advantage 3d syntax would get me here. If I have to write my own custom version of "define", couldn't it just as easily detect a dot in a regular syntax object? On Wednesday, December 19, 2018 at 6:29:22 PM UTC-6, Milo

Re: [racket-users] How to disallow certain characters in identifiers?

2018-12-11 Thread Ryan Kramer
Thanks for your response Alexis. You are right: once I figured out the correct way to customize the reader, the rest fell into place much more easily. Now, when my reader sees a dot it asks the base reader to read another piece of syntax, which must be an identifier. So (define a.b 3) becomes

Re: [racket-users] How to disallow certain characters in identifiers?

2018-12-10 Thread Ryan Kramer
It turns out expanding the syntax object isn't the right approach. It seems easy enough for defining values and simple procedures, but as soon as you consider optional arguments and keyword arguments, the resulting expansion gets too complicated to analyze. I don't see an easy way to do this,

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

2018-11-19 Thread Ryan Kramer
Thanks Jay, it looks like it worked. Or at least, "raco pkg install plisqin" works. But I'm not sure why "This package needs documentation" still shows up. Is something wrong with my info.rkt, or should I give PLT some more time? David, thanks for your interest. Did you install using "raco pkg