freenode/#lisp - IRC Chatlog
Search
9:40:03
jmercouris
for boolean variable naming, what convention is favored by yourself or the community?
9:40:03
minion
jmercouris, memo from beach: Because it only removes from the end, whereas subseq can simultaneously remove from the start and from the end.
9:40:34
jmercouris
beach: however, I can't imagine myself remembering the spec so well and keeping that in mind
9:55:09
flip214
who's maintaining 5am? I've got a feature request resp. bug report: when PARSE-INTEGER reports an error, :START isn't taken into account - so 5am happily reports "no digits in string "1234...""
10:00:49
varjag
is there a way to associate compilation in certain buffers to certain SLIME connections?
10:05:05
scymtym
flip214: i see. do you know where that happens? i couldn't immediately find any references to PARSE-INTEGER in 5am's code
10:07:01
jmercouris
for boolean variable naming, what convention is favored by yourself or the community?
10:10:28
scymtym
flip214: SBCL has both error messages: (parse-integer "12345" :start 5) => "no non-whitespace char…" (parse-integer "12345-" :start 5) => "no digits in string …"
10:23:38
flip214
scymtym: yes, just reproduced that. sorry for the bad error report, that comes from trying to offload things -- my recursion depth was nearly exceeded.
10:48:55
jmercouris
jackdaniel: here is a question for you, (a counter argument I heard), P stands for predicate, and predicates are only functions, is this true?
10:50:42
jackdaniel
in semantics (at least in Polish language) predicate is either an expression or result of such expression
10:55:35
aeth
Since things are generalized booleans, not even type information will help you when it comes to trying to figure out intent
10:58:29
aeth
symbol-macrolet and with-accessors exist so there's often a blurry line between variable and function, anyway.
12:48:47
jackdaniel
you put the prompt after them and press backspace repeteadly until all parentheses are deleted
12:51:53
random-jellyfish
I just want to delete the pair of parentheses that encloses the content, but not the content
12:53:45
jmercouris
random-jellyfish: you could use paredit to do that, though I believe it has problems in the REPL
12:54:41
jackdaniel
here's how I do that: I put prompt after the expession enclosed with parens, I press backspace and navigate after the first paren
13:05:17
jmercouris
shka__: slime-scratch? can you expand on that? a google search yields gibberish results
13:06:37
shka__
it is like emacs scratch buffer but instead of evaluating emacs lisp it is for evaluating common lisp
13:22:19
jackdaniel
while I'm sure many people would be delighted to have it I wouldn't load such contrib myself, hence loading it by default may be a bit problematic (for me)
15:34:55
random-jellyfish
I get error ; in: DEFUN DICE2 ; ((RANDOM 6) (RANDOM 6)) ; ; caught ERROR: ; illegal function call ; ; compilation unit finished ; caught 1 ERROR condition WARNING: redefining COMMON-LISP-USER::DICE2 in DEFUN
15:38:02
dlowe
if you use VALUES, your function will return two numbers. Calls that don't expect two numbers will only get the first
15:39:52
dlowe
It's literally that functions can return more than one result, without wrapping it in a intermediate structure
15:40:24
dlowe
it's more akin to returning a tuple in python and then doing a deconstructing assignment
15:43:02
dlowe
You can do the analogous thing in CL with (destructuring-bind (a b) (list 1 2) ...) but it's not as useful
15:43:28
jmercouris
is there a way to recompile a defpackage form after you've removed some symbols you previously exported?
15:45:05
jmercouris
somehow adding exported symbols is OK, but if you delete some, SBCL loses its mind
15:46:14
Bike
this also applies to other package alterations sbcl complains about. nothing defpackage does is impossible to do outside of defpackage
15:47:35
jmercouris
maybe it would be another style to export symbols directly after they are defined
15:47:59
jmercouris
like if they have a defun they want to export, they have the export right next to it
15:48:24
sjl_
cl-annot does something like this. I don't personally like it, but I guess some people do https://github.com/m2ym/cl-annot
15:51:38
sjl_
I personally prefer the one-big-package.lisp-file approach. I like that it makes you lay out the API of each package explicitly in a single place. I like that I know where to go to see a quick overview of a package's API, rather than having to grep through source files for `export`
15:53:37
jmercouris
I do that usually, but I'm working with a caveman2 skeleton project and trying to understand/adapt to Eitaro's style, I may just nix it in the end and go back to the package.lisp approach
15:54:43
jmercouris
its just that before I completely discount something, I like to at least try it and understand
16:04:17
markasoftware
i have an array of :element-type 'boolean. However, each element is taking up many bytes of memory (maybe 8?) in sbcl. Is there any way to decrease this memory usage to 1-2 bytes per element?
16:06:39
sjl_
not if you want to keep the elements as booleans. A boolean in CL is one of the symbols T or NIL, SBCL uses a pointer to refer to the symbol.
16:07:55
aeth
I use bits with (zerop foo) and (= 1 foo) and flip the bit with (if (zerop foo) 1 0) etc.
16:08:28
aeth
I guess there's nothing stopping an implementation from using booleans and storing them as bits, and wrapping every access in a conversion, but I don't think any do.
16:15:56
sjl_
I'm sure it's possible, but yeah, I don't think any implementations do it. Generally if you say "I want to store X" it will use a scheme that actually does store X.
16:16:09
Xach
markasoftware: a bit vector would be more compact in memory at the cost of some interpretation of the values as booleans.
16:43:39
aeth
Yeah, I use bit vectors in my prime sieve which is used for quite a few Project Euler problems. And that's a place where bits-over-booleans really, really matter.
16:44:27
aeth
I could probably cache the primes, but then that would go against the spirit of trying to do things in < 1 second if possible.
17:22:40
sjl_
Yeah, for Euler I sieve and store the primality of the first 100 million odd numbers in a bit vector, and use miller rabin to check primality for numbers larger than 200000000
17:27:48
aeth
Interesting. I turn my sieve into a simple-array fixnum afterwards. Maybe I should hold onto the intermediate bit vector somewhere.
17:32:59
sjl_
There are ~11,000,000 primes below 200,000,000. With an array of (unsigned-byte 64) that's roughly 80mb to store them all. If you store the odd numbers below 200,000,000 in a bit vector that's ~11mb, and lookup is (aref v (ash n 2))
17:34:56
sjl_
But I still think the bit vector method uses less space, and the lookup is O(n) instead of O(log(n))
17:38:48
sjl_
honestly now that I have a machine with 64gb of RAM I should probably be a little less stingy on the precomputation. Though mostly it's annoying that it takes a while to quickload the system. I should probably make it so the primality array gets compiled into the FASL so it can load without recomputing it every time.
17:43:33
sjl_
friend code 48257_AAgoR50jsmK1HqPwtcQJZV9iqzIuk6ay if any other Lisp people do Project Euler
19:20:41
blackswan
because that's the number of apparently unique repositories referenced on the first two pages when i search for "tetris lisp"
19:54:51
aeth
If I wrote a falling tetromino game I would make sure that no one confuses it with Tetris®, the property of the notoriously litigious The Tetris Company