News for hackers. Stuff that matters.
Re:Programming Languages Going Above and Beyond by snitty on Thursday June 29, 2023 @08:49AM (#36519685)
>function Gcd(a:nat, b:nat) : (g:nat,x:int,y:int))

I hope this is a typo. Otherwise it…requires an unmatched close paren?

That's a new level of cursed syntax.

EDIT: Also, is |array| a common way to get the length of an array in languages? I've never seen that (or some of this other syntax) before and it took me a minute to figure out what was happening.

Re:Programming Languages Going Above and Beyond by hdctambien on Thursday June 29, 2023 @08:57AM (#36519770)
I don't know about programming languages, but in mathematics |v| is the notation to get the length of a vector... So maybe Matlab uses that syntax?
Re:Programming Languages Going Above and Beyond by RGBCube on Thursday June 29, 2023 @12:47PM (#36523055)
FYI, MATLAB uses `length(v)` to get the length of vector v.
Re:Programming Languages Going Above and Beyond by jbl on Thursday June 29, 2023 @08:56AM (#36519754)
|array| looks like it’s taken from the notation for cardinality of a set (number of elements in a set)
Re:Programming Languages Going Above and Beyond by snitty on Thursday June 29, 2023 @09:31AM (#36520104)
That makes sense. I initially read it as "absolute value." Which, admittedly, doesn't make sense for an array, but is a reasonable interpretation at first blush.
Re:Programming Languages Going Above and Beyond by redjamjar on Thursday June 29, 2023 @05:32PM (#36527034)
> I hope this is a typo

Yeah, sorry --- that is a typo.