I’m writing documentation for a module, and Scribble is throwing long warnings about WARNING: collected information for key multiple times: ...
. Oddly, the warning only appears if there is more than one defproc
in the file.
I think it means you defproc
the same function twice.
Oh, I see what the problem is: I defproc
a predicate that was implicitly covered by defstruct*
.
I have a similar problem. I wonder whether Unless link-target?-expr is specified and produces #f, the id is indexed, and it also registered so that racket-typeset uses of the identifier (with the same for-label binding) are hyperlinked to this documentation.
means that using #:link-target? _#f_
avoids the problem?
In my case, yes, using #:link-target? #f
fixes it.
Quick check. BC means “Before Chez [Scheme]”, right?
This question should be in some FAQ :wink: @spdegabrielle
yes
First I considered for/fold
because I was going to build a string, but then I didn’t know how to tell for/fold
to scan an input string two characters at a time. So I went for a named let and this is the result. Feel free to educate me or make any comments. Thank you! (The procedure decodes a hex-string produced by a cloudflare Javascript library for e-mail address obfuscation. They key to do the decoding is the first byte of the string.)
(define (cloudflare-email-decode hex-string)
(define k (string->number (substring hex-string 0 2) 16))
(define (loop hx-str decoded-str)
(cond [(empty-string? hx-str) decoded-str]
[else (define b (string->number (substring hx-str 0 2) 16))
(define d (string (integer->char (bitwise-xor k b))))
(loop (substring hx-str 2)
(string-append decoded-str d))]))
(loop (substring hex-string 2) ""))
racket@zip.rkt> (cloudflare-email-decode "d8b0beb0b3bbb7b098bbbdb6acadaaa1b4b1b6b3f6b6bdac")
"<mailto:hfhkcoh@centurylink.net\|hfhkcoh@centurylink.net>"
(~Is it only me or this block code in Slack could use a better font?~ That looks better. Thanks, Laurent!)
@laurent.orseau @anything I’ve added it to the FAQ, with a link to the relevant page in the Racket Guide (Performance>VM implementations): https://github.com/racket/racket/wiki/Frequently-Asked-Questions
How about a link to the FAQ and the guide/reference in the topic of this channel?
if you want syntax coloring + evaluation, you can use http://pasterack.org\|pasterack.org. This is a paste of your code above: http://pasterack.org/pastes/3106
@spdegabrielle set the channel topic: A good place to ask questions https://github.com/racket/racket/wiki/Frequently-Asked-Questions
Frequently Asked Questions (draft): https://github.com/racket/racket/wiki/Frequently-Asked-Questions
good idea, done free tier of slack so will go in a month or two
oh, annoying
I think I’m wrong actually - the quickscript announce is still pinned to #general
have you looked at the FAQ?
@laurent.orseau set the channel topic: A good place to ask questions FAQ
@laurent.orseau set the channel topic: A good place to ask questions. FAQ: https://github.com/racket/racket/wiki/Frequently-Asked-Questions
I had
good- I trust you would tell me if I made any mistakes :)
Glad to be featured ^^
ahh the gui builder question!
Looks good. Though the link to Fast Racket doesn’t really answer the question “how fast is racket?”
I also need to put a bit about quickscript about it
do you?
racketeers
I mean, is a bit on quickscript needed in the FAQ?
yes- racketeers know about it. but new people who need a FAQ don’t know about it
It has a brief mention in the problematic DrRacket guide
This was my first go at it: (define (cloudflare-email-decode hex-string)
(define (decode-hex i)
(string->number (substring hex-string i (+ i 2)) 16))
(define len (string-length hex-string))
(define key (decode-hex 0))
(list->string
(for/list ([i (in-range 2 len 2)])
(integer->char (bitwise-xor key (decode-hex i))))))
Here’s a version hiding the indexing bits inside a sequence: (define (in-char-pairs s [offset 0])
(define len (string-length s))
(sequence-map (lambda (i) (substring s i (+ i 2)))
(in-range offset len 2)))
(define (cloudflare-email-decode hex-string)
(define (decode-hex s)
(string->number s 16))
(define key (decode-hex (substring hex-string 0 2)))
(list->string
(for/list ([s (in-char-pairs hex-string 2)])
(integer->char (bitwise-xor key (decode-hex s))))))
Also byte code
Note that for/string exists
how can I enable module name completion while using enter!
in the repl? For instance, if I only have maybe.rkt
in the current directory, I want (enter! "<TAB>)
to complete to (enter! "maybe.rkt")
. Thanks!
Very interesting versions there too, @samdphillips. Thanks for sharing!
Must I import 2htdp/abstraction to use for/string? I expected it to be in racket/base along with for/fold, for/list.
Oh odd, I thought it was in racket/base