freenode/#lisp - IRC Chatlog
Search
13:07:30
jcowan
Question: when if ever does it make practical sense to mix &optional, &rest, and &key in a single lambda list, other than the special case of &allow-other-keys?
13:09:48
Bike
&rest and &key together is useful if you want to throw your arguments at some other function
13:14:05
jcowan
Right. I didn't think of the pass-along case, only of the crack-keys-yourself case (like structure constructors)
13:16:05
jcowan
I'm glad to hear that &optional and &key together doesn't make sense. I am evaluating a pair of macros for Scheme, which has only &rest (spelled "."), one for optional arguments and the other for keyword arguments. I was checking that it made sense to separate them.\
13:16:37
Bike
i mean the rules are consistent and everything, and the code will compile and run... it's just confusing
13:17:17
jcowan
I feel no great need to push for the standardization of functionality that serves only to confuse people. :-)
13:19:13
jcowan
in my context that would mean using the macro (which accepts a rest-list and binds variables corresponding to the keywords) as well as the raw rest-list itself.
13:19:54
pfdietz
I wonder if SBCL tries to check if a &rest arg's list is being mutated (the list itself, not the objects in the list)
13:22:00
pfdietz
It's permitted (but not required) for a CL implementation to reuse the last argument to APPLY as part of the rest list, so destructive modification of that list is a no-no.
14:05:02
pfdietz
Better to have some sort of "rest args object" from which a list could be obtained, if needed. APPLY would take one of these (or a list) as a final argument.
14:14:17
pfdietz
WHich means that list is being copied. Gets expensive with very long lists. This shows up in a programming style where one adds new :key arguments to this list down a call chain.
14:17:03
jcowan
Standard Scheme has no keys at all. The macro I'm looking at will not reject multiple uses but ignores all but the first.
14:18:30
jcowan
The signature of the macro is (let-keywords ls ((var [keyword] default) ... [rest]) body ...) where ... is postfix for iteration. Note that the variable can have a different name from the keyword, though you probably won't want that much.
14:25:36
jcowan
As I was saying, you put a newly consed object into a non-exported global variable and set that as the default: no one can pass you that object, so an eql test shows whether the keyword is missing or not.
14:28:04
jcowan
I have used the same trick for alists as poor man's objects: if the first element in the alist is (<unique> . foo), code that cares can treat it as of type foo, and to code that doesn't it's just an alist.
14:30:58
flip214
If I hang around here for some more time, I might be one of the elders... probably still not considered wise, though.
14:37:20
pfdietz
Talking about scheme to shed light on CL issues is borderline acceptable for #lisp :)
14:46:49
dim
I'm trying to find this blog post of years ago with an implementation of FizzBuzz all as a single format string in CL, does it rings a bell to anyone here?
14:48:01
pfdietz
https://www.reddit.com/r/lisp/comments/59ikqm/the_most_elegant_implementation_of_fizzbuzz/
14:52:09
dim
well there's one that might be close to what I had in mind, let's call it good enough ;-)
16:54:28
shka_
vms14: abstraction layer, this way you can TRACE access to the html-mode, you can define logging, you can do all sorts of stuff
16:57:06
Bike
that's how setf works. if it can't find an expander or anything, (setf (foo ...) bar) becomes (funcall #'(setf foo) bar ...)
16:59:26
Jachy
Maybe the answer vms14 is more simply, convention? You'll often see a get/set pair of (get-foo) and (setf (get-foo)) instead of (get-foo) and (set-foo).
17:01:29
katco
vms14: i think common-lisp.net is the canonical landing-page for common-lisp, but i agree you can't beat a curated walkthrough like you get from a book, and practical common lisp is a great first read.
17:03:15
katco
vms14: as an author who spent a lot of time away from my family and young daughter to write a book, it is distressing to hear you steal books.
17:03:47
Bike
seriously, if you say "more than you can afford" but don't mean money what are you even talking about
17:05:42
vms14
Bike: I never end a book, but nvm. I was asking for a website because I usually need to look for more info while reading a book
17:08:01
Bike
so you have the easy to understand introduction, and then the manual for the more complicated points
17:10:59
edgar-rft
vms14: you can read CLtL2 (Common Lisp the Language 2nd edition) if you want a something that covers all of Lisp, but it predates the official CL Standard by a few years, see https://www.cs.cmu.edu/Groups/AI/html/cltl/cltl2.html
17:14:22
vms14
https://www.cs.cmu.edu/afs/cs.cmu.edu/project/ai-repository/ai/lang/lisp/doc/cltl/cltl_ht.tgz
18:52:22
fe[nl]ix
phoe: can you send a pull request addressing the issues in https://github.com/sharplispers/split-sequence/issues/14 ?
20:17:41
TheWild
Lisp atoms are: NIL (an empty list), string, number and symbol. Non-empty list is not an atom. Are there other types that are built to the interpreter?
20:23:14
aeth
"number" oversimplifies things and might imply that you just have double float like some languages (which I won't name) do
20:23:25
aeth
There's actually a very elaborate numeric tower in Common Lisp and most other decent Lisps
20:23:37
asdf_asdf_asdf
http://www.lispworks.com/documentation/HyperSpec/Body/09_aa.htm http://www.lispworks.com/documentation/HyperSpec/Front/Contents.htm
20:24:48
TheWild
well, that's a lot of stuff. I forgot about functions, but I was suspecting Lisp bootstraps everything from conses or something else.
20:25:43
Bike
yeah, in really old lisps you could call conses if they were lambda expressions, stuff like that
20:26:12
phoe
but you need more stuff to bootstrap off if you want to actually be efficient; numbers and arrays are a must, and some sort of function objects to represent code.
20:26:33
phoe
with that and a little bit of trickery, you can implement hash-tables, structures and classes, and bootstrap a lot of stuff off that.
20:27:17
Bike
actually i vaguely remember reading some old lisp implementation implemented numbers as conses of digits
20:27:46
Bike
which sounds horrible, but i guess that's what a bignum is if you really think about it and are intoxicated.
20:29:03
aeth
Bike: This is the only way a Lisp should implement integers imo. https://gitlab.com/snippets/1761668
20:29:03
minion
davve: please look at pcl: pcl-book: "Practical Common Lisp", an introduction to Common Lisp by Peter Seibel, available at http://www.gigamonkeys.com/book/ and in dead-tree form from Apress (as of 11 April 2005).
20:30:08
TheWild
darn, I have to think about Lisp as a higher-level language than just three steps away from assembly. (C was one step, C++ were two ;))
20:33:28
asdf_asdf_asdf
Character "'" (quotation mark) prevent evalution value. '*my-var* it's not the same with *my-var*.
21:22:08
Younder
1994 is a long time ago. The standard became stale. No-one cared. The world moved on.
21:27:44
defunkydrummer
phoe: TAGBODY and GO like a Real Programmer would do. Because Real Programmers are able to talk in actual caps.
21:29:46
defunkydrummer
minion: memo to saravia: Portacle is a combination of Emacs with SBCL and SLIME, Emacs license you know, SBCL license is mostly Public Domain, SLIME license is Public Domain.
21:32:25
Younder
defunkydrummer, oh, just the use of got and the like in code. Of cource it is just used to use higher level constructs.
21:32:53
defunkydrummer
Younder: GOTO makes total sense for some kind of code like state machines or some parsers. It simplifies the code.
21:35:23
defunkydrummer
i've taken a look at the WuWei web framework, and it's built on Portable AllegroServe. It's a very nice framework and is actually used on a serious production system, so it has some credibility.
21:36:01
defunkydrummer
anamorphic: Wow, what a practical programming language!! I want it!! This must be the language of the XXI century!!
21:36:36
defunkydrummer
defunkydrummer: I think I'll try AllegroServer first. If I was to port it to something, I'd port it to Clack instead, and let Clack interface to Hunchentoot
21:38:22
defunkydrummer
anamorphic: Yeah, yesterday i took a look at weblocks, the problem is the authors state that the documentation isn't useful anymore since the rewrite(reblocks branch)changes the API
21:38:43
defunkydrummer
anamorphic: contrast this with Radiance, which probably has the biggest tutorial and documentation of any CL web framework
21:39:12
defunkydrummer
reblocks has the same docs of always, some of them have been updated like the tutorial, but the tutorial is very succint
21:40:31
defunkydrummer
i also took another look at Caveman2 (fukamachi), the way one defined handlers looks nice, but then... idocumentation is very scarce, and i'd get a bit scared if something doesn't work as expecte
21:50:08
vaartis
i get division by zero error although i didn't even pass anything, it's just an init function
22:01:43
aeth
Use https://github.com/Shinmera/float-features/blob/59ffb467413e25e95319b8324be2a6afc80f11c0/float-features.lisp
22:03:47
aeth
minion: memo for anamorphic: use the portable with-float-traps-masked in the library float-features https://github.com/Shinmera/float-features
22:06:50
defunkydrummer
PuercoPop: tiny simple lib with continuations and ajax. Examples' codebases look fine. Fits my purpose.
22:07:38
defunkydrummer
PuercoPop: yeah "ajax" sounds like so 2005, but good enough for some tasks, instead of going the "SPA" route
22:10:49
PuercoPop
defunkydrummer: I hate SPA's with passion, but the problem is 'continuations' and CL don't go well together afaik
22:13:42
defunkydrummer
PuercoPop: tell me more, tell me more, did it give you a fight? [Grease music]
22:24:08
aeth
PuercoPop: Oh, wow, I didn't know that all I needed to do was use IGNORE-ERRORS and then I wouldn't make any mistakes anymore.
22:30:39
PuercoPop
it is turned on precisely form *developer-mode* ^_^. But everyone has their own debugging flow
22:31:22
defunkydrummer
i'm having a pain in the ass trying to make wuwei work with the modern Portable AllegroServe which works over ZACL (AllegroCL compatibility layer)
22:31:48
defunkydrummer
because wuwei also has it's own AllegroCL compatibility layer... they clash and rock the casbah
22:37:19
defunkydrummer
well, since i don't have (yet) the money for my own AllegroCL Ultra Deluxe x64 Edition with Flux Capacitor, i think i'll pass...
22:58:07
vaartis
although i DO build it myself, the package manager just does something to it after that