freenode/lisp - IRC Chatlog
Search
20:34:12
me`
Back in my day, we would keep our eyes open all day for a honey bee swarm. A swarm is when a nest of bees gets so large that part of the population leaves with a new queen to form a new colony.If you saw a swarm on a tree branch you could cut the branch and literally shake them off into a box so you could later have your own bee hive. But I always shook mine off into a crudley constructed wooden dildo and shove it up my ass. That's what
20:34:24
me`
Back in my day, we would keep our eyes open all day for a honey bee swarm. A swarm is when a nest of bees gets so large that part of the population leaves with a new queen to form a new colony.If you saw a swarm on a tree branch you could cut the branch and literally shake them off into a box so you could later have your own bee hive. But I always shook mine off into a crudley constructed wooden dildo and shove it up my ass. That's what
20:46:17
no-defun-allowed
(reminds me of the 4chan guy who had a bunch of snails doing a similar thing. Don't look that up.)
21:53:10
aeth
Is there any way to get just the final count of notes/warnings/errors/etc. without getting the full :verbose t in Quicklisp?
22:14:04
pjb
or you can use gensyms too: (loop #:repeat 10 #:collect 'foo) #| --> (foo foo foo foo foo foo foo foo foo foo) |#
22:15:25
pjb
Notice however that the interning of symbols is done at read-time, which usually occurs at compilation-time and that the compiler "throws away" those symbols. They won't be present at run-time (when you load the compiled files in a fresh image).
22:17:41
aeth
If loop was its own language, emacs would highlight for, repeat, collect, do, in, across, etc. Since it's just a macro you have to do :for, :repeat, :collect, :do, :in, :across, etc. if you want the highlighting
22:18:23
aeth
Complaining about keywords is like complaining about parentheses imo. Eventually you get used to the syntax and you no longer see ":foo" you see "the keyword foo"
22:19:20
aeth
on_ion: Emacs always highlights :foo so by using keywords in macros the "keyword" part is instantly apparent
22:19:40
on_ion
aeth: yeah =) but i mean for the loop to work, of course it works with keyword symbol right? silly question
22:20:05
on_ion
ah, yeah. to add similar topic, i think it is just fine if emacs were to highlight the first element of any sexp list
22:20:41
aeth
Yes, but apparently iterate doesn't work with keywords, so loop is actually better than iterate there. Everyone :uses CL so you don't really notice, but since :use on a package is discouraged, you do notice with iterate, since you shouldn't :use :iterate
22:20:51
on_ion
as for :keywords watch how i start typing english with it on the wrong :side the reckoning
22:21:46
aeth
In case I'm unclear, the only reason it's *not* inconvenient to use regular symbols in LOOP even if it only accepted its own symbols and not keywords is that you're importing every symbol from the CL package.
22:22:01
aeth
In general, you want keywords for that sort of thing if you're not going to accept symbols from any package
22:22:17
on_ion
i have a feeling that some parts of emacs, scheme or cl or slime or redshank or lisp-mode or something, does this sometimes
22:23:37
aeth
on_ion: I think it's a mistake to think of programming like writing English. It's best to think of it as its own language that happens to borrow some words from English, although sometimes the words have a different meaning (e.g. vector).
22:29:44
aeth
pjb: The parts specified in Common Lisp's hyperspec borrow some words from English, and invent some creative new words like rplaca, too
22:30:20
on_ion
'whereas for trains, car is used for elements after the engine, in the case of lisp...'
22:31:55
on_ion
(apparently when trains were big all over the world it was big things with train stations)
22:35:12
aeth
Besides, if that wasn't the case, then the caddd...dr pattern wouldn't hold. That assumes a proper list.
22:43:27
macaroni_destroy
So (make-array (1+ (expt 1024 3)) :content-type '(unsigned-byte 8)) should be sufficient to make a program that uses more than 1024MB of memory?
22:44:13
no-defun-allowed
iirc on linux it doesn't really allocate until you touch it but maybe :initial-element 0 will help
22:44:42
White_Flame
yeah, SBCL has a fixed heap size, with cmdline parameters to set a different max
22:45:49
macaroni_destroy
If I wanted to initialize each element to 0, to ensure that I use that memory, how would I do so? :)
22:45:54
White_Flame
ooh, the spec allows for undefined behavior of reading uninitialized array slots
22:47:05
macaroni_destroy
(make-array (1+ (expt 1024 3)) :content-type '(unsigned-byte 8) :initial-element 0)
22:51:57
macaroni_destroy
i'm trying to make a program that would exceed the memory limit of 1024MB for https://open.kattis.com/problems/different
22:52:39
macaroni_destroy
in hopes of passing it and a couple of variants of the program (like the accepted solution) on to the kattis team so they can add sbcl as an official language
22:55:14
macaroni_destroy
so I should be able to run the program with `sbcl mem_limit.lisp --dynamic-space-size 1024`?
23:01:03
macaroni_destroy
ok now that i have all the variants of solution to that problem -- accepted, wrong answer, time limit exceeded, run time error, memory limit exceeded, output limit exceeded, and compile error, I can get to writing up some things about what a lisp sandbox would look like for the language to work well for competitive programming
23:01:42
macaroni_destroy
in terms of compiler optimizations, are there any special flags used for speeding sbcl up?
23:05:51
macaroni_destroy
"We would also need a list of the Ubuntu packages for the language that needs to be installed, what directories needs to be available in the sandbox for the language to work well, and a reasonable set of compiler and runtime flags for competitive programming."
23:06:31
macaroni_destroy
I don't think there are any special directories that need to be available for sbcl to work well.
23:07:13
macaroni_destroy
Perhaps flags, if this is a flag, is just making sure that the heap is set to an appopriate amount, like 4096 linked above?
23:08:18
macaroni_destroy
Hmm I guess I should look up how to make a compiled sbcl program, because `sbcl --d-s-s 4096 --load memlimit.lisp` likely is only for the interpreter, right?
23:18:37
aeth
the raw link might be better for opening in Emacs: https://gitlab.com/snippets/1776926/raw
23:19:46
gendl
Hi, what is a good way to understand ASDF output-translations. I'm a bit boggled. My source directories are symbolic links, and this appears to be completely messing up the output-translations (the output-files are ending up in the hierarchy of the link target, not the local hierarchy)
23:20:42
gendl
everything was working fine until I replaced my source directories with symbolic links. I'm trying to adjust the output-translations to deal with it, but utterly failing to understand how they are supposed to work...
23:21:56
aeth
jcowan: I believe the real issue is when there's a future name conflict. So if foo now exports foobar and you already are using foobar from another package (instant import name conflict and now you have to do shadowing) or defining your own foobar (you ideally get a compilation warning, but now what happens (afaik) is you just redefined foo:foobar rather than properly having a your-package:foobar)
23:23:01
jcowan
Yes, that's name pollution: you get access to names you don't know or care about, and when you try to use them yourself, BONK (or worse yet, no error, as you say).
23:23:34
aeth
It looks like when I try to define my own factorial in a package that uses alexandria in SBCL I get "Lock on package ALEXANDRIA.0.DEV violated..." instead of a warning.
23:24:47
macaroni_destroy
no-defun-allowed: ok since java uses the following flags on kattis -XX:+UseSerialGC -Xss64m -Xms{memlim}m -Xmx{memlim}m -Dfile.encoding=UTF-8 -cp {path}
23:25:38
aeth
In ECL, I can do (ql:quickload :alexandria) (use-package :alexandria) (defun factorial (x) x) (alexandria:factorial 42) => 42
23:27:15
macaroni_destroy
no-defun-allowed going to ask them to allow sbcl to use `sbcl --dynamic-space-size {memlim} --control-stack-size 64 --script {path}`
23:29:18
gendl
ok. the issue isn't really with output-translations, it's with the system registry following symbolic links (which I guess is what it's intended to do..)
23:34:58
aeth
pjb: I was expecting the SBCL redefine function warning, but I actually got a package lock error, which I guess is even better for catching this kind of redefinition bug.
23:36:38
aeth
pjb: try (ql:quickload :alexandria) (use-package :alexandria) (defun factorial (x) x) (alexandria:factorial 42)
23:38:17
aeth
pjb: and in CCL I get #.(format nil "Using #<Package "ALEXANDRIA.0.DEV"> in #<Package "COMMON-LISP-USER"> ~%would cause name conflicts with symbols inherited by that package: ~%ALEXANDRIA.0.DEV:COPY-FILE COPY-FILE")
23:39:08
aeth
#.(format nil "Using #<Package \"ALEXANDRIA.0.DEV\"> in #<Package \"COMMON-LISP-USER\"> ~%would cause name conflicts with symbols inherited by that package: ~%ALEXANDRIA.0.DEV:COPY-FILE COPY-FILE")
23:39:40
no-defun-allowed
aeth: well LOCK-PACKAGE and UNLOCK-PACKAGE live in sb-ext, and i couldn't find any mention of package locks in the CLHS
23:40:56
aeth
no-defun-allowed: Ahah! Looks like it has "#+sb-package-locks (:lock t)" and CCL pretends to be SBCL there to also read that lock
23:41:09
aeth
https://gitlab.common-lisp.net/alexandria/alexandria/blob/408ff1d6ffd48d204b9165d175c1afb1d1dd585f/package.lisp#L4-5
23:41:33
pjb
aeth: one reason more why not use sbcl. If you can't redefine your function, it's useless.
23:42:43
pjb
ccl doesn't pretend anything: you're using alexandria in a package that has already a copy-file symbol!
23:46:43
aeth
Looks like this test could be used: (ql:quickload :alexandria) (defpackage #:foo (:use #:cl #:alexandria)) (in-package #:foo) (defun factorial (x) x) (alexandria:factorial 42)
23:50:21
aeth
pjb: So you're basically saying "Just perfectly understand the full system and everything is fine"
23:51:09
aeth
My point is, in modern software, even in CL, it's impossible to understand the entire environment you're using.
23:53:07
dim
it's more than we assumer our coworkers and lib authors to not be adversarial, in general
0:21:39
aeth
So I'm thinking about doing this for types for destructuring binds: (:destructuring (foo bar (baz quux)) (fixnum cons (integer vector)) list)
0:22:57
aeth
T would mean don't check-type/type-declare that particular thing (i.e. it's of type T). NIL would mean that part of the destructuring bind has no check-type/type-declare. So (foo bar nil) would be valid as would nil, but (foo bar t) or t would be invalid for that particular example.
0:27:07
aeth
For options what I'll probably do is have a special (:options ...) item as an optional first "binding" so you can configure between check-type or type declarations. So it could be: (with-bindings ((:options :check-type t) (foobar integer 42) (:destructuring (foo bar (baz quux)) (fixnum cons (integer vector)) some-list) (:values (x y) (integer double-float) (floor 42.5d0))) ...)
0:28:27
aeth
The downside with this new flatter syntax (the old style would have been ((foobar integer) 42)) is that if you just want the ultra-binding with no types you'd have to say (foobar nil 42) or (foobar t 42) but I guess that means yet another macro, then. (6 total, then?)
0:30:30
no-defun-allowed
ACTION uploaded an image: Screenshot_2018-11-12_11-25-23.png (35KB) < https://matrix.org/_matrix/media/v1/download/matrix.org/iTMDfIWxvHpKVsexcaXNPoao >
0:30:33
aeth
Oh and I think I'm going to go with (:values (x y) ...) instead of my original idea of copying SETF and using ((values x y) ...) just so there's a clear distinction between regular bindings and bindings that are fancy, i.e. each binding either begins with a symbol (treat it like a typed let) or a keyword, where the keyword is the fancy type of binding
0:32:56
aeth
So you can't actually implement Common Lisp on a 16 bit machine using traditional implementation techniques, but the minimums are essentially made with 16+ bits in mind, not 32-64
0:34:32
aeth
I'm guessing at the time they assumed there'd be 16-bit microcomputer Lisp machines that were actually at least 17-20 bits?
0:36:44
aeth
Strange that they didn't raise the minimums in the 1994 standard, or if they did that they kept them so low.
0:43:54
aeth
I think the correct thing to do is to have three separate standard minima, for each bit size: 16, 32, and 64.
0:44:33
aeth
Then you only need to know that you're using a 64-bit implementation and can then safely assume that e.g. docstrings can be longer than 1024 characters long
1:14:58
elderK
Going to rewrite my "epidemic" thingy today. To apply some of the feedback you guys gave me.
1:15:29
elderK
It'd be nice for instance, if I had a conditional increment, without having to write when all the time.
1:38:08
jcowan
aeth: Scheme set the minimum fixnum limit to 24 bits, but that only affects the correctness of fixnum-specific operations, it does not constrain things like the sizes of strings. I wasn't there, but I assume 24 bits = 32 bits/word - a maximal 8-bit tag.
2:17:24
loke`
elderK: Well, that's your problem right there. How else would you do Lisp development without an easy way to compile functions, etc.
2:18:40
loke`
I can't even imagine what a nightmare it would be to develop in Lisp without Emacs. How would you even do it? You'd end up writinf code, and then manually load and compile eveeyr time. Probably restarting the runtime over and over again.
2:19:21
elderK
LdBeth: Now that I've defined a couple macros, is there anything special I need to do to make sure like, everything works? Like, I've heard of eval-when.
2:20:18
aeth
jcowan: In CL, I think that "everything" in this category (e.g. array indices) has to be a fixnum and these things are normally positive, so in effect if fixnums are 2 ^ n then the upper bound for things like array-total-size-limit would be 2 ^ (n - 1) - 1. In SBCL, array-total-size-limit is 2 ^ 62 - 3. In CCL, though, it isn't anywhere close to the theoretical maximum iirc.
2:22:05
LdBeth
elderK: it's usually a good practice collecting macro definitions in one place and load them first
2:22:35
aeth
In practice they seem to have given extra room, so e.g. array-total-size-limit is 2 ^ 10 even though most-positive-fixnum has to be at least 2 ^ 15 - 1
2:24:28
aeth
You only need eval-when for helper functions called by defmacro located in the same file as the defmacro iirc.
2:24:37
macaroni_destroy
welp submitted this to kattis team. hope they will add sbcl https://github.com/optimisticlisper/kattis_sbcl_different
2:25:11
no-defun-allowed
aeth: regarding the gitlab-ci stuff, you may not need git since it clones into a subdirectory of /builds/
2:25:40
LdBeth
aeth: in CCL not warp macros in eval-when could cause problem expending macrolet form
2:25:58
aeth
no-defun-allowed: instead you can just ln -s that directory to make sure it shows up in ~/quicklisp/local-projects/
2:26:22
aeth
no-defun-allowed: I think that git is used in the recipe so that you can have dependencies that require being downloaded from git.
2:30:13
LdBeth
the example is (some-macro (macrolet a b c)) where the argument form is just a list of symbol but ccl tries to expand it if some-macro defined in the same file is not warped in eval-when
2:30:40
aeth
no-defun-allowed: I would probably just comment out the part that requires git rather than removing it because once you need to load a dependency that is either not in Quicklisp or newer than the latest version in Quicklisp you're going to need it back in.
2:34:28
aeth
LdBeth: Perhaps there's a problem with order where if a defmacro foo is located below where it's used in the file CCL complains?
2:34:44
aeth
LdBeth: I definitely use macros in the same file where I define them all of the time with no problems
2:49:38
LdBeth
aeth: the actual situation is a little complex, the problem occurs when I use a custom code walker that idex symbols after macroexpand, and somehow ccl treats macrolet differently than sbcl that it tries to expand that form
2:55:10
LdBeth
Bike: function-information or something on ccl give different thing for macrolet than sbcl
3:39:33
aeth
elderK: If I'm understanding your problem correctly, you want a do that runs the body at least once, even if it would initially terminate. So (do () (t) (format t "Hello~%")) doesn't print "Hello~%" even once but you want it to show up once, correct?
3:39:34
elderK
So far, I've just been making sure my functions are reasonably small, so easy to "analyze". But, I have a bug now where stepping would be useful.
3:40:23
elderK
I'm using some hand-rolled macros this time around too, although I'm not sure how much they're contributing. :P
3:41:18
aeth
elderK: That's as trivial as this: (defmacro foo (varlist endlist &body body) `(progn ,@body (do ,varlist ,endlist ,@body)))
3:41:41
aeth
That will work just like (do () (t) (format t "Hello~%")) but it executes the body once at the start.
3:42:17
aeth
Naming it, however, is harder. Do isn't a while loop... it's sort of a not-while loop, so do-while would be misleading.
3:44:17
aeth
Oh, not quite as trivial as I said because you'll also want a let for the bindings in the varlist
3:47:50
aeth
If you wanted to use do* instead of do you could (afaik) avoid all of these issues with (defmacro foo (varlist endlist &body body) (let ((gensym (gensym))) `(do* (,@varlist (,gensym ,@body)) ,endlist (declare (ignore ,gensym)) ,@body)))
3:59:48
elderK
When should I use values to return multiple things, instead of just using a cons to return two things?
4:01:00
|3b|
if you always need both things, and usually want to keep them around for a while, it might be worth putting them in some data structure
4:01:35
|3b|
if you usually want 1 of the things, but sometimes need the other and have to calculate it anyway, use VALUES
4:09:44
elderK
Also, out of curiosity, is the "in things" evaluated once at the beginnign of the loop? Like, if I add more things to the list I'm moving over, will loop handle that?
4:10:38
|3b|
there are some specific modifications you are allowed to do, so check specs if it matters
4:11:28
|3b|
usually if i want to iterate a changing list i do something like (loop with tmp = list for x = (pop tmp) while tmp ...) or similar
4:13:47
|3b|
modifying the car of a cons doesn't change the structure of any lists it is part of, i think that is allowed while iterating a list
5:04:58
|3b|
you can destructure result of multiple-value-list though, at the expense of probably consing
5:05:44
|3b|
(not sure if any of the loop implementations in general usage optimize that out or not, i think sacla LOOP does)
5:26:38
beach
It is important to read those Common Lisp HyperSpec entries, because the Common Lisp language is not defined by what an implementation accepts.
5:32:20
|3b|
ACTION hadn't thought about it previously, but i guess you could put loop-finish in a for = clause to terminate early for some of the cases where mixing them would be convenient
5:34:55
elderK
So it's okay to use a loop without actually like, doing any looping? It's ability to like, destructure stuff is very, very useful.
6:08:54
elderK
:) Are there any like, libraries or something worth studying to see how to do binary-IO well in CL? Say, parsing image formats and stuff?
6:09:31
elderK
I've been pestering you all a lot today, so, I just wanted to say thanks. You guys have helped me so much, and have made jumping into Lisp much more enjoyable than it would be otherwise.
6:10:21
on_ion
this one -> https://www.reddit.com/r/lisp/comments/6uc0s2/pngload_fast_and_fully_conforming_png_decoder_in/
7:33:10
flip214
help, please. slime git HEAD, sbcl git HEAD, and I get a message "invalid number of arguments: 5" but with an unusable stack trace.
8:05:21
flip214
well, the CREATE-REPL seems to cause it in some way. don't think that vlime is at fault per se
8:08:20
flip214
sadly, (TRACE "SWANK") or similar only leads to Help! 11 nested errors. SB-KERNEL:*MAXIMUM-ERROR-DEPTH* exceeded.
8:21:02
flip214
even a (sleep 3600) or (loop) in close-connection% (I planned to attach via GDB) doesn't work as expected
8:24:33
flip214
hmmm, #+(or) before (defun monkey-patch-stream-printing ...) makes it look okay again
8:29:44
flip214
luis: contrib/swank-presentation-streams.lisp (defun monkey-patch-stream-printing) for sbcl