Regarding #lang racket/koans, I opened
https://github.com/zyrolasting/racket-koans/issues/24 and would appreciate
comments from those more familiar with defining syntaxes if there are rough
edges in this design.

On Sun, Aug 12, 2018 at 10:57 AM Sage Gerard <zyrolast...@gmail.com> wrote:

> This is great feedback, thank you both so much! I like using a language
> for this approach as the project evolves, and You's feedback is a good
> stopgap that does work, and can be applied in-place.
>
>
> On Sat, Aug 11, 2018 at 1:01 PM Matthew Butterick <m...@mbtype.com> wrote:
>
>>
>> On Aug 11, 2018, at 9:00 AM, Sage Gerard <zyrolast...@gmail.com> wrote:
>>
>> I'm starting to think writing these kind of exercises in a friendly way
>> is only possible with macros, but before I go that far, is it possible for
>> me to catch a module-level unbound identifier error and print a rackunit
>> failure outright *without *distracting the student?
>>
>> I'd appreciate feedback on the design here too, since I have to pick a
>> direction to handle this kind of problem project-wide.
>>
>>
>> Perhaps consider making a little `racket/koan` language for your
>> exercises that includes some extra conveniences. For instance, one way to
>> address your unbound identifiers is to redefine `#%top` as shown below. But
>> you could move that into `racket/koan`.
>>
>>
>> #lang racket/base
>>
>> (require rackunit)
>>
>> (require (for-syntax racket/base))
>> (define-syntax (#%top stx)
>>   (syntax-case stx ()
>>     [(_ . id) (not (identifier-binding #'id)) #'(λ _ (format "unbound
>> identifier: ~a" 'id))]
>>     [(_ . id) #'id]))
>>
>> ;; Produce a single struct that passes all assertions.
>> (let ([p "?"])
>>   (check-pred racketeer? p)
>>   (check-pred programmer? p)
>>   (check-pred struct? p)
>>   (check-pred procedure? set-programmer-salary!)
>>   (check-equal? (programmer-confusion-level p) 10)
>>   (check-equal? (racketeer-desire-for-racket-jobs p) 9001))
>>
>

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