freenode/lisp - IRC Chatlog
Search
15:23:39
JuanDaugherty
i assume it's just equivocation of "distributed control problem" with "distributed system framework" as the latter would make sense with the other stuff on that page
16:44:23
azrazalea
So i'm slowly inducting a co-worker into Common Lisp via evangelism. I mentioned the idea that functions (libraries and standard) tend to return useful things that might be useful unlike some other languages where the same function might return nothing or a boolean. However, for the life of me i'm brain farting on examples to link to. Can someone help me out?
16:47:37
Bike
i'm not sure what you mean. functions return things in most languages, that's why they're called "functions" rather than "subroutines"
16:48:19
azrazalea
Bike: Well, i'm getting the idea from one of the beginner books I read years ago. Either practical common lisp or another
16:50:08
azrazalea
Basically in the author's opinion Common lisp programmers tend to return things instead of just writing "void" functions which is common in many other languages. I think part of that is the combination of implicit return and considering most things truthy though
16:51:05
Bike
cl functions can return multiple values and signal errors, so the C pattern of passing in a pointer to get its value mutated while the function itself returns a boolean is right out
16:51:43
pjb
and furthermore, CL functions can return multiple values, so again, it's not usual to mutate the arguments (unless you're doing OO).
16:54:18
pjb
azrazalea: if you want to explode the brains of C programmers, show them: (block foo (mapcar (lambda (x) (if (zerop x) (return-from foo 'zero)) (1+ x)) '(1 2 3 0 5 6))) #| --> zero |#
17:16:27
azrazalea
Anyone know https://github.com/dptd btw? I want them to put a license on their stuff so I can use it in good conscience.
17:17:34
azrazalea
(they have a slack bot and slack client lib and i'd rather not implement the slack client myself just cause i'm lazy)
17:18:20
fortitude
I'm trying to debug something in qlot, and a bunch of import packages don't seem to be created until after you've called a function from the main package
17:30:54
azrazalea
|3b|: Ah, should still have a LICENSE file for legal mojo but that's probably good enough to let me use it
17:40:35
fourier
azrazalea: frankly speaking, returning stuff is a common in all languages. in haskel/ml family of languages which support pattern matching you can return things like Maybe which could either contain value or not. In c++ you have similar boost::optional/c++17 optional for the same stuff. what I can't easily find similar in other languages is return multiple values.
17:45:53
fourier
If I have a function which has couple of guardians on entrance, is it ok to implement them like (when (something) (return-from myfunc))? there are some calculations in between so i can't really easily use (cond ..)
17:50:21
fourier
it is also need to return something, not just (return-from myfunc). rather (return-from myfunc myintermediateresult)
17:52:34
dlowe
fourier: (if (thing-needs-returning) my-intermediate-result (rest-of-calculation and parameters))
17:52:35
fourier
cond + and + setq helps sometimes, yes. but i got a feeling what it make code harder to read
17:53:10
fourier
dlowe: yes but it will lead to mulptiple if-if-if statements making code harder to read
17:56:56
Bike
so your code is something like if [condition], result, else do some other stuff and then another test, repeat?
20:43:16
_death
since you're asking for style advice, my advice is to not care about functions being used only once
21:04:05
jasom
I don't care about functions being used only once; I'd much rather read (frobnicate-the-foo) than 50 lines that aren't obvious that they frobnicate the foo. However I still think return-from is fine IF the structure of your body doesn't lend itself to e.g COND
21:07:39
_death
jasom: I don't have a bad response to return-from, but following the one-function rule usually shows the better way that happens to eliminate it..
21:07:46
jasom
phoe: if you want finer grained version dependencies, either create your own dist or try something like qlot
21:08:47
jasom
phoe: (ql:update-dist "quicklisp") <-- will update *everything* in quicklisp, *or* drop a newer version of ironclad into local-projects
22:26:23
JuanDaugherty
do I correctly understand planetlisp, cliki, and whatever ql gets to be the massed lisp greatness at this point, the equiv of hackage, et al.?
23:00:39
pillton
It would be even better if the environment of a lisp implementation was stored in ipfs.