mastodon.scot is one of the many independent Mastodon servers you can use to participate in the fediverse.
A server intended for (but not limited to) users in Scotland or who identify as Scottish.

Server stats:

2.2K
active users

@ksaj @praetor@social.sdf.org

Is this some elaborate joke that I'm missing? What language is this, FORTRAN with brackets?

What on earth would be wrong with, say,

(defun da (years months)
(case years
(0 (* (/ months 12.0) 15))
(1 (+ 15 (* (/ months 12.0) 9)))
(t (+ 24
(* (- years 2) 5)
(* (/ months 12.0) 5)))))

@simon_brooke @ksaj @praetor what is wrong, you asked?
1) It is not C. no need to use `12.0` when `12` is just fine.
2) (da -1 2) => 9.83333 🤦
3) why use `t` when `otherwise` exists for the sole purpose of using it here.
```lisp
(defun dogs-age (years months)
"Returns the human age equivalent of a dog given its age in years and months."
(assert (<= 0 years months))
(case years
(0 (* (/ months 12) 15))
(1 (+ 15 (* (/ months 12) 9)))
(otherwise (+ 15 9 (* (- years 2) 5) (* (/ months 12) 5)))))
```

Simon Brooke

@nsrahmad @ksaj @praetor@social.sdf.org why use `t`?

Because my training is in logic, and `t` is an expression which is always true;
Because I've been using it for the past 42 years and see no reason to change;
Because it works in more or less any dialect of , not just "Common" Lisp (but note that uses `else` rather than `otherwise`, and Portable Standard Lisp, just to keep you on your toes, uses `NIL`, while uses nothing at all)!

In short, because.

@nsrahmad @ksaj @praetor@social.sdf.org (it's also worth pointing out that, for people who don't use English as their first language, `otherwise` makes no more sense in this context than `t`, and, being an irregular special case, much harder to remember)

@simon_brooke @praetor Why did you choose `case` over `cond` in your example? (it is a trick question!)

@nsrahmad @praetor@social.sdf.org because it's a macro which wraps `cond`, but adds legibility.

@simon_brooke @praetor So you will use anything that adds legibility over something that works more or less in any dialect of lisp. I rest my...

Wait, this is getting ridiculous. This was my first post on mastodon BTW. as an aside, `otherwise` is even weirder in Common Lisp, It only works in `case` and it's variants, you can't use it in `cond`.

@nsrahmad @praetor@social.sdf.org aye, it's a special case. Common is such an ugly bastard of a language that I rarely use it. So many of its features are just objectively bad, or else are the result of dirty politics. I had a very small part in the European end of the standardisation committee, and it left me with a profound distaste for the language.

@simon_brooke @nsrahmad @praetor Out of curiosity, what do you use instead of CL (if still using lisp)?

@mapcar @nsrahmad @praetor@social.sdf.org . It, too, has many flaws; but I think it's the best Lisp in widespread use now.

@simon_brooke @mapcar @praetor I still use CL. Somehow its overall attitude matches my own attitude.
Like in this particular case (introducing "otherwise" or "else"), Clojure's attitude seems to be "introducing a whole symbol just for this singular purpose, Nah". while CL's attitude seems to be "One more symbol, who cares". I tend to side with CL.
But the practical reason is, I do more exploratory programming than webdev. If its the other way around, I would use clojure.

@nsrahmad @mapcar @praetor@social.sdf.org I very much dislike special cases. A language should be clean. It's also not English and shouldn't pretend to be. But has a similar noise keyword, `:else`, for `cond`, and while `true` still works, of course, Clojure's static analyser, whines if you use it.

Furthermore the JVM stack is horrible, and Clojure's 'simplified' syntax for arg lists, cond statements, let bindings and case is... sub-optimal, in my opinion.

So you takes your pick.

@simon_brooke @nsrahmad @praetor > It's also not English and shouldn't pretend to be

I have this hunch that there is a deep connection between language and cognition. I think part of lisps appeal is actually that it feels (to me at least) much more like plain language than languages that uses a lot of specialized syntax. Just a small thing like allowing dash rather than underscore makes a difference, I think.

@nsrahmad @simon_brooke @praetor I feel similarly, there are many things I like about CL, but my sentiments are also somewhat historical. I could see myself liking clojure, but I have so far not really have had neither the energy or the usecase to really dive into that.

Having done a fair amount of scheme in university, I must say that I very much prefer CL, I am much too practically oriented to live with sillyness like nil =!= false.

@nsrahmad The above code works in any dialect of Lisp. Scheme is not a dialect of Lisp.

@simon_brooke @praetor