Re: [racket-users] Language-Specific Plugins: Toolbar button functionality to call drracket:eval:expand-program

2019-06-28 Thread Philip McGrath
If you're sure you want to get the raw program source and deal with it
manually, you can use the method `get-definitions-text
`
on the DrRacket frame given as an argument to your button's callback
function. This will give you the editor object for the definitions window.
You can then use a method like `get-flattened-text
`
to get the source as a sting or (probably better) the function `
open-input-test-editor
`
to get an input port directly. Before evaluating it, you need to convert it
to an s-expression with `read` or, better, a syntax object with
`read-syntax`. In either case, you will want to use `
with-module-reading-parameterization
`
to set the reading parameters properly.

However, if I understand your requirements correctly, I still think
expanding to a "main" submodule would be the best way to go. To be
concrete, I'll use the example I gave before of a partially-expanded
version of your program, but with `shape` renamed to `result` to match your
description:

(module example hypothetical-lanugage
  (#%plain-module-begin
(provide result)
(define result (hypothetical-code))
(module* main racket/base
  (require (submod "..")
   hypothetical-lanugage/private/render)
  (render result

On Wed, Jun 26, 2019 at 12:05 PM Thomas Dickerson <
thomas_dicker...@alumni.brown.edu> wrote:

> 1. The language is a language for describing parametric 3D models, not for
> rendering, and the final result of being evaluated by Racket is a module
> containing a provided result value, which is a pointer to a C++ object
> which represents some a low level program evaluated by our C++ runtime to
> produce a triangle mesh.


Hopefully it's clear how this aspect of the expansion works: `
(hypothetical-code)` evaluates to your foreign C++ representation just as
it would in your current way of thinking about these programs.

2. Our C++ applications obtain the result value from a DSL program by
> calling scheme_dynamic_require in the inner loop of a Racket interpreter
> we've stuffed into a coroutine
> .


Again, this part works just fine. In particular, because of the way Racket's
submodules

work, the code in the "main" submodule *does not* run when you instantiate
the parent module, whether via `scheme_dynamic_require`, `dynamic-require`,
`require`, or some other way: the compiled form of the submodule need not
even be loaded into memory. So you can use rendering code in the main
submodule without creating a dependency for your main application.

3. When the toolbar button is pushed in DrRacket we want to evaluate the
> program in a fresh namespace, (dynamic-require ''module-name 'result),
> and then pass that result value into a C++ FFI function that will handle
> the C++ side of evaluation and doing the actual OpenGL calls to visualize
> it in the editor. This should have similar behavior to the run button from
> an evaluation standpoint, but after evaluating the program, enter a render
> loop until, e.g. the button is pushed again to stop rendering. Here, the
> DrRacket plugin is responsible for creating the OpenGL context, which could
> be in a separate window, but as Kshitij said it would be ideal if we could
> figure out how to add a pane below the REPL.
>

This is where I think using a submodule will be helpful. When you press the
"Run" button in DrRacket, the "main" submodule is run for effect before
starting the REPL. (Command-line `racket` will do similarly depending on
the flags.) In the example expansion, `(render result)` would pass the
value described by your DSL program to your rendering function and whatever
FFI calls are needed. It could certainly open a new GUI window, and it
could also return a value that renders as an embedded widget (snip) in the
interactions pane. (See the plot library for an example.) I haven't looked
at the DrRacket extension APIs enough to be sure whether you could open a
new pane in the DrRacket window, but it certainly seems possible.

Using a "main" submodule should let you take advantage of DrRacket's
programming-languages-as-operating-systems capabilities for managing the
programs it runs with minimal additional work. DrRacket would take care of
destroying your rendering context when you click "Run" again after changing
your program, it could enforce memory limits, and its "Stop"/"Kill" button
could 

Re: [racket-users] [PSA] Upcoming projects

2019-06-28 Thread Eric Griffis
> Why implement these projects in Algebraic Racket?

Good question -- not so easy to answer cleanly. Here's a smattering.

I created Algebraic Racket to make functional meta-programming in Racket
more enjoyable. My talk will demonstrate what I mean by that and why it
matters in practice.

The packages are also a field test for Algebraic Racket's extended feature
set. The diagrams library uses classes for ad hoc polymorphism. The
visualization and audio libraries use algebraic data for inter-process
messaging.

Algebraic Racket is designed to accommodate my programming style:
mostly-pure, compositional, driven by structural pattern matching at
multiple run-time phases. I like match and syntax-parse, but I love
Algebraic Racket.

(Don't tell Matthias I said this, but sometimes point-free style is more
compact and easier to read. This happens a lot more often in Algebraic
Racket, and it leads to good things.)

Algebraic Racket is mostly just extra syntax for the Racket base.
Replacing #lang racket/base with #lang algebraic/racket/base should not
change what a program does or slow it down much, and modules in one
language can be used in the other. Pattern-based variants of core Racket
syntactic forms (e.g, let, case, define) can be imported, but that breaks
drop-in compatibility.

Eric

-- 
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/CAORuSUydHGPBd7bpKEtnqaL2-H5hCYUvysyn2tQ1-ai5JSejfA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] images for Dr Racket 7.2 (Mac)

2019-06-28 Thread 'John Clements' via Racket Users
I think the idea is that you can right-click on the image in the documentation 
using your browser and save it, then use the Insert Image menu in DrRacket to 
open the image you just saved. Does this make sense?

John

> On Jun 28, 2019, at 11:26, Bryan Pierce  wrote:
> 
> Hello everyone!!
> 
> There is probably no reason I should let this bug me so much...in fact, I 
> know I found the answer in the documentation somewhere, but now I can't find 
> it
> 
> I installed Dr Racket to work through the HTDP book, and am at the point 
> where they say we can copy and paste the "rocket" image or use the Insert > 
> Insert Image... menu
> 
> But when I try to use the menu, I can't find any images in the Racket 7.2 
> folder hierarchy
> 
> QUESTIONS
> * Are thy not installed with the Mac version of Dr Racket?
> * Is there a way to download the images from the Racket 
> website
> 
> I have tried for 2 hours now to try to find the answer by searching both the 
> internet, the group, the racket website, and the documentation
> 
> Any help or any nudges in the right direction would be greatly apprciated!!
> 
> Thanks!
> 
> -- 
> 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/71a98a10-2dac-4957-976b-4ff81c2fac0a%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
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/9ac78bff-ae51-45e3-a9b1-28f790eaf154%40mtasv.net.
For more options, visit https://groups.google.com/d/optout.


[racket-users] resources on PL design

2019-06-28 Thread Stephen De Gabrielle
Hi,

I'm looking for resources on PL *design*., i.e. deciding what to make and how 
to assess/test those design decisions,  before moving onto how to make it. 

Any additions, opinions or advice appreciated:
Programming Languages: Application and Interpretation by Shriram Krishnamurthi  
https://www.plai.org/

Programming Language Pragmatics by Michael L. Scott

Practical Foundations for Programming Languages by Professor Robert Harper

Design Concepts in Programming Languages (The MIT Press) by Franklyn Turbak

Kind regards,
 
Stephen
 
* the languages are not important but FYI: Cobol, vb6, vb.net, C/C++, PHP, 
Python, c#, Java, MUMPS & JavaScript. 

-- 
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/9284F8BE-E828-4245-A2A1-A7A3D71C3535%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] images for Dr Racket 7.2 (Mac)

2019-06-28 Thread Bryan Pierce
Hello everyone!!

There is probably no reason I should let this bug me so much...in fact, I 
know I found the answer in the documentation somewhere, but now I can't 
find it

I installed Dr Racket to work through the HTDP book, and am at the point 
where they say we can copy and paste the "rocket" image or use the Insert > 
Insert Image... menu

But when I try to use the menu, I can't find any images in the Racket 7.2 
folder hierarchy

QUESTIONS
* Are thy not installed with the Mac version of Dr Racket?
* Is there a way to download the images from the Racket 
website

I have tried for 2 hours now to try to find the answer by searching both 
the internet, the group, the racket website, and the documentation

Any help or any nudges in the right direction would be greatly apprciated!!

Thanks!

-- 
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/71a98a10-2dac-4957-976b-4ff81c2fac0a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] [PSA] Upcoming projects

2019-06-28 Thread Daniel Prager
Hi Eric


On Fri., 28 Jun. 2019, 16:15 Eric Griffis,  wrote:

On Thu, Jun 27, 2019 at 9:12 PM Daniel Prager 
wrote:

[snip]

> Quick question: Why Algebraic Racket?

If I understand the question, you're asking what makes Algebraic Racket
"algebraic?"

It started as an attempt to implement algebraic data types without
committing to a type system. Turns out, "typed algebraic structures minus
the typing constraints" is a useful design heuristic.


That's interesting, but not what I was driving at! My bad ...

Take 2:

Why implement these projects in Algebraic Racket?

Dan

-- 
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/CAFKxZVV8P-OoN%2BqsgQKYHbkoWnGFfSdRHVfkVpa0o-%2B_9krN-Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] [PSA] Upcoming projects

2019-06-28 Thread Eric Griffis
On Thu, Jun 27, 2019 at 9:12 PM Daniel Prager  wrote:
>
> Hi Eric
>
> They all sound great.
>
> I'm particularly interested in the first two, and was very impressed by the 
> Diagram project gallery, and it would be great to see in Racket.

Cool! Thanks for the comments.

> Quick question: Why Algebraic Racket?
>
> Dan

If I understand the question, you're asking what makes Algebraic Racket
"algebraic?"

It started as an attempt to implement algebraic data types without
committing to a type system. Turns out, "typed algebraic structures minus
the typing constraints" is a useful design heuristic.

Eric

-- 
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/CAORuSUzu0BoeBLZ9v9XwuapWPge%3DQ_Qj3q6vVt39U6euFA5Heg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.