Posts

Showing posts from 2021

Comparison of Different Nitrate Leaching Sensors

Image
In this post, I will deviate from my usual programming languages research topic and look at using sensors to detect concentration of N in either surface or ground water in NZ. This is in part related to my other project trying to create a marketplace of economic incentives for NZ farmers when it comes to optimising their environmental impact versus the long term economic cost (aka AgriDataTrade). There are the following four options commercially available in NZ as of late 2020. I am not going to cover very very cheap conductivity based sensors available en masse on Ali Express and similar sites as these are not able technologically to gauge the actual presence of N in either soil or water despite what is advertised. The major four options are: Hach HL4 is using pH light bulb, some pellets, conductivity sensor, and Nitrate sensor attachment. It is designed to be placed in running water - such as streams or rivers. It requires weekly calibration to ensure reliable Nitrate read

Breaking Dotty (Scala 3) and Java 16 Decidability

Image
As I was preparing my talk for the upcoming IFIP WG 2.4, I reflected on trying to explain the foundational work done by my recently graduated PhD student Julian Mackay as published in our POPL 2020 paper and APLAS 2020 paper ) last year. For this example, I used the latest release of Dotty (a.k.a. Scala 3) and the latest release of Java 16 : Imagine you want to have an interface or trait allowing you to compare items called Eq with parameter E . Here is both Java and Scala code alongside each other: Now imagine a Set that insists on containing the elements that are comparable with other Set instances using Eq and themselves contain elements that are comparable with Eq with both Java and Scala code alongside each other as follows: Finally, lets create a useful class Tree that implements such Set : If you are to ask either Dotty or Java a simple looking question: "is Tree a subtype of Eq<? super Tree> in Java or a subtype of Eq {type E >: Tree} in Sc