Re: [racket-users] question about places and main thread gc

2020-09-13 Thread Nate Griswold
Sorry, it's all a bit simpler than i'm making it out to be.

Basically, i want to run racket from c code (embedded i guess, but i'm not
compiling any embedded c files). This is because i want to run everything
in one process. I want to have actual parallelism so that is why i'm using
places. I have one main racket thread that i currently have an infinite
loop using zeromq to listen for messages on. This is a dedicated thread.
But first on that thread i set up two other racket places to do my
concurrent work. The main racket thread then accepts messages and
dispatches to the two places depending on what the message is.

So the question is simply: do i need to have my infinite loop on my main
thread sitting there waiting for messages (and have custom communication),
or is there some better way to do it like just using the standard racket cs
calls.

If i understand correctly, in racket cs embedded if i am not currently
running anything in the main racket thread then gc cannot happen. But the
next time i make a call into racket on that reserved racket thread (which
has not been shut down, and by using racket_apply or some such) then gc can
happen. But i do not know about the other threads that racket has spawned.

Thanks

Nate


On Sun, Sep 13, 2020 at 5:40 PM George Neuner  wrote:

>
> On 9/13/2020 4:12 PM, Nate Griswold wrote:
>
> Sorry, i forgot to mention this would be interfacing on the main thread
> from c
>
> does this still hold true? Like if a c call returns does it kill the
> places?
>
> Nate
>
>
> I'm not really sure what you are asking:  it sounds like you are wanting
> to embed Racket into a C program ... if that is the case, then the primary
> thread is in the C program and any/all Racket threads will be secondary.
>
> I don't know that Racket's place API even works in an embedded scenario.
> You certainly can create multiple threads within your C program and run
> Racket in them, but it's hard to share a Racket environment, and if you
> create a separate execution environment for each thread, then their
> operations will be independent of one another.
>
> If you just call a Racket function from C, that function will be executed
> in the same thread as the caller, and it will return to the caller when it
> finishes.  Of course that function could have side effects such as
> signaling a separate Racket thread to terminate.
>
> A lot depends on what you are trying to do and how you structure your
> solution.
>
>
> George
>
>
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAM-xLPoKRxGcAKdq89vb%2BRwG8OmKmYxJwnt8DCG7SLPMtk7%3D0Q%40mail.gmail.com.


[racket-users] matching M-N instances

2020-09-13 Thread David Storrs
Using the 'match' form, is there a straightforward way to have optional
items in a pattern?  For example:

(match records [(list (? string? name) 0..1  phone-numbers ..1) 'ok])

This would match a list of phone numbers that might or might not have the
owner's name (either as a single string or as two strings) on the front.

I know that I could do it with an 'or' pattern, or by having multiple
clauses in the match, but those get repetitive and verbose when part of the
pattern is a struct* used for decomposing multiple fields of a (potentially
nested) struct, which is a thing I do a lot.

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAE8gKoer56g25tuAV0oa%2BQA_HGmRaWosgA5WQO3Lu5Pd74OtwQ%40mail.gmail.com.


Re: [racket-users] question about places and main thread gc

2020-09-13 Thread George Neuner


On 9/13/2020 4:12 PM, Nate Griswold wrote:
Sorry, i forgot to mention this would be interfacing on the main 
thread from c


does this still hold true? Like if a c call returns does it kill the 
places?


Nate


I'm not really sure what you are asking:  it sounds like you are wanting 
to embed Racket into a C program ... if that is the case, then the 
primary thread is in the C program and any/all Racket threads will be 
secondary.


I don't know that Racket's place API even works in an embedded 
scenario.  You certainly can create multiple threads within your C 
program and run Racket in them, but it's hard to share a Racket 
environment, and if you create a separate execution environment for each 
thread, then their operations will be independent of one another.


If you just call a Racket function from C, that function will be 
executed in the same thread as the caller, and it will return to the 
caller when it finishes.  Of course that function could have side 
effects such as signaling a separate Racket thread to terminate.


A lot depends on what you are trying to do and how you structure your 
solution.



George


--
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/c6d3915d-5c92-ea6a-bedd-5c31a540cc71%40comcast.net.


Re: [racket-users] question about places and main thread gc

2020-09-13 Thread Nate Griswold
The reason i'm asking is i am dedicating a thread to racket after calling
racket_boot on it.

Nate


On Sun, Sep 13, 2020 at 3:12 PM Nate Griswold 
wrote:

> Sorry, i forgot to mention this would be interfacing on the main thread
> from c
>
> does this still hold true? Like if a c call returns does it kill the
> places?
>
> Nate
>
>
> On Sun, Sep 13, 2020 at 12:17 PM George Neuner 
> wrote:
>
>>
>>
>> On 9/13/2020 3:55 AM, Nate Griswold wrote:
>>
>>
>> I am making an app that basically spawns two racket places and i want to
>> be able to communicate with them from c code.
>>
>> Will gc happen in the two racket places if i don't keep the main thread
>> (the one that spawned the places) running?
>>
>>
>> Exiting the main thread kills the process.  "dynamic"[1] places are (OS
>> level) threads within the same process and they will die with it.
>> [Technically the main thread is itself a place, but normally we don't use
>> place  terminology when talking about the main thread unless there are
>> other places involved.]
>>
>> I was thinking about whether i should keep the main thread running and
>> block on a stream read, sending it messages, or if i can only call into the
>> main thread when i need something using racket/chezscheme apis. I guess it
>> would be simpler to just talk directly to the main thread when i need to,
>> which is why i'm asking. Otherwise i'm thinking of just using zeromq on the
>> main thread.
>>
>>
>> You certainly can talk to any of the places individually ... but you do
>> need the main thread to remain running (even if just waiting on some event)
>> if you want dynamic places to continue running.
>>
>>
>> Now "distributed"[2,3] places are separate processes - you can start them
>> and they will continue running regardless of what happens to the process
>> that spawned them.
>>
>> Nate
>>
>>
>> Hope this helps,
>> George
>>
>> [1]  https://docs.racket-lang.org/reference/places.html
>> [2]  https://docs.racket-lang.org/distributed-places/index.html
>> [3]  https://pkgd.racket-lang.org/pkgn/search?q=loci
>>
>>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAM-xLPoVb4jBwefUgQ5UhgGEuwvpnso%2BMHgn6fH1D714LHDeyw%40mail.gmail.com.


Re: [racket-users] package manager woes on Windows 10?

2020-09-13 Thread Robby Findler
I'm not sure. I would probably add a 'single-no-return style and then grep
the codebase for places that use 'single and change them (as appropriate).

Robby


On Sun, Sep 13, 2020 at 3:15 PM Sorawee Porncharoenwase <
sorawee.pw...@gmail.com> wrote:

> I meant, wouldn’t it be better to fix text-field% itself, instead of only
> some instances of it? Sorry if that was confusing.
>
> On Sun, Sep 13, 2020 at 1:12 PM Sorawee Porncharoenwase <
> sorawee.pw...@gmail.com> wrote:
>
>> Should the fix apply to all 'single styled text-field%
>>  too?
>>
>> On Sun, Sep 13, 2020 at 7:50 AM Robby Findler 
>> wrote:
>>
>>> Yea, I agree. I'd made that change locally but hadn't pushed because I
>>> couldn't make the bad behavior happen reliably. Perhaps that lack shouldn't
>>> stop us! Pushed now.
>>>
>>> Robby
>>>
>>>
>>> On Sat, Sep 12, 2020 at 11:15 PM jackh...@gmail.com <
>>> jackhfi...@gmail.com> wrote:
>>>
 Could we make the "do what I mean" box just automatically strip any
 newlines pasted into it? It seems sensible to me to require that it only be
 a single line input.

 On Friday, September 11, 2020 at 6:22:59 AM UTC-7 hen...@topoi.pooq.com
 wrote:

> On Thu, Sep 10, 2020 at 10:27:39AM -0400, George Neuner wrote:
> >
> >
> > On 9/10/2020 10:06 AM, Philip McGrath wrote:
> > > Also, this is happening over encrypted HTTPS: no one is sniffing
> the
> > > User-Agent header.
> >
> > While it may not be the issue here, you need to understand that
> appliance
> > firewalls CAN and routinely DO examine data inside encrypted
> connections.
>
> Using man-in-the-middle attacks?
>
> -- hendrik
>
 --
 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+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/racket-users/84b16cf0-7837-4d54-9423-c1286f5e2b7an%40googlegroups.com
 
 .

>>> --
>>> 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+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/racket-users/CAL3TdON46%3DPR6_-iyppSMLsfEvNEveq3uGu64gQ3Lu1or7QgNw%40mail.gmail.com
>>> 
>>> .
>>>
>> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/CADcuegtFzzeErTTqi3m9Hyr%2Bu1m8YEo0cnAEw2onhKXGnTzHOg%40mail.gmail.com
> 
> .
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAL3TdOMGpAWz8Df5CAJNvhdfCyb7CL%2BNocZGYtga6YtZMrjDqg%40mail.gmail.com.


Re: [racket-users] package manager woes on Windows 10?

2020-09-13 Thread Sorawee Porncharoenwase
I meant, wouldn’t it be better to fix text-field% itself, instead of only
some instances of it? Sorry if that was confusing.

On Sun, Sep 13, 2020 at 1:12 PM Sorawee Porncharoenwase <
sorawee.pw...@gmail.com> wrote:

> Should the fix apply to all 'single styled text-field%
>  too?
>
> On Sun, Sep 13, 2020 at 7:50 AM Robby Findler 
> wrote:
>
>> Yea, I agree. I'd made that change locally but hadn't pushed because I
>> couldn't make the bad behavior happen reliably. Perhaps that lack shouldn't
>> stop us! Pushed now.
>>
>> Robby
>>
>>
>> On Sat, Sep 12, 2020 at 11:15 PM jackh...@gmail.com 
>> wrote:
>>
>>> Could we make the "do what I mean" box just automatically strip any
>>> newlines pasted into it? It seems sensible to me to require that it only be
>>> a single line input.
>>>
>>> On Friday, September 11, 2020 at 6:22:59 AM UTC-7 hen...@topoi.pooq.com
>>> wrote:
>>>
 On Thu, Sep 10, 2020 at 10:27:39AM -0400, George Neuner wrote:
 >
 >
 > On 9/10/2020 10:06 AM, Philip McGrath wrote:
 > > Also, this is happening over encrypted HTTPS: no one is sniffing
 the
 > > User-Agent header.
 >
 > While it may not be the issue here, you need to understand that
 appliance
 > firewalls CAN and routinely DO examine data inside encrypted
 connections.

 Using man-in-the-middle attacks?

 -- hendrik

>>> --
>>> 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+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/racket-users/84b16cf0-7837-4d54-9423-c1286f5e2b7an%40googlegroups.com
>>> 
>>> .
>>>
>> --
>> 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+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/racket-users/CAL3TdON46%3DPR6_-iyppSMLsfEvNEveq3uGu64gQ3Lu1or7QgNw%40mail.gmail.com
>> 
>> .
>>
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CADcuegtFzzeErTTqi3m9Hyr%2Bu1m8YEo0cnAEw2onhKXGnTzHOg%40mail.gmail.com.


Re: [racket-users] question about places and main thread gc

2020-09-13 Thread Nate Griswold
Sorry, i forgot to mention this would be interfacing on the main thread
from c

does this still hold true? Like if a c call returns does it kill the places?

Nate


On Sun, Sep 13, 2020 at 12:17 PM George Neuner  wrote:

>
>
> On 9/13/2020 3:55 AM, Nate Griswold wrote:
>
>
> I am making an app that basically spawns two racket places and i want to
> be able to communicate with them from c code.
>
> Will gc happen in the two racket places if i don't keep the main thread
> (the one that spawned the places) running?
>
>
> Exiting the main thread kills the process.  "dynamic"[1] places are (OS
> level) threads within the same process and they will die with it.
> [Technically the main thread is itself a place, but normally we don't use
> place  terminology when talking about the main thread unless there are
> other places involved.]
>
> I was thinking about whether i should keep the main thread running and
> block on a stream read, sending it messages, or if i can only call into the
> main thread when i need something using racket/chezscheme apis. I guess it
> would be simpler to just talk directly to the main thread when i need to,
> which is why i'm asking. Otherwise i'm thinking of just using zeromq on the
> main thread.
>
>
> You certainly can talk to any of the places individually ... but you do
> need the main thread to remain running (even if just waiting on some event)
> if you want dynamic places to continue running.
>
>
> Now "distributed"[2,3] places are separate processes - you can start them
> and they will continue running regardless of what happens to the process
> that spawned them.
>
> Nate
>
>
> Hope this helps,
> George
>
> [1]  https://docs.racket-lang.org/reference/places.html
> [2]  https://docs.racket-lang.org/distributed-places/index.html
> [3]  https://pkgd.racket-lang.org/pkgn/search?q=loci
>
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAM-xLPome2k7ubSHk35tSmy-NaQwafm5AbW-h1H-pjqO963Aug%40mail.gmail.com.


Re: [racket-users] package manager woes on Windows 10?

2020-09-13 Thread Sorawee Porncharoenwase
Should the fix apply to all 'single styled text-field%
 too?

On Sun, Sep 13, 2020 at 7:50 AM Robby Findler 
wrote:

> Yea, I agree. I'd made that change locally but hadn't pushed because I
> couldn't make the bad behavior happen reliably. Perhaps that lack shouldn't
> stop us! Pushed now.
>
> Robby
>
>
> On Sat, Sep 12, 2020 at 11:15 PM jackh...@gmail.com 
> wrote:
>
>> Could we make the "do what I mean" box just automatically strip any
>> newlines pasted into it? It seems sensible to me to require that it only be
>> a single line input.
>>
>> On Friday, September 11, 2020 at 6:22:59 AM UTC-7 hen...@topoi.pooq.com
>> wrote:
>>
>>> On Thu, Sep 10, 2020 at 10:27:39AM -0400, George Neuner wrote:
>>> >
>>> >
>>> > On 9/10/2020 10:06 AM, Philip McGrath wrote:
>>> > > Also, this is happening over encrypted HTTPS: no one is sniffing the
>>> > > User-Agent header.
>>> >
>>> > While it may not be the issue here, you need to understand that
>>> appliance
>>> > firewalls CAN and routinely DO examine data inside encrypted
>>> connections.
>>>
>>> Using man-in-the-middle attacks?
>>>
>>> -- hendrik
>>>
>> --
>> 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+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/racket-users/84b16cf0-7837-4d54-9423-c1286f5e2b7an%40googlegroups.com
>> 
>> .
>>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/CAL3TdON46%3DPR6_-iyppSMLsfEvNEveq3uGu64gQ3Lu1or7QgNw%40mail.gmail.com
> 
> .
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CADcuegsQOyPfir8M1GZ5VsSm_9JvCwQeLXhW3X8F78cPVOmLHQ%40mail.gmail.com.


Re: [racket-users] question about places and main thread gc

2020-09-13 Thread George Neuner



On 9/13/2020 3:55 AM, Nate Griswold wrote:


I am making an app that basically spawns two racket places and i want 
to be able to communicate with them from c code.


Will gc happen in the two racket places if i don't keep the main 
thread (the one that spawned the places) running?


Exiting the main thread kills the process.  "dynamic"[1] places are (OS 
level) threads within the same process and they will die with it.  
[Technically the main thread is itself a place, but normally we don't 
use place  terminology when talking about the main thread unless there 
are other places involved.]


I was thinking about whether i should keep the main thread running and 
block on a stream read, sending it messages, or if i can only call 
into the main thread when i need something using racket/chezscheme 
apis. I guess it would be simpler to just talk directly to the main 
thread when i need to, which is why i'm asking. Otherwise i'm thinking 
of just using zeromq on the main thread.


You certainly can talk to any of the places individually ... but you do 
need the main thread to remain running (even if just waiting on some 
event) if you want dynamic places to continue running.



Now "distributed"[2,3] places are separate processes - you can start 
them and they will continue running regardless of what happens to the 
process that spawned them.



Nate


Hope this helps,
George

[1]  https://docs.racket-lang.org/reference/places.html
[2]  https://docs.racket-lang.org/distributed-places/index.html
[3]  https://pkgd.racket-lang.org/pkgn/search?q=loci

--
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/48c3d0ce-50ed-6ad3-7e03-470335c98474%40comcast.net.


Re: [racket-users] package manager woes on Windows 10?

2020-09-13 Thread Robby Findler
Yea, I agree. I'd made that change locally but hadn't pushed because I
couldn't make the bad behavior happen reliably. Perhaps that lack shouldn't
stop us! Pushed now.

Robby


On Sat, Sep 12, 2020 at 11:15 PM jackh...@gmail.com 
wrote:

> Could we make the "do what I mean" box just automatically strip any
> newlines pasted into it? It seems sensible to me to require that it only be
> a single line input.
>
> On Friday, September 11, 2020 at 6:22:59 AM UTC-7 hen...@topoi.pooq.com
> wrote:
>
>> On Thu, Sep 10, 2020 at 10:27:39AM -0400, George Neuner wrote:
>> >
>> >
>> > On 9/10/2020 10:06 AM, Philip McGrath wrote:
>> > > Also, this is happening over encrypted HTTPS: no one is sniffing the
>> > > User-Agent header.
>> >
>> > While it may not be the issue here, you need to understand that
>> appliance
>> > firewalls CAN and routinely DO examine data inside encrypted
>> connections.
>>
>> Using man-in-the-middle attacks?
>>
>> -- hendrik
>>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/84b16cf0-7837-4d54-9423-c1286f5e2b7an%40googlegroups.com
> 
> .
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAL3TdON46%3DPR6_-iyppSMLsfEvNEveq3uGu64gQ3Lu1or7QgNw%40mail.gmail.com.


Re: [racket-users] Incorporating Markdown documents into Scribble

2020-09-13 Thread Shriram Krishnamurthi
Apologies, I left in some debugging code. All we need is

@(define (markdown-inline file)
   (xexprs->scribble-pres
 (with-input-from-file file read-markdown)))

This will do you job, Jos Koot. For instance:

@title{Hello}
@(markdown-inline "new.md")


combined with (as "new.md")

This is a

* list
* mind-mapping
* points

written in a style that isn't too wordy.


produces

[image: image.png]

Shriram

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAJUf2yQcskUExDR-E9VE-u4DGoENxWyLf%2BUhtcnqrax0V7bN4A%40mail.gmail.com.


Re: [racket-users] Incorporating Markdown documents into Scribble

2020-09-13 Thread Shriram Krishnamurthi
>
> In that case, does it work if you simply remove the call to `decode-flow`
> from the definition of `markdown-inline`? Then the function would
> just return a list of pre-parts to be spliced into the enclosing document.
>

Doh. It appears to indeed!


> If you want to make the Markdown sections properly nest under the current
> section, you would probably need to adjust the depths of all `part-start`
> instances in the result. For example, if you use `markdown-inline` within a
> subsection, you would probably want to increase the depth of all
> part-starts by 2. I don't know if it's possible to find the current depth
> automatically, so you might need to make it an extra argument to
> `markdown-inline`.
>

Thanks.


>
> I also would have expected calling `decode` and then extracting and
> appending the blocks and parts to work, although it would have different
> behavior wrt the trailing text. Your original message said that didn't
> work, but how did it fail?
>

Yeah, I can't even remember all the things I tried.

I think there's value to figuring out a good set of abstractions here.
There's real value to being able to have, e.g., co-authors who can only
handle Markdown incorporate their work into Scribble pages. For now, with
my semester under way, I think I'll pass on that task (-:. Hopefully this
thread is useful to someone else who comes along and needs to do this.
Short and final version:

@(define (markdown-inline file)
   (pr
 (xexprs->scribble-pres
   (with-input-from-file file read-markdown

Shriram

Shriram


>
> Ryan
>
>
> On Sun, Sep 13, 2020 at 1:50 PM Shriram Krishnamurthi 
> wrote:
>
>> It's useful to have this behave like a `#include`. There are settings
>> where you want to have a non-Scribble person author things that go "in the
>> middle"; you want to think of this as just a more convenient way of writing
>> what you'd have written in Scribble.
>>
>> I realize there's presumably a closure issue (`section` isn't going to
>> come from the including file), and for that you probably want a different
>> include form as well.
>>
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAJUf2ySAir23z0uPYsZunszhoUqdH7HOv7RihCA3tHYSGxq4Jg%40mail.gmail.com.


Re: [racket-users] Incorporating Markdown documents into Scribble

2020-09-13 Thread Hendrik Boom
On Sun, Sep 13, 2020 at 07:50:01AM -0400, Shriram Krishnamurthi wrote:
> It's useful to have this behave like a `#include`. There are settings where
> you want to have a non-Scribble person author things that go "in the
> middle"; you want to think of this as just a more convenient way of writing
> what you'd have written in Scribble.
> 
> I realize there's presumably a closure issue (`section` isn't going to come
> from the including file), and for that you probably want a different
> include form as well.

The main thing I need markdown for is to include nested small bullet points, 
in an explorative mind-mapping style.

The Scribble syntax is too wordy to be convenient.

Just as @paragraph{  } would be inconvenient to mark all the paragraphs in 
ordinary text.

-- hendrik

> 
> -- 
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/CAJUf2yRcPq3-Gvxy3F95PJhBmiebquEvU3Sz6-y%3D98LFb_Wnvw%40mail.gmail.com.

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200913142451.56znr2ekrd65kaaf%40topoi.pooq.com.


Re: [racket-users] Incorporating Markdown documents into Scribble

2020-09-13 Thread Ryan Culpepper
Okay, if I understand correctly, you would expect the trailing text in my
example to be appended to the final subsection from the file.

In that case, does it work if you simply remove the call to `decode-flow`
from the definition of `markdown-inline`? Then the function would
just return a list of pre-parts to be spliced into the enclosing document.

If you want to make the Markdown sections properly nest under the current
section, you would probably need to adjust the depths of all `part-start`
instances in the result. For example, if you use `markdown-inline` within a
subsection, you would probably want to increase the depth of all
part-starts by 2. I don't know if it's possible to find the current depth
automatically, so you might need to make it an extra argument to
`markdown-inline`.

I also would have expected calling `decode` and then extracting and
appending the blocks and parts to work, although it would have different
behavior wrt the trailing text. Your original message said that didn't
work, but how did it fail?

Ryan


On Sun, Sep 13, 2020 at 1:50 PM Shriram Krishnamurthi 
wrote:

> It's useful to have this behave like a `#include`. There are settings
> where you want to have a non-Scribble person author things that go "in the
> middle"; you want to think of this as just a more convenient way of writing
> what you'd have written in Scribble.
>
> I realize there's presumably a closure issue (`section` isn't going to
> come from the including file), and for that you probably want a different
> include form as well.
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CANy33qm49ME9vVKLiYXSRGPgd8Xf0CHnzZpETyajtWrg48VGDw%40mail.gmail.com.


Re: [racket-users] Incorporating Markdown documents into Scribble

2020-09-13 Thread Shriram Krishnamurthi
It's useful to have this behave like a `#include`. There are settings where
you want to have a non-Scribble person author things that go "in the
middle"; you want to think of this as just a more convenient way of writing
what you'd have written in Scribble.

I realize there's presumably a closure issue (`section` isn't going to come
from the including file), and for that you probably want a different
include form as well.

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAJUf2yRcPq3-Gvxy3F95PJhBmiebquEvU3Sz6-y%3D98LFb_Wnvw%40mail.gmail.com.


Re: [racket-users] Incorporating Markdown documents into Scribble

2020-09-13 Thread Ryan Culpepper
What should the splicing version do in the following case:

  some text
  @(markdown-inline "file-with-sections.md")
  some trailing text

In particular, what should happen to the trailing text? Scribble doesn't
have a notion of returning to the top-level after a section. One
possibility would be to append it to the final subsection of
"file-with-sections.md"; another would be to create a "Continuation"
section to hold trailing text. Both of those seem bad to me; if the
trailing text contained another inline markdown file with sections, the
second file's sections would be at a deeper section level than the first
file's sections.

Or instead of mapping inline-Markdown sections to Scribble sections, you
could traverse the Markdown result and convert the Markdown section headers
to Scribble styled paragraphs instead. But then you would lose the benefits
of Scribble sections (eg, secref, TOC).

Ryan



On Sat, Sep 12, 2020 at 3:14 PM Shriram Krishnamurthi 
wrote:

> I need a little help with `decode` vs `decode-flow` in Scribble. (Also,
> this thread is about a question I wasn't able to find answered anywhere, so
> hopefully it will lead to a solution that others can also use.)
>
> Sometimes it's really useful to incorporate Markdown-formatted content
> into the middle of a Scribble document. (Let's not argue about this,
> please!) My assumption is that the Markdown document lives in a separate
> file (I'm not trying to do any clever textual inlining). Thanks to Greg
> Hendershott, I'm almost there! I use
>
> https://github.com/greghendershott/markdown
>
> Here are two versions of the inlining function:
>
> @(require markdown markdown/scrib scribble/decode)
>
> @(define (markdown-inline file)
>(decode-flow
>(xexprs->scribble-pres
>  (with-input-from-file file read-markdown
>
> @(define (markdown-part file)
>(decode
>(xexprs->scribble-pres
>  (with-input-from-file file read-markdown
>
> As a practical matter, `markdown-part` needs to take lots of extra
> arguments to create the appropriate part instead of just producing a
> title-less section. More importantly, you often don't want a separate
> section: you just want to "splice" the content into the current context.
>
> `markdown-inline` works great for this purpose, *except* if the included
> Markdown file contains any sections of its own, e.g.,
>
> This is text.
>
> > Lorem ipsum
>
> # Section
>
> ## Subsection
>
> Then I get this error:
>
> decode-flow: contract violation
>
>   expected: pre-flow?
>
>   given: (part-start 0 #f '((part "section")) (style #f '()) '("Section"))
> Any recommendations on how to create a "splicing" version that also
> respects having sub-sections, or is that impossible? (I've tried pulling
> out parts of the `part`, etc., but without success.)
>
> Thanks!
>
> Shriram
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/3f0b1012-783d-464a-a0ed-66d3f29f8893n%40googlegroups.com
> 
> .
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CANy33qndj%3DZo%3DTFejErwh%3DiEMd8XG34HZu0kv3dEBQumr%2Bwgjg%40mail.gmail.com.


[racket-users] question about places and main thread gc

2020-09-13 Thread Nate Griswold
Hi.

I am making an app that basically spawns two racket places and i want to be
able to communicate with them from c code.

Will gc happen in the two racket places if i don't keep the main thread
(the one that spawned the places) running? I was thinking about whether i
should keep the main thread running and block on a stream read, sending it
messages, or if i can only call into the main thread when i need something
using racket/chezscheme apis. I guess it would be simpler to just talk
directly to the main thread when i need to, which is why i'm asking.
Otherwise i'm thinking of just using zeromq on the main thread.

Thanks

Nate

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAM-xLPqAWGLrrxY%3D9ZdAkud5mZyiWjyg3Sh%3DpwVicCw8Kn7%3DLQ%40mail.gmail.com.