libera/#commonlisp - IRC Chatlog
Search
22:37:35
fe[nl]ix
pjb: multiple-value-list is not the same as multiple-value-call #'list. the former accepts a single argument
22:41:09
Xach
dim: sort of. the stuff quicklisp provides is an export of a version controlled source, stripped of all VCS metadata.
22:41:15
pjb
fe[nl]ix: both: (multiple-value-list (values 1 2 3)) (multiple-value-call #'list (values 1 2 3))
22:42:15
pjb
fe[nl]ix: (macroexpand-1 '(multiple-value-list (values 1 2 3))) --> (multiple-value-call #'list (values 1 2 3)) ; eg. in ccl.
22:42:26
dim
I like that Quicklisp is more involved in the distribution bits than el-get is, because for Quicklisp to do what el-get does would be quite unreasonnable ;-)
22:42:44
dim
(sometimes I wonder how I can get away with it myself, but well, it's only Emacs you know)
22:51:12
eudoxia
highlight-lisp is perfect for highlighting CL code, but doesn't do any other language
22:51:25
eudoxia
highlight.js highlights code for every language, but as you'd expect, lisp support is meh
22:59:14
fe[nl]ix
pjb: you can't transform (multiple-value-call #'list (values 1 2) (values 3 4)) in (multiple-value-list (values 1 2) (values 3 4))
23:03:31
pjb
fe[nl]ix: that's one more reason why you should use multiple-value-call and not apply multiple-value-list list.
23:04:47
pjb
Once it has been given you countered with (apply (function format) t "~A ~A" (multiple-value-list (function list) (values 1 2))) which is bad bad bad.
23:06:34
Xach
Krystof: I'm turning reference condition output into links in my shiny new quicklisp failure log htmlization
23:17:10
_death
Xach: but I'm not sure that feature is too important.. many package managers for other langs are release-based, and pull requests still happen ;)
0:18:19
Xach
_death: i think of it as a good gateway to participating in hacking, rather than just consuming
1:27:11
milesrout
block/return-from are basically lexically-scoped, while catch/throw are dynamically-scoped? ...right?
1:34:51
Bicyclidine
milesrout: also need to remember that catch/throw evaluate their tags, which block can't do for obvious reasons
2:15:36
milesrout
Bicyclidine, it can't because which block it returns from is decided at "compile-time"?
2:16:36
milesrout
also it seems like block/return-from/tagbody/go/catch/throw don't ALL need to be special forms. Surely block/return-from could be implemented in terms of tagbody/go?
2:31:04
Bicyclidine
milesrout: they're 'special operators' so the implementation can deal with them specially instead of having to use a convoluted and inefficient macroexpansion
2:32:09
Bicyclidine
milesrout: http://home.pipeline.com/~hbaker1/MetaCircular.html has each of the three implemented in terms of the others, except for tagbody in terms of block
2:42:43
Zhivago
The special operators are the fundamental units that they operate on, regardless of if they are implemented as macros or not.
2:44:21
Zhivago
An implementation can always deal with them using a simple and efficient macro-expansion to some local primitive (but a code-walker would n't understand those).
3:11:27
ivan4th
* tries to fix pattern restriction checking code in cxml-rng. it's... somewhat terse
3:13:12
ivan4th
it's a shame to admit but I got some idea of what it's supposed to do by looking at jing java source code...
3:17:00
ivan4th
(by "terse" I mean something like this: https://github.com/slyrus/cxml-rng/blob/master/parse.lisp#L1979 )
3:31:42
milesrout
the whole point is that everything is either a special operator or can be defined as a function or macro in Lisp, right?
3:32:36
loke
milesrout: Special forms are forms that does not apply the normal "evaluare arguments then pass to the function" semantics
3:33:01
drewc
I think that the special operators are builders that use building blocks like CL:CONS, but I might be hungry so over-analyzing things.
3:33:32
loke
That said, one _CAN_ implement CAR as a plain function. All that you _really_ need is LAMBDA
3:35:03
Bicyclidine
(defun cons (x y) (lambda (op) (funcall op x y))) (defun car (x) (funcall x (lambda (x y) x))) etc
3:35:13
loke
milesrout: You can define CONS like this: (defun CONS (a d) #'(lambda (f) (funcall f a d)))
3:36:14
Bicyclidine
it's a trick that's useful for CS, not so much for writing something to do your taxes, though
3:36:45
Bicyclidine
lisp implementations generally run on electromechanical computers, so they implement car in terms of weird things like "assembly"
3:37:17
loke
milesrout: (it involves something called "church numbers" and is interesting, but pointless in most real-life scenarios :-) )
3:37:43
Bicyclidine
well, it's relevant if you take special operators are the building blocks of bla bla bla in the wrong way
3:38:21
milesrout
yeah I had assumed that 'special operator' meant 'thing provided by the interpreter' while everything else was actually lisp code.
3:38:37
milesrout
didn't think that built-in functions were a thing. but of course they are, silly me.
3:38:45
Zhivago
That assumption is wrong, and you keep extending it by conflating special-operator-p with built-ins.
3:40:08
loke
milesrout: ah. then you will see that SBCL's implementation of CAR looks like this: (defun car (x) (car x))
3:41:49
Zhivago
And then you'll find another seamy underbelly of CL where things aren't bolted on very well. :)
3:42:10
milesrout
car also needs to be a function, not just 'a thing that the interpreter evaluates'
3:43:02
loke
milesrout: Right. The compiler has special knowledge of the function CAR som that it can be effectively inlines as a single machine instruction. But, you also need to be able to do stuff like (mapcar #'car list) which means there needs to be an actual function CAR as well.
3:43:17
milesrout
(car x) doesn't call the function car, it is a use of a built-in construct of the interpreter? But for example you need to be able to do (funcall #'car 1 2 3)
3:43:53
Bicyclidine
built in construct of the compiler. that's pretty good, someone had to explain that on to me
3:44:56
loke
milesrout: Yes, exactly. So the implementation (defun car (x) (car x)) creates a function CAR, whole implementation is the inlined code of car (that is known by the compiler)
3:46:21
milesrout
similar to the way that function sees a form like (lambda foo (x) x) and turns that into a closure, but that doesn't mean you can go around doing (apply #'lambda '(foo (x) x))
3:48:00
loke
milesrout: Well, I think I see what you're saying and if I'm right about my understanding, then yes.
3:49:11
milesrout
mhm. lambda is a macro that expands to (function (lambda ...)), which confused me at first before I remembered that function is a special operator that does not evaluate its argument in this case.
3:50:20
loke
milesrout: By the way, the closest you can come to the actual "implementation" of CAR in SBCL is the function %def-reffer (you can find it in fun-info-funs.lisp)
3:50:52
pjb
milesrout: car is implemented with FUNCTION: (defun kons (a d) (LAMBDA (k) (funcall k a d))) (defun kar (k) (funcall k (lambda (a d) a))) (defun kdr (k) (funcall k (lambda (a d) d)))
3:50:59
Zhivago
It's just inlining the definition of the function into its name in order to support effectively anonymous functions.
3:51:03
milesrout
Bicyclidine, yeah that's what I mean. I don't literally mean 'overloaded' in the C++ or Java sense, but more in the 'it does two pretty distinct things'
3:51:15
pjb
milesrout: besides, all the functions in the CL package can be implemented as special operators.
3:54:43
milesrout
I'll probably get yelled at for this, but I feel there should be a read macro for LIST, like there are for QUOTE and FUNCTION.
3:55:52
milesrout
I suppose a big advantage of Lisp is that you don't have to ask a standards committee to add new "syntax".
3:56:11
milesrout
I suppose also that a big disadvantage of Lisp is that you don't have to ask a standards committee to add new "syntax".
3:57:09
loke
I just looked at a project of mine. 4000 lines of code, with 88 lines containing a call to LIST
3:58:32
loke
I grepped for '(list' so there may be some very rare instances of things like (let ((list ...)), although I rarely name my variables "list"
4:05:08
pjb
milesrout: you can do it with reader macros, but when you have unicode, you have to put reader macros on approximatively 2^21 characters. Which with some implementations is very suboptimal (eg. ccl keeps reader macros in an a-list).
4:06:40
pjb
milesrout: you can also patch the implementation. After all, forms like a:b:c are reserved for implementation extensions!
4:07:21
loke
pjb: Do you know of any implementations that has extensions for that already? (I know of none)
4:08:17
pjb
milesrout: the cons as lambda can be very realistic on the contrary. An implementation will in general implement closure in a very efficient way. The only difficulty, is to distinguish cons functions from normal functions, when implementing consp and functionp.
4:09:20
pjb
loke: but you're right, there are a lot of CL implementations, but they barely explore the super-languages or extensions allowed. People instead write clojures…
4:16:38
milesrout
it just occurred to me that macros are just functions really, but they are called at compile-time on forms rather than at runtime.
4:20:46
milesrout
Technically, they can (are often are) called at other times <-- lisp programmer detected
4:21:10
loke
milesrout: But yes, they are simply functions, returning a form, called at some point prior to evaluation
4:21:39
loke
milesrout: Yes, but it helps if you don't make that assumption. Just think of lisps without a compiler
4:22:15
Zhivago
Think of macros as being compiler extensions implemented with functions, rather than being functions.
4:22:25
minion
beach, memo from pjb: of course, if as an implementor you are writing an implementation where &rest always copy the full argument list, then you can (defun cl:list (&rest a) a), but a user writing conforming code cannot.
4:22:25
minion
beach, memo from pjb: <18:12:47><beach> theseb: (defun list (&rest args) args) ; this is wrong, because &rest doesn't necessarily allocate a new list: (defun l (&rest a) a) (eq (apply (function l) '#1=(1 2 3)) '#1#) --> T is possible ; cf. 3.4.1.3: The value of a rest parameter is permitted, but not required, to share structure with the last argument to apply.
5:12:22
drmeister
Passing excess arguments in the multiple value return structure is really nice. It's got a nice symmetry to it. Excess arguments go in to the function through the multiple values structure and excess return values come out in the same structure.
5:19:30
Zhivago
Well, a call implies a call site, so saying (foo bar) means that you will have a corresponding receiver somewhere.
5:20:47
Zhivago
So the calling expression and the receiving function don't need to have fixed interfaces.
5:21:33
Zhivago
You might have a call-receptor pair that uses registers, or passes in a list (hello apply) or puts every second argument in a treap, or ...
5:22:03
Zhivago
Then when linking, you just need to make sure that both ends are hooked up properly.
5:22:39
Zhivago
And you can imagine that this may make a big difference when dealing with untagged immediates, for example.
5:22:43
drmeister
loke: The intrinsics_bitcode_boehm.o problem - is that it? I haven't seen that problem before. Have you pulled the latest externals-clasp and clasp?
5:25:03
drmeister
Zhivago: I haven't explored that idea. My linking is standard Linux/OS X linking. In my current call convention I'm passing up to five arguments in registers and the rest I'm writing into he multiple-values arra
6:15:17
Botcyclidine
you can give it a shot, if you want to avoid typing http://norvig.com/paip/README.html
8:56:23
knobo
Can I make the slime repl not print ^M from output that does (format t "~C" #\return)?
9:47:05
jasom
DelicateFlower: popularity is a funny thing; it's kind of like money: the easiest way to get more of it is to already have a lot of it.
9:52:16
DelicateFlower
and it would be far easier for you to say the 1-2 sentences that is your point
9:55:58
wasamasa
DelicateFlower: tl;dr: your assumptions are wrong and your question flamebait at best
9:56:52
pjb
To say nothing of the reaction of going to Rotten Tomatoes to know if a movie is to be watched or not…
10:00:15
knobo
Verry few people are talking bad about Lisp compaird to how many is talking bad about java.