Thanks folks!

> On May 9, 2021, at 09:38, Robby Findler <ro...@cs.northwestern.edu> wrote:
> 
> 
> Here's one way to write it in modern Racket:
> 
> #lang racket
> (require (for-syntax syntax/parse))
> 
> (module+ test (require rackunit))
> 
> (define-syntax (my-and stx)
>   (syntax-parse stx
>     [(_) #'#f]
>     [(_ e:expr) #'e]
>     [(_ e1:expr e2:expr ...)
>      #'(if e1 (my-and e2 ...) #f)]))
> 
> (module+ test
>   (check-equal? (my-and) #f)
>   (check-equal? (my-and 1) 1)
>   (check-equal? (my-and 1 2) 2)
>   (check-equal? (my-and 1 #f 2) #f))
> 
> 
> 
>> On Sun, May 9, 2021 at 9:30 AM Jens Axel Søgaard <jensa...@soegaard.net> 
>> wrote:
>> Hi Tim,
>> 
>> In this case Ryan's method leads to:
>> 
>> https://github.com/racket/racket/blob/master/racket/collects/racket/private/qq-and-or.rkt#L440
>> 
>> But in case you are wondering about the style used in that file:
>> at the point where "qq-and-or.rkt" is used, none of the usual 
>> syntax tools (such as syntax-case and syntax-parse) are available,
>> so it is written using only primitive constructs.
>> 
>> That is, that particular file does not represent the usual style of macro 
>> writing.
>> 
>> /Jens Axel
>> 
>> 
>>> Den søn. 9. maj 2021 kl. 16.13 skrev Ryan Culpepper 
>>> <rmculpepp...@gmail.com>:
>>> Here are the three most convenient ways I know of to find that information 
>>> (which is "$RACKET/collects/racket/private/qq-and-or.rkt" in this specific 
>>> case):
>>> 
>>> If you use DrRacket, then open a file that uses `and`, right-click on an 
>>> occurrence of `and`, and choose "Open Defining File" (which changes to 
>>> "Jump to Definition (in Other File)" once DrRacket opens the file.
>>> 
>>> If you use Emacs with racket-mode, go to an occurrence of `and` and hit 
>>> "M-." (that is, hold down Meta/Alt and press the period key). You can also 
>>> use "M-x racket-visit-definition". That opens the defining module and jumps 
>>> to the definition.
>>> 
>>> If you have the `whereis` package installed, run the command `raco whereis 
>>> -b racket/base and` and it will print the path of the defining file.
>>> 
>>> Ryan
>>> 
>>> 
>>>> On Sun, May 9, 2021 at 3:26 PM Tim Meehan <btmee...@gmail.com> wrote:
>>>> Where in the repository are macros like "and" and "or" defined?
>>>> I tried searching for "and" and "or" ... but you probably know how that 
>>>> worked out.
>>>> 
>>>> Thanks folks!
>>>> -- 
>>>> 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/CACgrOxK6S8EOAGk_rPbE%2B_wMLJiSbpwMhVd4AeRL8C9%2BDW3mgg%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/CANy33q%3DsLEH-ooUJxTay6pG1GNcRLZDUotNJ23L1HRTC1XqHwA%40mail.gmail.com.
>> 
>> 
>> -- 
>> -- 
>> Jens Axel Søgaard
>> 
>> -- 
>> 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/CABefVgzgqRPzx6ct6LrN-TAfE18vsdqnopun0B63LmqqKxerAQ%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/5FA065BA-EFB1-424A-BDCE-7C865613EDEB%40gmail.com.

Reply via email to