freenode/#lisp - IRC Chatlog
Search
1:49:05
dmiles
its hard to know the differnce between the meaning of balls to the wall with type information vs what the anyhting else would mean
1:56:16
dmiles
and (ftype (function (fixnum) fixnum) fib) means.. but the lack of ftype and different numbers than the above.. also this sometimes only is meaningfull for compilation
3:16:48
stylewarning
I have some exciting news. We have some scientific simulation code in Lisp that beats C++, where the C++ code has non-standard Intel ISA SIMD intrinsics.
3:19:36
stylewarning
fouric I think I’ll write up a note about it, because there are some lessons to be learned
3:19:45
asarch
It says I need to load the library (asdf:load-system ’clim-examples) (clim-demo:demodemo) in order to run the examples
3:20:40
stylewarning
To cut to the chase: if you’re just going to write loops, you’re not going to beat C, but what you might be able to do is take advantage of the fact that many C codes are more dynamic than many think
3:20:47
beach
asarch: It probably doesn't matter much what implementation you use. SBCL generates better code though.
3:21:28
beach
asarch: But SBCL is not an "interpreter". We call it an "implementation". SBCL compiles each interaction form to native code before executing it.
3:22:01
fouric
stylewarning: i have a school-friend who is performance-obsessed and insists that efficiency is the most important thing in any programming language or system
3:22:35
stylewarning
fouric, unfortunately it’s closed source, but in any event, it’s also full of complex quantum mechanical calculations
3:23:48
beach
asarch: It looks like ASDF is not bundled with CLISP. It is with almost every other implementation.
3:24:29
beach
asarch: McCLIM uses a lot of generic functions. I am not so sure about the performance of CLISP on a program that heavy on generic dispatch.
3:26:18
stylewarning
fouric, your friend seems like he or she needs to be convinced that almost never to-the-metal performance matters
3:26:29
beach
asarch: There are not McCLIM-related problems. You would have the same problem compiling just about any software.
3:27:53
beach
asarch: You should also install Quicklisp. And it is highly recommended that you then follow the Quicklisp instructions for installing SLIME.
3:30:49
astronavt
what's the idiomatic lisp way to say "if x is not nil, return x, else return <some default>"?
3:32:47
beach
Here X is something else with a default value of NIL. NULL is used to test whether it has the default value.
3:33:20
stylewarning
I used to think what you thought, then came to the conclusion that idioms can be a little bit informal, and as long as idioms are understood, they don’t cause much harm
3:34:22
astronavt
that's almost exactly what i wrote, modulo (null _) instead of just checking for nil directly
3:35:06
beach
astronavt: I have already stated my opinion, which is based on the Common Lisp style guide by Kent Pitman and Peter Norvig.
3:35:47
stylewarning
astronavt: you could use a macro like WHEN-LET from Alexandria, or you could do the crazy thing I suggested and write (or (getenv) “default”), which goes against the above advice (but I personally find perfectly clear)
3:38:31
beach
astronavt: By the way, it is a good rule to always test for the special case in code. That way the maintainer can remove those cases from his or her mental set of issues while reading the rest of the code. That is another reason to start testing for X being NIL.
3:40:32
astronavt
beach true. in some sense, the "special case" is having X be set (i'm testing for an environment variable)
3:41:57
beach
stylewarning: I guess I do. Never considered using singular they. But I haven't lived in an English-speaking country for 30 years.
3:45:55
beach
Hmm. Not quite true. I spent a year in Austin and a year in Auckland during those 30 years. Still, that was 15 years ago or so.
3:51:05
astronavt
where can i read up on how lisp handles paths? im surprised to see that "home:filename" gives me "$HOME/filename"
3:53:30
astronavt
thanks... and what's the right way to search through the CLHS? download it and use Grep?
3:57:52
astronavt
so there has to be a search tool *somewhere* right? or at least download the source? i mean i could use an excuse to get my hands dirty with PageRank and web scraping...
5:19:52
borei
i have function that can return list of 2 lists, or i can make it returning 2 values - list1 and list2
5:29:46
pjb
multiple-value-bind multiple-value-setq multiple-value-list multiple-value-call (setf values), etc.
5:31:48
aeth
It's an oversight in the never-changing-again spec to not have let assign multiple values like setf. multiple-value-bind can nest deep
5:34:11
aeth
And as for returning, if it's fewer than 5 items, and it makes sense to do it, multiple values can work. Especially 2. decode-universal-time returns 9, but that's the only one I've encountered that returns that many values
5:36:37
aeth
Yeah, imo multiple return values makes the most sense when there are two values returned and the second is optional, e.g. the second value in hash table retrieval or the remainder in rounding operations like floor... but it definitely makes sense in other contexts, too.
7:50:11
SaganMan
but with do it works and I've seen some examples where there is neither do or collect
7:51:58
phoe_
SaganMan: you need a loop keyword to establish a context for LOOP - it's just how it works. you have FOR to create a variable, IN to tell loop what to iterate over, and you need DO to tell LOOP that now it should be executing code.
7:52:11
SaganMan
beach: yeah, search for alpha45 in this http://cl-cookbook.sourceforge.net/loop.html
7:52:49
flip214
SaganMan: you might want to look at the ITERATE macro instead. That one has a more consistent syntax.
7:53:31
SaganMan
ohh, I don't know what the loop keywords are. So if the loop has just one of loop keywords, it's ok?
7:55:41
SaganMan
another question, did the later languages adopted the loop like feature of lisp or did this came from something else?
7:58:01
beach
And most languages don't have built-in lists, so they don't have loop constructs like collect, for/in, for/on.
8:02:24
beach
phoe_: Well, in most languages, there is a pre-tested and a post-tested loop. The latter makes at least one execution of the body.
8:03:17
SaganMan
now I kind of understand why there are so many variables not declared warnings in emacs packages
8:06:10
jackdaniel
we had recently a discussion about negations - they are hard to process by human brain
8:07:20
jackdaniel
I think that this topic was talked about as well, and some native speaker said, that it's a problem for him too
8:08:19
jackdaniel
this may be relevant: https://www.psychologicalscience.org/news/releases/true-or-false-how-our-brain-processes-negative-statements.html
8:40:47
phoe_
if list-1 is (3 2 1) and list-2 is (4 5 6), then (mapcar #'list list-a list-b) will evaluate to ((3 4) (2 5) (1 6))
8:47:39
dmiles
i am getting.. (sb-mop:class-precedence-list (find-class 'SB-GRAY:FUNDAMENTAL-BINARY-STREAM))
8:51:54
basket
dorothyw: digitRootSort should be called digit-root-sort, and instead of mapping a lambda like (lambda (x) (write-to-string x)) you can just use #'write-to-string
8:51:59
dmiles
what i am doing is interating thru the Mop to ensure genrate a type/slot heirary in which i am writting out prolgo declarations
8:57:53
dorothyw
It takes a list of ints and turns those into strings then breaks them into lists of characters then turns those lists of characters to lists of strings, then turns those to ints, then adds the ints, then sorts the list
9:07:45
beach
dorothyw: You need to format your program according to agreed-upon rules. You have way too many newlines, after LAMBDA, after LET* etc.
9:09:30
beach
dorothyw: There is a lot of unnecessary code in there too, like (map 'list (lambda (char) (string char)) list-of-chars)
10:58:48
Shinmera
plump can chug X/HTML and with plump-sexp you can output an s-expr like syntax of a plump DOM.
10:59:12
Shinmera
I doubt it's very compatible with cl-who, but even then if you look at the plump-sexp source you should be able to write a serialiser easily enough
11:47:17
SaganMan
I have a function which takes two numbers and I use (check-type a number) and when I give (function p 0), it just gives unbound variable error
11:48:08
SaganMan
phoe_: souldn't check-type like give option to correct myself like it said in clhs
11:52:20
phoe_
(grade2 100 300) prints FAIL, (grade2 900 300) prints PASS, (grade2 300 'a) signals an error.
11:52:47
phoe_
And I can use the STORE-VALUE restart to put a 300 in there, at which point I get PASS.
11:53:25
SaganMan
yeah, it works. I'm trying out check-type and it's not working like it supposed to. I mean like this http://clhs.lisp.se/Body/m_check_.htm
11:55:32
phoe_
The examples are going to look differently on your implementation - and different on slime, if you use it, since you get a slime debugger.
11:57:45
SaganMan
this check-type is only useful in debigging right? otherwise it serves no purpose I guess
11:58:20
phoe_
And it may instruct the compiler that your function accepts something of type X or Y, which helps with optimizing things.
11:58:41
SaganMan
really? even if it's a assertation, I still get the same error and nothing changes
12:07:49
SaganMan
I'm passing (grade2 a 20) with check-type in function and I get "The variable A is unbound" and after I remove the chek-type statements I do the same thing and get the same error.
12:15:38
Bike
that's how to fix the immediate problem, but saganman has some problem of understanding that he should be helped with
12:17:20
SaganMan
Bike: What I'm trying to say is even without check-type, (grade2 a 20) is getting same type of error unbound variable. As you've said the lisp compiler does assume that a is an variable.
12:17:49
Bike
And yes, it has nothing to do with check-type. In fact, it has nothing to do with grade2 at all, beyond the fact that it's a function.
12:19:01
Bike
if you booted up lisp and typed 'johnson' in the repl, you'd get an unbound variable error. if you typed (+ johnson 4) you'd get an unbound variable error. because johnson is unbound.
12:19:27
oleo
just that it turns out that one of the passed on args happens to be unbound and the body of the function works assuming a is a number
12:20:35
SaganMan
haha, yeah Bike. Like you said there's no other thing to imagine other than being variable.
12:21:08
oleo
Bike: when you pass an unbound arg is it as if you invoked the function as (grade2 nil 20) ?
12:22:20
SaganMan
Bike: well before coming here, I expected clhs style debugging with check-type in program but phoe_ told it's not the same as slime
12:23:43
Bike
Here's what the evaluator does. It receives (grade2 a 20). It looks at grade2, sees that it's a function, so it resolves to evaluate the arguments and then pass those arguments to the function. It tries to evaluate the arguments. It tries to evaluate a. But it can't, because a is unbound, so it signals an error. grade2 is never even called.
12:26:26
Bike
that's why i said the definition of grade2 doesn't actually factor in. The error isn't in the definition of grade2 (which looks fine), but just in the code you tried to call it with.
12:32:12
oleo
the function call protocol is in effect, and first all the parameters are evaled (or tried to) so when an error occurs there there is no invoking
12:52:36
Bike
for example, (defmacro bind (variable value &body body) `(let ((,variable ,value)) ,@body))
12:53:51
dim
jmercouris: a macro can choose to evaluate its argument while expanding or only refer to the argument in its expansion, so that the args are evaluated at run-time, later, as Bike is showing
12:54:31
jmercouris
If the function was capable of discerning the time, and executing based on the time, I would agree with "when"
12:55:18
Shinmera
jmercouris: The fuck are you on about. A macro can cause something to be evaluated at compile-time, load-time, or run-time. Those are different times, both in idea and actual real-world clock.
12:55:57
dim
read the spec before defining your own glossary and pretending we're not helpful in direspecting your choices of terms
12:57:16
jmercouris
For something to know "when" something happens, in the sense that you were using it, you were definitely not referring to the spec
12:57:42
dim
ok, but somehow you can't see that there's a link between the choice of the word “when”, the eval-when operator, and the evaluation of macro arguments?
12:58:00
jmercouris
Oh, I can see the link, I'm just pointing out that you are explicitly wrong in your statement
12:58:13
dim
either I'm all wrong or I'm done chatting with you jmercouris, you seem to want to be right rather than learn from our imperfect answers to your questions
12:58:39
jmercouris
You aren't "all" wrong, but you can't seem to be a little bit wrong about anything
12:58:52
jmercouris
It was a socratic question, so that maybe you'd take the opportunity to say "oh, you're right, I actually meant x"
12:59:49
jmercouris
I readily admit to being wrong all the time, please refer to my history in this channel
13:01:33
Shinmera
Referring to compile/load/run-times as when things are evaluated is completely common parlance.
13:04:41
scymtym
and then there is evaluation order of macro arguments which describes the order in which argument forms are evaluated within a given time (such as compile/load/run-time)
13:10:42
jmercouris
Shinmera: I'll say one last thing on the matter, when is a condition, just because it has the name "when" does not making relate to time, it is just a different way of writing IF, in computer science this is an extremely important distinction
13:12:40
jmercouris
He used the phrase "if and when" which commonly refers to a possibilty, and time, he wasn't using it in the sense of "when" as a lisp branch, that's just him backpedaling so he doesn't have to admit mistake
13:13:19
Shinmera
Or it's a conjunction of literally whether you want to evaluate at all, and specifically at which point in time you want to evaluate.
13:17:23
jmercouris
You don't choose at which point in time you evaluate, you choose during which process you evaluate, in other words, during which branch
13:19:55
Shinmera
If I were to further engage your line of thinking, I would also say there's different measures of time that can be established, one of which is the segregation of a timeline into four distinct phases of read, compile, load, evaluate. Using this notion of time, the application of "when" is completely accurate.
13:20:45
jmercouris
Actually no, it would be at "which" time, aka which time line, one wouldn't say "at when timeline"