Re: Finnish notation
Tommi Höynälänmaa <[email protected]>
| Newsgroups | gmane.lisp.guile.user |
|---|---|
| Message-ID | <[email protected]> |
Tomas Volf kirjoitti 2.3.2025 klo 17.18: > ... > Would you happen to have some references to non-trivial code bases using > this notation? It seems interesting, so I would like to see how it > looks in real-world projects. See https://sourceforge.net/p/theme-d-intr/code/ci/master/tree/examples/, files *.th?. The code is in Theme-D but you can probably follow it if you know Scheme. Note that the notation may not be used rigorously in this project. >> [..] >> Pairs are prefixed by p, lists by l > Every list can be considered a pair, right? So l- is for proper lists, > and p- for the rest? But for example SRFI-1 talks about three different > types of lists, but still considers them "lists". Could you go into bit > more details when to use p- and when l-? Yes, l- for proper lists and p- for the rest. I have not thought about this in more detail. > >> [..] >> Procedures having no side effects and having boolean return value are suffixed >> by ?. > So unless the procedure has ->bool in it, it should not end in ?? I > fairly often write predicates that return either #f or non-#f value but > not limited to booleans. Example would be: > > --8<---------------cut here---------------start------------->8--- > (define (env-var-set? var) > (getenv var)) > --8<---------------cut here---------------end--------------->8--- > > This returns #f if variable is not set, and the (string) value > otherwise. Based on the wording above, this procedure would be misnamed > under this notation, since the name ends with ? despite not returning > boolean value? Yes. Note that many Scheme predicates (such as member, for-all and exists) that may return an arbitrary value for "true" return a boolean value in Theme-D (and are thus suffixed by ?). > > Have a nice day, > Tomas - Tommi -- Kotisivu / Homepage:http://www.iki.fi/tohoyn/ Sähköposti / E-Mail:[email protected] GPG-sormenjälki / GPG fingerprint: 55F4 2477 7155 3528 5CB2 2B7A BB86 1FDE 4046 0F83 FT, Debian-ylläpitäjä / PhD, Debian Maintainer