Three little secrets for being a successful engineer
Michele Riva
Senior Software Architect @NearForm
Skopéō
σκοπέω
MicheleRivaCode
MicheleRivaCode
Florence
MicheleRivaCode
Fortran
program average
implicit none
real, dimension(:), allocatable :: points
integer :: number_of_points
real :: average_points, positive_average, negative_average
average_points = 0.0
positive_average = 0.0
negative_average = 0.0
write (*,*) "Input number of points to average:"
read (*,*) number_of_points
allocate (points(number_of_points))
write (*,*) "Enter the points to average:"
read (*,*) points
if (number_of_points > 0) average_points = sum(points) / number_of_points
if (count(points > 0.) > 0) positive_average = sum(points, points > 0.) / count(points > 0.)
if (count(points < 0.) > 0) negative_average = sum(points, points < 0.) / count(points < 0.)
write (*,'(a,g12.4)') 'Average = ', average_points
write (*,'(a,g12.4)') 'Average of positive points = ', positive_average
write (*,'(a,g12.4)') 'Average of negative points = ', negative_average
end program average
MicheleRivaCode
LISP
1958 circa
MicheleRivaCode
LISP
(defun qsort (L)
(cond
((null L) nil)
(t
(append
(qsort (list< (car L) (cdr L)))
(cons (car L) nil)
(qsort (list>= (car L) (cdr L)))))))
(defun list< (a b)
(cond
((or (null a) (null b)) nil)
((< a (car b)) (list< a (cdr b)))
(t (cons (car b) (list< a (cdr b))))))
(defun list>= (a b)
(cond
((or (null a) (null b)) nil)
((>= a (car b)) (list>= a (cdr b)))
(t (cons (car b) (list>= a (cdr b))))))
MicheleRivaCode
ALGOL
1958 circa
MicheleRivaCode
Edsger Dijkstra
1972
Niklaus Wirth
1984
Peter Naur
2005
Turing awards
MicheleRivaCode
Algol
procedure Absmax(a) Size:(n, m) Result:(y) Subscripts:(i, k);
value n, m; array a; integer n, m, i, k; real y;
comment The absolute greatest element of the matrix a, of size n by m
is transferred to y, and the subscripts of this element to i and k;
begin integer p, q;
y := 0; i := k := 1;
for p:=1 step 1 until n do
for q:=1 step 1 until m do
if abs(a[p, q]) > y then
begin y := abs(a[p, q]);
i := p; k := q
end
end Absmax
MicheleRivaCode
Other important languages
MicheleRivaCode
L←(Lι':')↓L←,L ⍝ drop To:
L←LJUST VTOM',',L ⍝ mat with one entry per row
S←¯1++/∧\L≠'(' ⍝ length of address
X←0⌈⌈/S
L←S⌽(−(⍴L)+0,X)↑L ⍝ align the (names)
A←((1↑⍴L),X)↑L ⍝ address
N←0 1↓DLTB(0,X)↓L ⍝ names)
N←,'⍺',N
N[(N='_')/ι⍴N]←' ' ⍝ change _ to blank
N←0 ¯1↓RJUST VTOM N ⍝ names
S←+/∧\' '≠⌽N ⍝ length of last word in name
APL
1962
MicheleRivaCode
Begin
Procedure RightText(T, N, FitsIn); Text T; Integer N;
Name FitsIn; Boolean FitsIn;
Begin
Integer I;
FitsIn := N >= T.Length;
For i:=1 step 1 until N-T.Length do OutText(" ");
OutText(T)
End of RightText;
RightText("Short", 30); OutImage;
RightText("And the long one", 30);
End of Program;
Simula
1962
MicheleRivaCode
Max(Items, ValueFunction) = value of
§ (Best, BestVal) = (NIL, -∞)
while Items do §
(Item, Val) = (Head(Items), ValueFunction(Head(Items)))
if Val > BestVal then (Best, BestVal) := (Item, Val)
Items := Rest(Items) §⃒
result is Best §⃒
CPL
1963
MicheleRivaCode
05 HOME : TEXT : REM Fibonacci numbers
10 LET MAX = 5000
20 LET X = 1 : LET Y = 1
30 IF (X > MAX) GOTO 100
40 PRINT X
50 X = X + Y
60 IF (Y > MAX) GOTO 100
70 PRINT Y
80 Y = X + Y
90 GOTO 30
100 END
BASIC
1964
MicheleRivaCode
main() {
extrn putchar, n, v;
auto i, c, col, a;
i = col = 0;
while(i<n)
v[i++] = 1;
while(col<2*n) {
a = n+1;
c = i = 0;
while (i<n) {
c =+ v[i] *10;
v[i++] = c%a;
c =/ a--;
}
putchar(c+'0');
if(!(++col%5))
putchar(col%50?' ': '*n');
}
putchar('*n*n');
}
v[2000];
n 2000;
B
1969
MicheleRivaCode
What makes these languages so important?
MicheleRivaCode
CPL + B =
The C programming language
1972
MicheleRivaCode
C influence
C
1972
C++
1985
Java
1995
C#
2000
MicheleRivaCode
Scheme
1975
Caml
1985
Racket
1995
Clojure
2007
ML
1973
LISP influence
MicheleRivaCode
Pascal
1985
Simula
1962
Delphi
1995
ALGOL influence
MicheleRivaCode
Non-american languages
MicheleRivaCode
Simula 🇳🇴
Ole-Johan Dahl
Kristen Nygaard
MicheleRivaCode
Pascal 🇨🇭
Niklaus Wirth
MicheleRivaCode
Python 🇳🇱
Guido Van Rossum
MicheleRivaCode
Ruby 🇯🇵
Yukihiro Matsumoto
MicheleRivaCode
Elixir 🇧🇷
José Valim
MicheleRivaCode
ML 🇫🇷
MicheleRivaCode
Online Historical Encyclopaedia of Programming Languages
8.900+ known programming languages
~2.500 🇺🇸
MicheleRivaCode
Online Historical Encyclopaedia of Programming Languages
8.900+ known programming languages
~2.500 🇺🇸
~600 🇬🇧
MicheleRivaCode
Online Historical Encyclopaedia of Programming Languages
8.900+ known programming languages
~2.500 🇺🇸
~600 🇬🇧
~160 🇨🇦
MicheleRivaCode
Online Historical Encyclopaedia of Programming Languages
8.900+ known programming languages
~2.500 🇺🇸
~600 🇬🇧
~160 🇨🇦
~75 🇦🇺
MicheleRivaCode
Symbolic programming languages
MicheleRivaCode
APL
'Hello, world'
MicheleRivaCode
APL
(~R∊R∘.×R)/R←1↓ιR
MicheleRivaCode
K
2_&{&/x!/:2_!x}'!R
MicheleRivaCode
J
quicksort=: (($:@(<#[), (=#[), $:@(>#[)) ({~ ?@#)) ^: (1<#)
MicheleRivaCode
Lambda Calculus
λf.(λx.(f(xx))λx.(f(xx)))
MicheleRivaCode
Prolog
partition([], _, [], []).
partition([X|Xs], Pivot, Smalls, Bigs) :-
( X @< Pivot ->
Smalls = [X|Rest],
partition(Xs, Pivot, Rest, Bigs)
; Bigs = [X|Rest],
partition(Xs, Pivot, Smalls, Rest)
).
quicksort([]) --> [].
quicksort([X|Xs]) -->
{ partition(Xs, X, Smaller, Bigger) },
quicksort(Smaller), [X], quicksort(Bigger).
MicheleRivaCode
Esoteric Programming Languages
MicheleRivaCode
Brainfuck
+[-[<<[+[--->]-[<<<]]]>>>-]>-.---.>..>.<<<<-.<+.>>>>>.>.<<.<-.
MicheleRivaCode
Choon
AGb-A#A#+A+%A#DF-AC#
MicheleRivaCode
Elang
"" .H .e .l .l .o ., ._ .w .o .r .l .d .! ()
MicheleRivaCode
Integ
](104)](101)](108)](108)](111)](44)](32)](119)](111)](114)](108)](100)](10)
MicheleRivaCode
Befunge
>>v
v1?2v
3
> > >: v
|-&<
$
>"!tcerroC">:v
|,<
@
MicheleRivaCode
when would I typically use these languages?
MicheleRivaCode
Sort numbers in a ragged list
https://codegolf.stackexchange.com/questions/244101/sort-numbers-in-a-ragged-list
input: [[4, 7], [5, 3, [], [6, [2]]]
output: [[÷2, 3], [4, 5, [], [6, [7]]]]
FṢṁ
Jelly
N`\d+
Retina
1N→_a`\d+`?λ←_a1+→_a`\d+`?Ẏ⌊s←_a iS;øṙ
Vyxal
n=>n.replace(r=/\d+/g,_=>n.match(r).sort((a,b)=>a-b)[i++],i=0)
JavaScript
MicheleRivaCode
Non-textual programming languages
MicheleRivaCode
Piet
MicheleRivaCode
Piet
MicheleRivaCode
Whitespace
MicheleRivaCode
Whitespace
Tab
Space
MicheleRivaCode
Velato
MicheleRivaCode
Non-English-based programming languages
MicheleRivaCode
Linotte
BonjourLeMonde:
début
affiche "Bonjour le monde!"
MicheleRivaCode
SAKO
K) PROGRAM DRUKUJE NAPIS HELLO WORLD
LINIA
TEKST:
HELLO WORLD
KONIEC
System Automatycznego Kodowania Operacji
MicheleRivaCode
Rapira
ПРОЦ СТАРТ()
ВЫВОД: 'Привет, мир!'
КОН ПРОЦ
MicheleRivaCode
ひまわり
「Hello, World!」と、表示。 ’母艦(メインフォーム)に表示。
「Hello, World!」と、言う。 ’ダイアログボックスで表示。
Himawari
MicheleRivaCode
قلب
(قول "مرحبا يا عالم")
Qalb
MicheleRivaCode
易语言
公开 类 启动类
{
公开 静态 启动()
{
控制台.输出("你好,世界!");
}
}
EPL (Easy Programming Language)
MicheleRivaCode
Bonus: CadregaLISP
$ ./brambilla
🍎 ▶ (ciapa x 5)
🍎 ▶ (+ x 10)
15
🍎 ▶ (ciapa-che! x 10)
🍎 ▶ (= x 5)
#è minga vera
🍎 ▶ fèrmes
https://github.com/micheleriva/CadregaLisp
MicheleRivaCode
MicheleRivaCode
So, are all programming languages in English?
MicheleRivaCode
nope!
MicheleRivaCode
MicheleRivaCode
@MicheleRiva
@MicheleRivaCode
/in/MicheleRiva95
www.micheleriva.dev
From ravioli maker to international speaker, GDE, MVP
By Michele Riva
From ravioli maker to international speaker, GDE, MVP
- 478