So I guess that the possibility of using This as a formal parameter is a
goodie associated with dynamic scoping, which I am not (yet) really used to
..

It opens a few doors. Nice!

Op zo 10 jun. 2018 18:20 schreef Arie van Wingerden <[email protected]>:

> ​Hi Alex,
> ​
> ​
> > I would do it this way:
> >
> >    (setq Employees '(emp1 emp2 emp3 emp4 emp5))
>
> OK. You don't use the values as names, but the properties, because you'd
> like to refer to (: name) in the 'prinl'.
> Got it.
>
> >    (mapc put
> >       Employees
> >       '(name .)
> >       '("Abel" "Jones" "Millner" "Noles" "Zaphod") )
> >
> >    (mapc put
> >       Employees
> >       '(category .)
> >       '(engineer cook teacher engineer vicar) )
>
> Agreed. Much less elaborate.
>
> >
> >    (mapc show Employees)
>
> Nice and easy :)
>
> >
> >    (with
> >       (find
> >          '((This) (== 'engineer (: category)))
> >          Employees )
> >       (prinl "Highest paid engineer is: " (: name))  )
>
>
> ​M
> aybe it would more appropriate t​o ​​change "Highest paid engineer​"​​ to
> "First engineer found"?​
>
> T
> ​he
> formal parameter
> ​ ​
> 'This' boggled my mind for a few minutes, but then it made sense :)
> Very nice trick indeed!​
>
> Thx,
>    Arie
>
>   ​
>

Reply via email to