freenode/#lisp - IRC Chatlog
Search
17:23:14
White_Flame
Xach: a make.sh that does rm -rf ~/.cache/common-lisp covers a great many compile-time sins :-P
17:31:55
White_Flame
well, that is the definition. It's sort of like C where anything non-zero is true, and zero is false (might not be correct to the C standard, but that's what's functionally done)
17:40:24
White_Flame
afair, readline isn't used at the plain terminal due to licensing incompatibilities
17:53:42
jasom
iekfkk: even if you don't use emacs as your editor, it's good to use SLIME as your REPL. I developed lisp that way for many years.
18:34:46
jasom
iekfkk: it's also idiomatic to define dynamic variables (similar to globals in other languages) with asterisks on the side *like-this*
18:36:49
White_Flame
for LET, function parameters, etc, you can't use T either as a local variable name
18:37:22
jasom
it's mildly annoying when writing parametric functinos where t is conventionally used, but otherwise not a big deal
18:39:49
jasom
iekfkk: according to wikipedia it comes from kinematics where the equations are parameterized on time
18:40:11
iekfkk
ahh math ok of course math was what i was thinking especially matrix A,B vs a,b small letters CL doesn't differentiate
18:41:03
jasom
_death: right but for math it often is just "people use t in this equation and it only stands for an abstract value" that's the only time I'm ever bothered by not having t available
18:41:45
jasom
and even then it hasn't bothered me enough to shadow cl:t so obviously not that big a deal
18:43:37
jasom
iekfkk: ":" is the package separator if you want to have a variable that contains ":" in the name you need to quote it e.g. |C:X| or c\:x
18:44:33
White_Flame
ACTION greps for "stupid" in his codebase and gets hundreds of lines of very ... verbosely named variable names & functions
18:45:03
specbot
Character Syntax Types: http://www.lispworks.com/reference/HyperSpec/Body/02_ad.htm
18:45:37
jasom
anything that's a "terminating macro char" can't be used unquoted as part of a symbol (and therefore as a variable name)
18:46:18
jasom
anything that's a "non-terminating macro char" (i.e. just #) cannot be used unqouted at the begining of a token
18:48:01
specbot
Valid Patterns for Tokens: http://www.lispworks.com/reference/HyperSpec/Body/02_ce.htm
18:55:52
jasom
iekfkk: yesl when I said you can't use "T" as a variable name, I actually lied. variables are named by symbols, not strings. COMMON-LISP:T is not allowed, but MY-PACKAGE:T *is* allowed. When you import most symbols from another package, but exclude a few, that's called "shadowing"
18:57:42
jasom
that being said, be kind to anybody who might read your code down the line, and don't shadow T. It will only confuse them.
19:01:31
jasom
you can use readtables to get case-sensitivity, but that is rarely used, and when I've seen it used usually case is inverted so "t" would be true and "T" would be free for use. If you do case preserving rather than case inverting your code looks like (DEFUN foo (bar baz &REST r) (LET (b) (CAR baz)))
19:07:40
White_Flame
iekfkk: also, #clschool is another channel that focuses on beginner answers. Complete answers are normally found here :)
20:30:19
mfiano
(multiple-value-bind (first-value second-value) values (declare (ignore first-value)) second-value)
20:47:19
White_Flame
(second (multiple-value-list (func....))) appears to be non-consing in sbcl when optimizations are cranked
21:33:38
VincentVega
Do compilers optimize away asserts on low safety levels? Or under some other conditions? I am thinking of replacing an assert with a when + error, because I want to signal a specific condition and not just simple-error, but it's in a somewhat intense place, so I am a bit unsure if I should do that. Tips?
21:38:55
Alfr
Maybe if the compiler can prove that it's always true, but otherwise it need to be checked.
21:39:18
White_Flame
you can always make your own compile-time decision whether or not to include checks with macros
21:40:08
White_Flame
I've made a bunch of this sort of thing where the flag can be compile-time off, runtime selectable, and depending on the flag's value per-situation checked
21:42:03
VincentVega
_death: gee, skimmed the page for it 3 times, only now I see that it's datum, thanks!
21:50:05
White_Flame
set it from the repl before recompilation to change between compile-time & runtime
21:51:06
VincentVega
Gotcha. Was hoping for maybe some sort of an asdf-level thing on system-load, but I guess this works too.
21:52:09
White_Flame
I've built way too many things to count, that ended up already being in, or eventually created in, asdf or alexandria :-P
21:53:09
White_Flame
but yeah, for this sort of thing we tend to have tons of debug tests that are either too huge on the logs to be readable, or too heavy on inner loops to keep on all the time, so flexibility is nice
21:56:04
phoe
_death: "you can give assert a condition to signal" an actual condition? isn't it just an error with a customizable report?
22:11:27
specbot
Condition Designators: http://www.lispworks.com/reference/HyperSpec/Body/09_aba.htm
22:30:44
mfiano
Actually, the Norvig/Pitman LUV slides recommend using ?/! if you are to be consistent in your naming.
0:33:06
Gnuxie[m]
Using something earlier in the form in one of the pairs and not wanting the updated place
0:38:21
Josh_2
well they aren't all that different, seems similar to let and let*, one guarantees the order, the other doesnt
0:40:07
Bike
let* guarantees that bindings take place in an order. let guarantees that bindings do not take place. similarly, setf guarantees that one assignment takes place after the other, and psetf guarantees that they don't
0:40:49
Bike
well, rather than assignments taking place, psetf guarantees that all values are evaluated before any assignments take place
0:51:28
Gnuxie[m]
I would be very cautious to assume an efficiency guarantee from anything like this, even if there did exist one
0:53:29
Gnuxie[m]
Mostly because it's a waste of time to think about, and will rarely ever be considerable enough to count even before considering how idiomatic it is
0:57:56
Bike
setf and psetf aren't competing, or something. they just do different things. if you asked whether lists are better than arrays i'd be like, well, depends on what you're doing. same principle
1:14:01
aeth
Use it when you don't need to do something fancy, too. It tells the reader that in this gigantic list of like 10+ PSETFs, none of them are supposed to depend on another (and it prevents the programmer from introducing a bug that accidentally does so)
1:14:27
aeth
You probably want to default to PSETF because you normally don't want dependencies between lines in a multiline SETF
1:29:13
aeth
(* Default to using PSETF when there's more than one form. Otherwise, SETF is the simpler form. So there is a bit of stylistic complication.)
2:33:26
Bike
oh, and psetf always returns nil, which is pretty useless, unlike setf which returns the last stored values, which is sometimes useful
2:41:05
Bike
this will not include variables that are proclaimed special but not bound, as by (defvar *whatever*)
2:41:40
Bike
if you want variables in the cl-user package specifically, you can use do-symbols or do-external-symbols instead
2:47:03
aeth
So it should be phrased as: If the is just one set, use SETF. This sometimes has a useful return value, too. If there is more than one consecutive set, then unless you need the dependency between them, prefer one PSETF over one SETF (and especially over many SETFs in a row).
2:49:18
aeth
(setf x 42) (psetf x 42 y 53 z 64) (setf x 42 y (+ 11 x) z (+ 11 y)) ; extra caveat: always linebreak... this is one line just for IRC
3:40:46
antonv
hi, does anyone know how to use rowsell for Travis CI today? It fails to install using the install-for-ci.sh (https://github.com/roswell/roswell/issues/463)
3:44:14
ozzloy
Bike, i just did (length (let ((res (list))) (do-external-symbols (sym *PACKAGE*) (when (fboundp sym) (push sym res))) res)) and got 0
3:45:13
ozzloy
i read that it is the default. when i evaluate that, i get #<PACKAGE "COMMON-LISP-USER">
3:45:44
Bike
and is your method named by an exported symbol of cl-user? or, more likely, did you not export it, or define it in some other package?
3:46:52
ozzloy
i'm looking to find all defvar'd and defun'd things, not necessarily things that have been exported
3:47:47
ozzloy
i'm getting a feel for it. seems like it's analogous to a package in java, or a module in racket, etc
3:48:49
Bike
packages are namespaces, so it's similar to some other languages, yes. although you should keep in mind it's strictly a naming thing. for example functions don't "belong to" packages, only their names may.
3:48:49
ozzloy
hmm... when i do all symbols, i get 14150 things. is there a way to see just the ones i've made during a session?
3:49:26
Bike
anyway, so symbols are divided into these namespaces. the namespace you start out in, cl-user, is not something made for an external interface, it's more for messing around in the repl in.
3:49:46
Bike
do-all-symbols iterates over all symbols in all the packages. do-symbols and do-external-symbols only iterate through the symbols in one package.
3:50:14
Bike
(there are also symbols that are not in any package, but they don't usually name global variables or functions, so i'm skipping that)
3:51:00
Bike
there is no particular way to see just what you've defined. a problem with that is that functions newly defined since the lisp started up may include e.g. IDE stuff you didn't define yourself
3:52:34
Bike
(let (c) (do-symbols (s "CL-USER" c) (when (eq (symbol-package s) (find-package "CL-USER")) (push s c))))
3:52:58
Bike
this will collect symbols that are (a) accessible from the cl-user (repl) package, and (b) are not part of some other package
3:53:12
Bike
for example your do-symbols form will include every symbol in the CL package, which is accessible from the cl-user package
3:59:39
ozzloy
i mean, i guess the operator is named "1+" and so it is still prefix... but the "+" though!