This shows you the differences between two versions of the page.
|
dss:workshop-01 [2019/08/14 15:03] eduard.staniloiu [1. Array Median Element] |
dss:workshop-01 [2021/03/10 23:46] (current) eduard.staniloiu |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Highschool workshop - Introduction to D ====== | ====== Highschool workshop - Introduction to D ====== | ||
| + | |||
| + | ===== Slides ===== | ||
| + | |||
| + | {{:dss:workshop-liceu.odp|Slides}} | ||
| ===== Exercises ===== | ===== Exercises ===== | ||
| Line 58: | Line 62: | ||
| - Add the [[http://ocw.cs.pub.ro/courses/dss/laboratoare/03?&#safe_functions|@safe]] attribute to the **main** function. What happens? | - Add the [[http://ocw.cs.pub.ro/courses/dss/laboratoare/03?&#safe_functions|@safe]] attribute to the **main** function. What happens? | ||
| - How can we get rid of the error messages? | - How can we get rid of the error messages? | ||
| + | |||
| + | ==== 5. Function templates ==== | ||
| + | |||
| + | Write a simple templated function that computes the sum of the elements of an array. | ||
| + | Your function should be able to work on any numeric type. This is exactly what we demoed in the presentation. | ||
| + | |||
| + | <note> | ||
| + | If you want to read more about D meta-programming, start with this introductory [[https://ocw.cs.pub.ro/courses/dss/laboratoare/02|hands-on]]. | ||
| + | </note> | ||
| + | |||