Article View: comp.lang.c
Article #2062Re: variadic min and max, (any some and none, cat and more)
From: bartc
Date: Tue, 01 Dec 2026 17:48
Date: Tue, 01 Dec 2026 17:48
45 lines
3575 bytes
3575 bytes
On 01/12/2026 13:53, David Brown wrote:
> On 01/12/2026 13:11, bartc wrote:
>> Some more:
>>
>> v := (100, 0)
>> m := rotatematrix(15°, "Z")
>> println v * (m * m) # rotate 30 deg ac/w
>> I found it was simplest just to build-in whatever is needed (this
>> language was used with my 3D graphics app). No imports or libraries
>> are needed, and every user had the same abilities out-of-the-box.
>>
>>
>
> When you have a domain-specific language, and full control of the
> language, then built-ins can be easier. The point of techniques like
> this, whether in Python or C++, is that the language and toolchain only
> needs to support the technique. Then the individual users or library
> vendors can use it for any operations and any types. If someone wants
> to make a type that supports 8 x 8 matrices over complex doubles with a
> binary exponential operator, and write "matrix A = B *pow* C;", then
> they can do that with pretty much identical code as this. Well, they'd
> have to write code for the exponential operator in question, and good
> luck doing that efficiently manner while keeping numeric stability. But
> the wrapping code to support the syntax is straightforward.
>
> Some other languages, like Haskell, make it easier to write your own
> operators and also let you use symbols for them. C++ lets you write
> "rotatematrix(15_deg, "Z")", but not "15°". (You'd have to find a
> Unicode letter that looks like a degree symbol.)
I had the option to use either ° or 'deg':
15 deg
There were a number of such suffixes, which acted as scale factors when
they followed a constant number. Mostly they were used for lengths, such
as "m mm ft ins" (these converted the number to a standard unit, and in
my app that was millimetres).
(I was thinking of bring some of this back, then I looked at the
language Frink which does this stuff on an industrial scale; my efforts
would be utterly feeble.)
Technical Details
Message-ID:
<11en1a0$1vqc1$1@dont-email.me>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<11bes8b$1gncr$1@dont-email.me> <11ek7b2$j8f6$1@raubtier-asyl.eternal-september.org> <11ekfu0$mq5n$4@dont-email.me> <11ekg71$n5p7$1@raubtier-asyl.eternal-september.org> <11ekgf8$mq5n$8@dont-email.me> <11ekjsp$pmch$2@raubtier-asyl.eternal-september.org> <11ekq4q$snda$1@dont-email.me> <11em45u$1fp0a$1@dont-email.me> <11emdhn$1ko8h$1@dont-email.me> <11emjh1$1ntap$1@dont-email.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: bartc <bc@freeuk.com> Newsgroups: comp.lang.c Subject: Re: variadic min and max, (any some and none, cat and more) Date: Tue, 1 Dec 2026 17:48:47 +0000 Organization: A noiseless patient Spider Lines: 45 Message-ID: <11en1a0$1vqc1$1@dont-email.me> References: <11bes8b$1gncr$1@dont-email.me> <11ek7b2$j8f6$1@raubtier-asyl.eternal-september.org> <11ekfu0$mq5n$4@dont-email.me> <11ekg71$n5p7$1@raubtier-asyl.eternal-september.org> <11ekgf8$mq5n$8@dont-email.me> <11ekjsp$pmch$2@raubtier-asyl.eternal-september.org> <11ekq4q$snda$1@dont-email.me> <11em45u$1fp0a$1@dont-email.me> <11emdhn$1ko8h$1@dont-email.me> <11emjh1$1ntap$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Tue, 01 Dec 2026 17:48:49 +0000 (UTC) Injection-Info: dont-email.me; logging-data="2091393"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+j/LjwYYZw0sX/0zrEjT79"; posting-host="920163c6ca7496896278850533729c5c" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:rmW5gSUSJj6WbZ0JuxmJ312jc6w= sha256:1lXhoVNjMAHxboppeetqE8gpBVqF9IFeMI0HRTcHWtM= sha1:N1fpQDwZweptIDezTmT7IPZU0Hw= sha256:vsdF1+Dx5dno7DrVACZ6CNxQOvfSAUUw6TBUbqtQe1k= In-Reply-To: <11emjh1$1ntap$1@dont-email.me> Content-Language: en-GB