Re: [racket-users] Re: Structured Concurrency in Racket

2019-10-09 Thread Zelphir Kaltstahl
Hi!

Hmmm, that code example looks simple enough. If that works for arbitrary
serializable-lambda with only serializable parts, I could continue my
process pool project. The only issue would then be, that any user of it
would have to know in advance, that they cannot define their lambdas as
usual, but have to use serializable-lambda, potentially through their
entire code (as there might be references to things which contain
references to things, which ...). The abstraction is in this way leaky,
but it would make a working library then.

`n` does not need to be serializable, because it is defined in the
module and will be defined in the module "on the other side" as well? If
I understand this correctly.

When saying, that in other languages it is possible to simply define a
lambda and send it to another actor, I meant of course with immutable
data, or at least with data, which is not actually mutated. I assumed
that already, but yes, of course you are right about that. I was
thinking of Erlang, Elixir and maybe Pony.

When hearing actors, then Threads could be thought of a means of
implementing them, but I think might not be useful to do so when
thinking about performance. Architecturally yes, maybe. That is, why I
would think of places as a means of implementing an actor model kind of
thing.

When you say, that loci extends the idea of places to multiple machines,
what do you mean? I thought places can already run on multiple machines.

I might try to use your example code to finally finish the process pool
implementation I started. If everything works like that, then I probably
have to retract any statements about parallelism being too hard in
Racket : ) It would be nice however, to not have to use a different
construct to define serializable lambdas and to be able to go to any
program and simply use existing lambdas to send them to a process pool
to make use of multiple cores, instead of having to refactor many things
into serializable things.

Regards,

Zelphir


On 10/9/19 11:58 PM, Philip McGrath wrote:
> On Wed, Oct 9, 2019 at 2:09 PM Zelphir Kaltstahl
> mailto:zelphirkaltst...@gmail.com>> wrote:
>
> I was wrongly under the impression, that serializable-lambda are
> supposed to work out of the box, when sending them over channels,
> without needing to do any further work ("are serialized
> automatically" instead of "can be serialized"). … If you know how
> to serialize those serializable-lambdas, it is possible, that you
> could solve the problems they faced.
>
> … Is there a generic way to serialize such lambdas, no matter what
> they look like?
>
> You can serialize the procedures produced by `serial-lambda` using the
> `racket/serialize
> ` library,
> the same way you serialize other kinds of Racket values. Here is an
> extended example:
> #lang racket
>
> (require web-server/lang/serial-lambda
>          racket/serialize
>          rackunit)
>
> (define (make-serializable-adder n)
>   (serial-lambda (x)
>     (+ n x)))
>
> (define serializable-add5
>   (make-serializable-adder 5))
>
> ;; The value of a serial-lambda expression is a procedure.
> (check-eqv? (serializable-add5 2)
>             7)
>
> ;; The procedure can't be sent over a place-channel directly ...
> (check-false
>  (place-message-allowed? serializable-add5))
> ;; ... but it is serializable:
> (check-true
>  (serializable? serializable-add5))
>
> (define serialized
>   (serialize serializable-add5))
> ;; The serialized form can be sent over a place-channel.
> (check-true
>  (place-message-allowed? serialized))
>
> (define-values [in out]
>   (place-channel))
>
> (place-channel-put in serialized)
>
> ;; When we deserialize the received value, potentially in a new place ...
> (define received
>   (place-channel-get out))
> (define deserialized
>   (deserialize received))
>
> ;; ... it works like the original, including closing over the lexical
> environment.
> (check-eqv? (deserialized 11)
>             16)
>
> One thing to note is that the procedures returned by `serial-lambda`
> do close over their lexical environments, which is desirable for the
> reasons you mention in your previous message. That means that values
> which are captured as part of the closure must also be serializable,
> or `serialize` will raise an exception. (The same is true for lists:
> they are serializable as long as their contents are also serializable.)
>
> Concretely, in the example above, `n` is part of the closure and
> therefore must be serialized—which works out great, because `n` must
> be a number, and numbers are serializable. On the other hand, the
> procedure `+` isn't serializable, but that's ok, because `+` isn't
> part of the closure: it's a reference to a module-level identifier.
>
> … it seems to be the case in other programming languages, where
> one can simply send lambdas to other actors, which can, but don't
> have to, run on other cores 

[racket-users] Re: Structured Concurrency in Racket

2019-10-09 Thread George Neuner
On Wed, 9 Oct 2019 16:15:14 -0400, Sam Tobin-Hochstadt
 wrote:

>The Racket community, and even more so the design of Racket
>concurrency APIs, is very strongly influenced by the academic side of
>Racket. As far as I can tell, structured concurrency is fairly close
>to what is traditionally called the fork/join model.

To a 1st approximation. There are different implementations of
fork/join.

In some the forking thread stops immediately to wait for the spawned
child(ren) to exit.  In others, the forking thread can continue until
it executes a deliberate join.  

But then there are systems where join implicitly targets all children.
Then there are systems where join implicitly targets the last child
forked and to wait for all children you have to keep executing join
until it fails.  Still others where (like with Unix processes) join
implicitly targets a single child, but you don't know which one will
return and to wait for all you have to keep executing joins.  And
still others where join can be told to wait for a particular set of
children (ignoring others).


Threads in Racket are signaling, and their completion (or death) can
be detected using events or directly using their handles.  So Racket
can easily emulate any of the behaviors above.  Putting a nicer syntax
on it would just be some macrology.

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/neftpe5surndb67v0p2gqgrpklq8bq3jpf%404ax.com.


Re: [racket-users] Re: General ways and concrete examples of approaching web dev

2019-10-09 Thread Marc Kaufmann
Great, I'll have a look at these - and I'm mostly using postgres, although
I don't have strong views.

On Thu, Oct 10, 2019 at 7:10 AM George Neuner  wrote:

> On Wed, 9 Oct 2019 10:01:34 +0200, Marc Kaufmann
>  wrote:
>
> >You don't happen to have a free/cheap (Linux compatible) one to try out? I
> >found 10 lists with 'best 6/10/33 db modeling tools', which is 5/9/32
> tools
> >too many...
>
>   I know what you mean.
>
> I routinely deploy on Linux, but much of my development work actually
> is done on Windows.  Unfortunely, I'm much less familiar with the
> state of DBMS tools on the Linux side.
>
> There are some well respected programs that have Linux versions, but
> many/most of them will require JVM and JDBC drivers for your DBMS ...
> which may make their installation a bit tricky.  I've seen plenty of
> issues with JVM software on Linux - some programs just aren't happy
> with OpenJVM/JDK and demand Sun/Oracle's version instead.
>
>
> You didn't mention what DBMS you are targeting - that matters for
> scripting - but I would take a look at the list below.  They all are
> free or have free versions, are multi-platform, and support multiple
> DBMS.
>
> https://www.oracle.com/database/technologies/appdev/sql-developer.html
> https://dbeaver.io/
> http://www.bestofbi.com/page/architect
> http://squirrel-sql.sourceforge.net/
> http://www.modelsphere.com/org/
>
>
> George
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Racket Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/racket-users/7cBrSU8aTS0/unsubscribe.
> To unsubscribe from this group and all its topics, 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/1bdtpehmfhajjoaasq97h5icachdkr6b9s%404ax.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/CAD7_NO4QaQ-U3c-%2Bg6NrtF2naAA8dS3j3mkWYno93MGn5HdE6w%40mail.gmail.com.


[racket-users] Re: General ways and concrete examples of approaching web dev

2019-10-09 Thread George Neuner
On Wed, 9 Oct 2019 10:01:34 +0200, Marc Kaufmann
 wrote:

>You don't happen to have a free/cheap (Linux compatible) one to try out? I
>found 10 lists with 'best 6/10/33 db modeling tools', which is 5/9/32 tools
>too many...

  I know what you mean.  

I routinely deploy on Linux, but much of my development work actually
is done on Windows.  Unfortunely, I'm much less familiar with the
state of DBMS tools on the Linux side.

There are some well respected programs that have Linux versions, but
many/most of them will require JVM and JDBC drivers for your DBMS ...
which may make their installation a bit tricky.  I've seen plenty of
issues with JVM software on Linux - some programs just aren't happy
with OpenJVM/JDK and demand Sun/Oracle's version instead.


You didn't mention what DBMS you are targeting - that matters for
scripting - but I would take a look at the list below.  They all are
free or have free versions, are multi-platform, and support multiple
DBMS.  

https://www.oracle.com/database/technologies/appdev/sql-developer.html
https://dbeaver.io/
http://www.bestofbi.com/page/architect
http://squirrel-sql.sourceforge.net/
http://www.modelsphere.com/org/


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/1bdtpehmfhajjoaasq97h5icachdkr6b9s%404ax.com.


Re: [racket-users] I Need Help Bringing Vulkan to Racket

2019-10-09 Thread Hendrik Boom
On Thu, Oct 10, 2019 at 07:36:33AM +0900, Jay McCarthy wrote:
> Hi Sage,
> 
> You should model your implementation of Stephan's RacketGL ---
> https://github.com/stephanh42/RacketGL --- which parses the spec.
> 
> If you also want to or need to capture parts of the headers, I recommend
> David Benoit's dynamic-ffi --- https://github.com/dbenoit17/dynamic-ffi ---
> for parsing them with Clang's library, rather than going with something
> home grown.
> 
> I am very interested in making mode-lambda work on Vulkan. I have a Windows
> computer that I could test on.

And I have a systemd-free Linux system to test on.

-- hendrik

> 
> Jay
> 
> --
> Jay McCarthy
> Associate Professor @ CS @ UMass Lowell
> http://jeapostrophe.github.io
> Vincit qui se vincit.
> 
> 
> On Thu, Oct 10, 2019 at 5:56 AM Sage Gerard  wrote:
> 
> > I'm resuming work on a very early-stage project that generates FFI
> > bindings for Vulkan in Racket [1]. VkTk is the closest relative project I
> > have found for reference [2].
> >
> > Last time I was on the project I was focused on generating bindings from
> > the API registry. That has not changed. I considered use of Dave Herman's C
> > library [3] on vulkan.h directly, but the XML spec has supplemental data,
> > and vulkan.h has preprocessor directives that I would like to capture for
> > completeness.
> >
> > Once I am finished with the bindings. would anyone be available to
> > contribute/run tests in the hopes that we can make this viable faster? I
> > intend to run any applications on Windows 10 and a 1080Ti, but that's about
> > all of the configurations that I can verify. I'll definitely need guinea
> > pigs and feedback.
> >
> > [1]: https://github.com/zyrolasting/racket-vulkan
> > [2]: https://github.com/awolven/VkTk
> > [3]: https://docs.racket-lang.org/c-utils/index.html
> >
> > *~slg*
> >
> >
> > --
> > 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/RsANZblSLyJViX1EDgDg-umCCJKCS6uYV84htPiRjjgAuW7G_3nx-fAOrLD7VMDqtEDkSKbm16jPyTWsAk1QyXCF8cz2CUi-mP04jrpmgn8%3D%40sagegerard.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/CAJYbDa%3DotA_tNaD1troPWF9XDoj_hg0dMKKpiR1xQV%2BKMip%2BHQ%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/20191010011727.7onerpwtyuzooyz4%40topoi.pooq.com.


Re: [racket-users] I Need Help Bringing Vulkan to Racket

2019-10-09 Thread Jay McCarthy
Hi Sage,

You should model your implementation of Stephan's RacketGL ---
https://github.com/stephanh42/RacketGL --- which parses the spec.

If you also want to or need to capture parts of the headers, I recommend
David Benoit's dynamic-ffi --- https://github.com/dbenoit17/dynamic-ffi ---
for parsing them with Clang's library, rather than going with something
home grown.

I am very interested in making mode-lambda work on Vulkan. I have a Windows
computer that I could test on.

Jay

--
Jay McCarthy
Associate Professor @ CS @ UMass Lowell
http://jeapostrophe.github.io
Vincit qui se vincit.


On Thu, Oct 10, 2019 at 5:56 AM Sage Gerard  wrote:

> I'm resuming work on a very early-stage project that generates FFI
> bindings for Vulkan in Racket [1]. VkTk is the closest relative project I
> have found for reference [2].
>
> Last time I was on the project I was focused on generating bindings from
> the API registry. That has not changed. I considered use of Dave Herman's C
> library [3] on vulkan.h directly, but the XML spec has supplemental data,
> and vulkan.h has preprocessor directives that I would like to capture for
> completeness.
>
> Once I am finished with the bindings. would anyone be available to
> contribute/run tests in the hopes that we can make this viable faster? I
> intend to run any applications on Windows 10 and a 1080Ti, but that's about
> all of the configurations that I can verify. I'll definitely need guinea
> pigs and feedback.
>
> [1]: https://github.com/zyrolasting/racket-vulkan
> [2]: https://github.com/awolven/VkTk
> [3]: https://docs.racket-lang.org/c-utils/index.html
>
> *~slg*
>
>
> --
> 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/RsANZblSLyJViX1EDgDg-umCCJKCS6uYV84htPiRjjgAuW7G_3nx-fAOrLD7VMDqtEDkSKbm16jPyTWsAk1QyXCF8cz2CUi-mP04jrpmgn8%3D%40sagegerard.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/CAJYbDa%3DotA_tNaD1troPWF9XDoj_hg0dMKKpiR1xQV%2BKMip%2BHQ%40mail.gmail.com.


Re: [racket-users] How do I typeset mixed-code for docs.racket-lang.org?

2019-10-09 Thread Philip McGrath
The way I would approach this would probably be to:

   1. Create a #lang that accepts your source Markdown+Racket syntax.
   2. Add a color lexer as you would for DrRacket, probably using `
   syntax-color/racket-lexer
   
`
   for the Racket parts or dynamically getting a color lexer based on the
   #lang line.
   3. In the Scribble manual, embed these fragments with `codeblock` and
   `code` rather than `racketblock` and `racket`:
   https://docs.racket-lang.org/scribble/scribble_manual_code.html

-Philip


On Wed, Oct 9, 2019 at 5:35 PM William J. Bowman 
wrote:

> Oh right I forgot about documentation links.
>
> No, scribble/minted won’t play well with the scribble/manual functions. It
> hijacks the renderer to use the pygmentize binary to generate typeset
> target code (HTML or LaTeX); it doesn’t just apply scribble styles.
>
> --
> Sent from my phoneamajig
>
> > On Oct 9, 2019, at 14:17, Sage Gerard  wrote:
> >
> > Hi William,
> >
> > Sorry for the delay and thank you for responding so quickly.
> >
> > It's a night and day difference in terms of presentation. I don't see
> documentation links functioning (e.g. the "displayln" in your example). I'm
> assuming that since @minted only applies to styles, it will function fine
> if composed with @racketmod and friends?
> >
> >
> > ~slg
> >
> > ‐‐‐ Original Message ‐‐‐
> >> On Tuesday, October 8, 2019 3:05 PM, William J. Bowman <
> w...@williamjbowman.com> wrote:
> >>
> >> This got me interested.
> >> I tried a quick hack on my scribble-minted package to allow for nesting
> >> different languages.
> >> Is this something like what you want?
> >> https://www.williamjbowman.com/tmp/scribble-minted/nested.html
> >>
> >> Source here:
> >>
> https://github.com/wilbowma/scribble-minted/tree/nested-minted/nested.scrbl
> >>
> >>
> 
> >>
> >> William J. Bowman
> >>
> >>> On Tue, Oct 08, 2019 at 05:06:40PM +, Sage Gerard wrote:
> >>>
> >>> One of my projects allows for embedding Racket modules within 
> elements, within a Markdown page.
> >>>
> >>> Hello World
> >>>
> >>> 
> >>>
> >>>