3 ms·
Except for lisps, few languages let you name functions/variables using dashes and other symbols but looks like any legal name in Clojure is fair game: func
by scardine 8y ago
Except for lisps, few languages let you name functions/variables using dashes and other symbols but looks like any legal name in Clojure is fair game:
function people-eq?(p1 p2)
if p1 == p2 then
println("Are Equal!")
else
println("Not Equal!")
end
end
Interesting.
- stingraycharles 8y agoYes, a common pattern in Clojure is to name your lookup functions like (defn user-id->foo [user-id] ...) Which allows for quite readable code when using it.
- lispm 8y agoCommon Lisp allows arbitrary names via escaped symbols: CL-USER 2 > (defun |this is a multiline symbol with whitespace| (a b) (+ a b)) |this is a multiline symbol with whitespace| CL-USER 3 > (|this is a multiline symbol with whitespace| 20 22) 42
- Areading314 8y agoAnd people wonder why it never caught on...
- kovek 8y agoThen variable names can be very self-descriptive! Looks useful to me
- sbjs 8y agoThat seems to be because they use whitespace as commas (look at the parameter list). It also means you can't write "a - b" as "a-b" because the whitespace is now required. I can remember many times that I have typed "a-b" or "a+1" so I wouldn't be able to write in my natural style in this language. Maybe I'm wrong for using that style in the first place, but I think languages should be a little more permissive with style preferences like this.
- totalperspectiv 8y agoPerl6 allows scewer casing like that.
- lizmat 8y agoIn Perl 6, this is usually called `kebab-casing`, instead of `skewer casing`.