modular-expt and infix notation

18 views
Skip to first unread message

John Kemp

unread,
Feb 12, 2021, 11:46:54 AM2/12/21
to racket...@googlegroups.com
Hello,

I’ve been working with finite fields in racket, and although I solved my actual problem (numbers were too large for (modulo (expt)), using modular-expt, I had a question when I looked at modulo-expt, which uses what appeared to be infix operators:

> (define (modular-expt* n a b)
(cond [(b . < . 0) (raise-argument-error 'modular-expt "Natural" 1 a b n)]
[(b . = . 0) (if (n . = . 1) 0 1)]



Is there some actual advantage to using infix operators in racket, other than readability for those not used to LISP-like languages? I actually found it highly confusing at first, as I couldn’t find much documentation describing this usage (https://docs.racket-lang.org/guide/Pairs__Lists__and_Racket_Syntax.html gives only a brief mention at the end).

- johnk
Reply all
Reply to author
Forward
0 new messages