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

2018-08-20 Thread Daniel Prager
On Sun, Aug 19, 2018 at 11:03 AM, Andrew J wrote: > Very nice. The Racket special sauce is the (match*...). I need to get my > head around what's going on there. > > If you already understand match, perhaps this will help: > (match (list 5 6) [(list a b) (+ a b)]) 11 More concise, match* e

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

2018-08-18 Thread Andrew J
Thanks. Also nice. I like the explicit algorithmic approach. A. On Sunday, 19 August 2018 03:14:22 UTC+10, ra...@airmail.cc wrote: > > > As an example, this... > > > > - a > > - b c > > - d e f > > - g h > > > > would get transformed into something like this... > > > > '(a (b c)

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

2018-08-18 Thread Andrew J
Very nice. The Racket special sauce is the (match*...). I need to get my head around what's going on there. A. On Saturday, 18 August 2018 22:52:51 UTC+10, Jens Axel Søgaard wrote: > > > > Den lør. 18. aug. 2018 kl. 03.31 skrev Andrew J >: > >> Hi. In a little side project, I'm looking for an s

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

2018-08-18 Thread rain1
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))) You can implement this in 2 stages. Stage 1 is line based parsing, turn the input text into this list: '((0 a) (2 b c) (2 d e f) (4 g h))) the n

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

2018-08-18 Thread Jens Axel Søgaard
Den lør. 18. aug. 2018 kl. 03.31 skrev 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 someth

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] 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