Re: [racket-users] Converting bulleted list to s-expression?

2018-08-17 Thread Andrew J
Thanks. That's a useful package to know and solves the parsing problem. Now I need to syntax transform the xexpr into my target minimal list. Time to dig into *Fear of Macros*. A. On Saturday, 18 August 2018 12:19:12 UTC+10, Shu-Hung You wrote: > > The markdown package by Greg Hendershott provi

Re: [racket-users] How to handle define forms in a scribble-like language

2018-08-17 Thread Philip McGrath
The error is `set!` reporting that `doc` is undefined, because the `doc` identifier from `md-module-begin` is introduced hygienically. Also, I believe your pattern for `md-module-begin` has an extra set of parentheses. Here is a working version: #lang racket/base #lang racket/base (module lang r

Re: [racket-users] How to handle define forms in a scribble-like language

2018-08-17 Thread Vityou
Stupid question, but how would I saving them in a global variable? So far I have this: (define-syntax handle (syntax-parser [(_ b:expr) #`(set! #,(syntax-local-introduce (datum->syntax #f 'doc)) (string-append #,(syntax-local-introduce (datum->syntax #f 'doc)) b))])) (define-syntax wrapp

Re: [racket-users] Converting bulleted list to s-expression?

2018-08-17 Thread Shu-Hung You
The markdown package by Greg Hendershott provides a parser that create HTML like xexprs from a string. The rest would be easy. https://docs.racket-lang.org/markdown/index.html On Fri, Aug 17, 2018 at 8:31 PM, Andrew J wrote: > Hi. In a little side project, I'm looking for an simple Racket-y wa

[racket-users] Converting bulleted list to s-expression?

2018-08-17 Thread Andrew J
Hi. In a little side project, I'm looking for an simple Racket-y way to transform a bulleted list into a tree structure, maybe like sxml. As an example, this... - a - b c - d e f - g h would get transformed into something like this... '(a (b c) (d e f (g h))) I can see a few ways to d

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

2018-08-17 Thread Christopher Lemmer Webber
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 > runtime (i.e., after the type is defined); is there a way? Not generally afaik. This is fairly intentional in Racket's des

Re: [racket-users] How to handle define forms in a scribble-like language

2018-08-17 Thread Shu-Hung You
I would try make-wrapping-module-begin too. Basically, it wraps all module-level forms that "calculates something" with the syntax object you gave it. For example, the following program ;; some-language.rkt #lang racket (provide (except-out (all-from-out racket) #%module-begi

Re: [racket-users] How to handle define forms in a scribble-like language

2018-08-17 Thread Vityou
Thanks for the example. I'm still somewhat new to racket, so I may have to study the example for a while before I understand it. The `make-wrapping-module-begin` that Alexis mentioned seems to do something similar, so I may end up using that due to it's simplicity. -- You received this messa

Re: [racket-users] Confused by the behavior of hash->list

2018-08-17 Thread Jussi Salmela
Cool, thanks! On Fri, Aug 17, 2018 at 7:26 PM Paulo Matos wrote: > > > On 17/08/18 18:18, Jussi Salmela wrote: > > Hi all! > > > > (I'm on 7.0) > > Just to jump right to the point here are the hash example lines from the > User Guide and a few added lines with comments that should make it clear

Re: [racket-users] Confused by the behavior of hash->list

2018-08-17 Thread 'Paulo Matos' via Racket Users
On 17/08/18 18:18, Jussi Salmela wrote: > Hi all! > > (I'm on 7.0) > Just to jump right to the point here are the hash example lines from the User > Guide and a few added lines with comments that should make it clear what I am > confused about: > > (define ht (make-hash)) > (hash-set! ht "ap

[racket-users] Confused by the behavior of hash->list

2018-08-17 Thread Jussi Salmela
Hi all! (I'm on 7.0) Just to jump right to the point here are the hash example lines from the User Guide and a few added lines with comments that should make it clear what I am confused about: (define ht (make-hash)) (hash-set! ht "apple" '(red round)) (hash-set! ht "banana" '(yellow long)) (wr

[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 Users

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 > > for. Some digging around on the mailin

Re: [racket-users] Question about style

2018-08-17 Thread Hendrik Boom
On Thu, Aug 16, 2018 at 07:25:42PM -0400, Deren Dohoda wrote: > > > > Thanks for the up-vote but let me explain the “local” rationale here and > > vote for the ‘inner define’ variant. > > [snip]... > > > > > > In Racket programs for the world, possibly real, you want to avoid > > rightward drift. I