Cool! 
At first I wondered on the purpose of the racket-bricks (since there is 
scratch already) but when you mentioned the transition from block based 
coding it made a perfect sense!
BTW - have you considered 
using https://pkgs.racket-lang.org/package/scratchy with your B-expressions?

G.

On Friday, April 27, 2018 at 9:03:45 PM UTC+2, Stephen Foster wrote:
>
> Actually, I figured it out myself.  For the curious:
>
> What I ended up doing was implementing a custom language "#lang 
> racket-bricks".  I used syntax/module-reader's #:wrapper1 to intercept the 
> code prior to execution.  It scrapes out all of the brick-snip%s and 
> replaces them with their associated S-expressions.
>
> From the user's perspective, both B-expressions and S-expressions can 
> share variable bindings.  Also, one can nest B-expressions inside 
> S-expressions.
>
>
> <https://lh3.googleusercontent.com/-CBFxGIhYoIo/WuNydU9CrhI/AAAAAAAADMA/l6R5ClVV_OYPF3ySIJEL5w8-ZjFQBfidgCLcBGAs/s1600/Screen%2BShot%2B2018-04-27%2Bat%2B11.52.09%2BAM.png>
>
> I'm planning to use this at ThoughtSTEM to help transition novices 
> smoothly from block-based coding to traditional coding.
>
>
>
> On Thursday, April 26, 2018 at 2:33:35 PM UTC-7, Stephen Foster wrote:
>>
>> I finally had some time to revisit this.  I'm hoping someone can help me 
>> out a bit more.
>>
>>
>> I made a basic renderer that takes arbitrary S-expressions and renders 
>> them as bricks.  I've made an interface for editing the bricks (and thus 
>> editing the S-expressions underneath).
>>
>>
>> What I would like to do now is seamlessly integrate these 
>> brick-expressions (B-expressions?) into arbitrary Racket files using some 
>> kind of custom snip%.
>>
>>
>> Here's a not-working prototype of what it should look like:
>>
>>
>>
>> <https://lh3.googleusercontent.com/-kdfl-pNWFFo/WuI_Ke1hfDI/AAAAAAAADLc/2TZNVfty_vET2wOvZtAhZ504RDKogaTbACLcBGAs/s1600/Screen%2BShot%2B2018-04-26%2Bat%2B2.03.40%2BPM.png>
>>
>>
>> Notice that line #9 has the B-expression.  Line #7 has a comment showing 
>> the equivalent S-expression.  Also notice that the B-expression contains a 
>> reference to the constant defined in an S-expression on line #5.  And vice 
>> versa, notice that the S-expression on line #11 references the constant 
>> defined in the B-expression.  This two-way interoperability between 
>> B-expressions and S-expressions within the same file is something I think 
>> would be pedagogically valuable.
>>
>>
>> I'd love to implement this, but I'm looking for suggestions.
>>
>>
>> Let's just suppose I've implemented a special b-expression-snip% class.  
>> (I haven't, but I think I could).
>>
>>
>> How might I go about getting the above to work.  Here are some random, 
>> vague, probably-misguided musings about implementations -- meant to 
>> stimulate discussion:
>>
>>
>>    - Get DrRacket to render the b-expression-snip% as an image but 
>>    otherwise treat it as a normal S-expression, just as if it had been 
>> written 
>>    as such.
>>    - Get the b-expression-snip%'s associated S-expression to be "evaled" 
>>    in the context of the module -- without having to wrap the snip in a 
>> helper 
>>    S-expression, e.g. (my-eval ...).
>>    - Get the b-expression-snip%'s presence to somehow "inject" its 
>>    S-expression into the module/file/etc.
>>    - Implement some kind of special *#lang racket-with-bricks* that 
>>    intercepts the code before execution and swaps all B-expressions for 
>> their 
>>    associated S-expressions.
>>
>> Any ideas, pointers, references, etc. would all be appreciated.  Thanks 
>> in advance!
>>
>>
>> On Wednesday, December 27, 2017 at 8:30:16 PM UTC-8, Stephen Foster wrote:
>>>
>>> If I wanted to build a drag-and-drop, visual programming interface for 
>>> programming in DrRacket, is there any prior work I can build on?  Ideally, 
>>> I'd like to implement this as a DrRacket "snip", so that my students can 
>>> make programs that are partially text-based and partially visual.  Any 
>>> suggestions?  Has anyone done something in the ballpark?  
>>>
>>

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to