freenode/lisp - IRC Chatlog
Search
1:36:41
kinope
Morning all! Question. Is it just a matter of style whether one should make a small abstraction like (not (null x)) => not-empty_p, as an inlined function or a macro?
2:00:34
edgar-rft
kinope: I usually decide such a question by looking at my code. If the code is littered with (not (null x)) or some other repetitive pattern I try to find a shorter abstraction for it, but only if it makes the code easier to understand for a human. Every abstraction makes it necessary to learn a new symbol, so it makes no sense to abstract each and everything that only appears rather seldom in my code.
2:06:48
kinope
edgar-rft: Great! thanks. Should one make the abstraction a macro or a inlined function depending on the complexity of the operation?
2:08:59
no-defun-allowed
Macros shouldn't be where functions can be used, so an inlined function would suffice.
2:51:41
White_Flame
a big problem with inline functions in SBCL in particular, is that if you end up with hundreds of them in a single function body (as in a macroexpansion), it can massively slow down compilation
7:10:23
pve
Good morning! Is there a recommended/easy way of testing code on multiple implementations? I mean something I can give my code to and get back compilation and test results for each implementation.
7:25:35
axion
GitHub actions is what we use for pngload: https://github.com/bufferswap/pngload/runs/694176572?check_suite_focus=true
7:29:43
axion
Xach: That reminds me, I think zpb-exif PR #4 is required for pngload to build in next Quicklisp dist release.
7:30:18
pve
there wouldn't happen to be a script I could use to fetch and compile the most recent versions of each implementation? my distro is a bit out-of-date on this..
7:33:35
pve
perhaps I could try to make a docker image with a few implementations + cl-all or cl-test-grid
7:48:42
Posterdati
beach: another problem is the 'volt*ampere unit which is reduced to 'watt, in this case we cannot reppresent electrical apparent power which is V*A...
7:52:35
pjb
Posterdati: I don't see how it prevents it. The point being that units don't embody the whole physics!
7:52:55
pjb
It's not because you write a unit-consistent expression that you have modelized an actual physical phenomenon!
7:56:11
flip214
If you put a not-pure-ohmic thing on AC, you get a complex wattage (because V and I are phase-shifted)
7:57:22
flip214
you calculate the "real" power for the generator, and use the magnitude to dimension the conductor
7:57:43
flip214
Posterdati: yeah, for virtual loads you use VA, but that's just to differentiate in writing
7:59:46
pjb
It would be a very bad idea, in a computer system, to encode any meaning into different unit names.
8:00:06
pjb
If you have to encode some physical meaning, do it explicitely, not by the name or factorization of the unit!
8:01:52
Posterdati
pjb: V*A is not J/s if you consider a sinusoidal circuit, infact you can have work only by the real part of the complec power not the magnitude!
8:05:03
pjb
Again, you cannot represent a physical system by a mere unit expression, or even by a mere mathematical expression.
8:06:13
pjb
units are like types, they're only there to CHECK the consistency of a mathematical expression!
8:07:29
pjb
It's just per chance, that the relationship between physical grandeurs in a lot of (simple) physical phenomenon have a unique mathematical form, and therefore a unique unit consistency checking form.
8:08:53
pjb
Is this the electromotrice force of a battery? Is it a tension at the ends of a resistor? Is it something else?
8:09:18
pjb
It's not the calculation that gives physical meaning. It's the description of the physical system!
8:10:06
Posterdati
ofcourse, but the calculation give you an indication on the phenomena, you need it
8:10:17
pjb
Even better: you can describe physical systems, and measure physical grandeur from an actual instance, and not being able to compute them because you may not know the mathematical relationship between those grandeurs.
8:10:58
pjb
You need it if you want to do engineering work. But physical experiments can be done (and usually are done) without having any mathematical theory about it first.
8:11:43
Posterdati
yes, but this is not the case, I have a mathematical model which reppresent my physical system, with a nice degree of accuracy, but no units to represent the numbers it spits out... Seems odd!
8:13:28
pjb
Again, you're making a mistake. You should not encode anything into VA vs W, because VA = W they're identical.
8:15:11
pjb
And it's better to use internally normalized units such as kg·m2/s³ instead of VA or W, to be able to check unit consistency more easily.
8:17:35
pjb
You should use something like: (apparent-power 12 ((kg 1) (m 2) (s -3))) (real-power 12 ((kg 1) (m 2) (s -3)))
8:21:02
Posterdati
pjb: so to distinguish A from P you use 1VA not 1W which is indeed the real part of complex power!
8:22:51
Posterdati
so to no mix the both when you say 1 VA your meaning a complex power or its magnitude, when you say 1 W you are meaning the real part of complex power which is the active power, the same one that can do work
8:24:18
Posterdati
the reactive power VAR is intended to model the magnitude of electromagnetic energy which is bounced from generator to loads (in the steady state condition)
8:24:56
Posterdati
in fact if you consider the transient condition, all these units are meaningless and only J and W are present
10:20:03
easye
In the interests of adding as little complexity to the ABCL implementation, I was thinking of allowing the CL:MAKE-ARRAY :INITIAL-ELEMENTS arg be a specialized type for the implementation. I think this is worse than adding another keyword argument :NIO-BUFFER to specify an initial elements to be taken from this specialized type.
10:22:19
easye
The new type allowed for :INITIAL-ELEMENTS would be disjoint from the ANSI allowances.
10:22:49
easye
Which is why I think this is a bad way to save adding another implementation-dependent keyword argument to CL:MAKE-ARRAY
10:31:10
heisig
easye: That sounds messy (but I haven't fully understood what you mean with 'a specialized type for the implementation'). Adding an implementation-dependent keyword sounds better.
10:35:09
easye
RE: a symbol that... No, I mean that the argument will be a wrapped reference to an underlying Java type ("java.nio.ByteBuffer")
10:36:01
easye
phoe: thanks for the opinion. With you and Marco indicating uncertainty, I am definitely not currently planning on changing this for abcl-1.7.0.
10:42:12
pjb
Still, too bad this doesn't work: (make-array '(2 3) :initial-contents #2A((a b c) (d e f)))
10:56:12
jackdaniel
array with such non-coforming fill-pointer would wrap accordingly, that is row-major-aref 3 would reference the element 1, 1