freenode/lisp - IRC Chatlog
Search
16:33:17
Grue`
to write a defmethod on variable number of arguments it's enough to write a defmethod of 2 arguments, and then do reduce-like thing with it
17:16:11
J_Arcane
honestly, if I could just write all my HTML in s-expressions I probably would write more HTML. ;)
17:59:47
Adlai
hmm... does handler-case let me invoke restarts, or does the control transfer unwind them?
18:05:54
Adlai
handler-bind + invoke-restart have saved me, after forgetting to update-instance-for-redefined-class
18:53:26
AeroNotix
Xach: I am working on that now. I can't seem to get the tests to run after I remove the call to ql:quickload and add in what you said. Any other tips?
19:17:25
resttime
i can connect to a swank server over ssh, but I can't seem to load files to it with C-c C-l
19:18:07
Shinmera
C-c C-l just sends the load command with the file name which means it'll send your local path
19:19:02
resttime
i was thinking of editing files on my computer and then loading them over ssh to the server box
19:19:40
Shinmera
I'm not aware of there being an actual 'send file' command, but there might be somewhere.
19:22:47
resttime
though it might have somethign to do with http://common-lisp.net/project/slime/doc/html/Setting-up-pathname-translations.html#Setting-up-pathname-translations
20:32:22
chase_gray
hi, is there a way to determine the definition of a function from within the interpreter?
20:33:47
kristof
chase_gray: If you actually want to manipulate the definition, there's function-lambda-expression
20:34:07
Xach
chase_gray: the typical thing to do is write the definition into files and use editor/implementation integration to make it easy to jump to it.
20:35:37
chase_gray
i was actually trying to use it to find out the definition of the primitive procedures haha
20:36:40
theseb
anyone work in programming language theory?...i'm wondering if there are any innovations coming down the pike or if languages will likely stay as they are now for the next 20 years
20:36:41
Xach
In common lisp, primitive procedures are often implemented with tricks for speed, so you might see something like (defun car (x) (car x))
20:37:12
chase_gray
just a followup - is there a way to determine the parameters (specifically the types) using a similar function?
20:37:55
Xach
chase_gray: for standard procedures, you can look in the spec, e.g. http://l1sp.org/cl/cons tells you what CONS expects.
20:38:07
Bike
theseb: do you expect someone to say "no, my field is just going to be the same for twenty years"? that's hard for me to imagine
20:38:53
Grue`
gotta love sbcl error messages "warning: Clobbering the compiler's idea of the layout of #<STRUCTURE-CLASSOID SEGMENT>"
20:39:28
Xach
wasamasa: yes, looks like it. oh well, most other symbols (and some non-symbols) work ok
20:39:38
Bike
nyef: i know a guy in optics and he doesn't just twiddle his thumbs... i mean, lots of it is pretty solid though, yeah
20:39:52
nyef
Grue`: Redefining a structure? You realize that you're probably heading for a crash, right?
20:41:30
nyef
Grue`: Still possibly not safe. If you're planning on redefining your structures, you really are better off using classes.
20:48:21
zacts
is lisp used in high reliability use cases like power lants / air traffic control / medical?
20:50:28
Xach
zacts: I know it's been used for factory control. there were some good anecdotes from the gensym g2 guy at the lisp conference in reno.
20:51:31
Xach
zacts: he told an amusing story about nabisco doing development on the production line because it was cheaper than setting up a separate test environment. sometimes things would go haywire and send cookies flying.
20:52:15
Xach
it was also used for managing some aspect of nasa satellite launch systems, and biosphere 2.
20:52:19
theseb
Bike: no! i'm not interested in wishful thinking....are there unimplemented innovations *NOW* waiting in PLT?
21:06:54
Vivitron
Grue`: one possible cause of crashing is safety 0 code, you might reload from scratch using sbcl's unsure compiler policy
21:07:52
Grue`
i think it's trying to print a recursive structure, which is segment with path=(list segment)
21:12:44
Grue`
the function worked perfectly, it's the printing that crashed. with *print-circle* t it doesn't crash
21:12:51
pjb``
That's the advantage of hardware: explosions are limited in time and space. Even Nagasaki or Hiroshima had very limited impact.
21:14:14
pjb``
Remember, materially, there's no way to do anything on Earth that may have more impact than the Sun. Ever. Only with software and spiritually may we have a greater impact than a puny star on the galaxy.
21:16:03
pjb``
It looks like loading bordeaux-threads on sbcl 1.2.3 on macosx or linux (and calling bt:make-thread) signals that they're not compiled with thread support. I wonder it it's true, or if it's sbcl that broke something in bordeaux-thread. (Since I just install vanilla sbcl, it's possible I don't have threads with them).
21:18:23
zacts
would implementing threads be on the OpenBSD side of things, or on the SBCL side of things?
21:20:05
nyef
zacts: Be careful with the "shouldn't be too hard" statements, though, sometimes it's something peculiar to the OS that makes it impossible.
21:37:37
nyef
CONS always returns a list, but not necessarily a "proper" list, just to muddy things up further. d-:
21:43:26
SvenGek
I'll admit that picolisp isn't designed *at all* for new users, but I find it's extreme simplicity nice and easy (to understand)
21:43:36
pjb
SvenGek: did you write a 20-page rapport in three copies justifying the use of pico-lisp?
21:43:57
pjb
Because if you didn't, then you should just use one of the major Common Lisp implementations.
21:46:51
SvenGek
Pretty different. I initially submerged myself into Scheme, which I didn't like, then Clojure, which is pretty nice and easy for a new lisper, but I found its amount of new concepts annoying
21:50:47
logand
SvenGek: picolisp is brilliant but it's very different from common lisp; try #picolisp
21:51:37
Shinmera
Neither of those are CL syntax, but what you're referring to has nothing to do with macros in particular either
21:52:25
Shinmera
but that's part of the backquote syntax, which has is not really anything about macros
21:55:50
drewc
are you asking if lisp has anonymous functions that can be generated using the LAMBDA operator?
21:58:35
pjb
The lambda operator is a simple macro that expands to the function operator. The lambda operator in Common Lisp doesn't create functions or closures. It's the function operator that does that!
21:59:21
pjb
(compile and eval and coerce may also create functions, using other implementation dependant means).
22:01:18
drewc
that that make andinstance of FOO and instance of FUNCTION? (functionp (make-instance 'foo)) => t
22:02:07
drewc
and I have a cat who pretends to type... before I have a change to look at things she hits enter .. so sorry about the sp?s there.
22:03:51
SvenGek
uhhh, so is there an actual "lambda" data structure? or is it implemented using other data structures?
22:05:03
Bike
SvenGek: cl functions are mostly opaque. you can call them and get a docstring and that's mostly it.
22:06:13
kristof
SvenGek: If you just want it to be a pointer to something you can funcall, then a lambda data structure is just a pointer to a function, or a closure (a function and an environment of bindings). In some implementations you might be able to get definitions (which you can manipulate) and docstrings (perhaps you're writing a documentation system). What else would you like from a "lambda" structure?
22:10:13
nyef
A funcallable object that isn't a lambda? Isn't the classic example there a generic-function?
22:11:35
kristof
SvenGek: Yes and no. The yes is with respect to there being function structures in Clojure. Because Clojure is written at the bedrock level in Java, and Java doesn't/didn't support lambdas, you have to write a Java object that you can essentially funcall and pass around if you want to have those things.
22:12:54
kristof
SvenGek: Common Lisp doesn't... uh... "need" function structs because it's built into the lanugage at the design and implementation level. The "no" is with respect to the word "actual" in "actual function-object/structure". Funcallable objects in Common Lisp really are objects.
22:12:56
drewc
nyef: which is an object with a metaclass of? ... though I guess that we still don't think that MOP is a part of Common Lisp, do we? ... I will go back to using uncommon lisp and show myself the door.
22:13:57
kristof
nyef: By lambda I mean functions, and I guess I extend that to generic functions as well. defun just sets the function value of a symbol to (lambda (args*) (whatever...)), right?
22:14:39
kristof
I guess funcallable objects are a good metaclass if you want to write something like the generic function abstractions, right?
22:15:34
kristof
Ok, I can imagine funcallable objects with real slots and methods defined on them being useful for genetic programming
22:17:18
drewc
kristof: I have used them for dynamically scoped FLETs among other things using pcos's contextl. And for call/cc interpreted generics using segv's arnesi.
22:20:04
kristof
drewc: That's nifty. I don't quite understand where contextl fits in with CLOS, though, because CL's method combinations are so flexible.
22:21:35
drewc
Krystof: it is basically having layered methods, and hiding the fact that the dynamically bound layer is in fact the first arg to the generic function that eventually is called.
22:22:21
pjb
SvenGek: other data structures are actually implemented with lambda. For example (modulo some wrapping and hiding): (defun .cons (a d) (lambda (c) (funcall c a d))) (defun .car (c) (funcall c (lambda (a d) a))) (defun .cdr (c) (funcall c (lambda (a d) d))) (.car (.cdr (.cons 1 (.cons 2 (.cons 3 nil)))))
22:22:22
kristof
drewc: I'm going to Costanza's papers on it. I'm sure it's useful. What did you use it in? Your web framework?
22:23:19
drewc
kristof: yeah, I used it in my web framework with arensi's defmethod/cc and that as well...
22:25:06
kristof
SvenGek: A rather convoluted implementation of cons adapted from the second chapter of SICP. It's neat-o, and challenges how people traditionally think of data structures.
22:26:40
pjb
SvenGek: now, to implement consp, it would have to be a little more sophisticated, but the same principle applies.
22:27:06
kristof
drewc: Dynamic scope makes a mess out of a lot of things. I ran into that while investigating M:N multithreading. You set a dynamic variable, and the proc gets unscheduled. It gets rescheduled, and: surprise! You're at the whim of whatever thread local storage you just landed on.
22:28:02
drewc
SvenGek: take his code, break it up into the 4 forms, c/p each one here : http://davazp.net/jscl/jscl.html
22:28:02
kristof
drewc: Clojure gets around this by manually packing and unpacking an alist of dynamic bindings on park/unpark, respectively. But that's a bit of overhead for lightweight threading, isn't it?
22:28:07
Bike
(defun .cons (a d) (lambda (c) (if (eq c #'consp) t (funcall c a d)))), i suppose that's gross, though
22:29:00
drewc
kristof: yeah, that is pretty much what I did as well, though contextl allows you a dlambda ...
22:31:02
kristof
drewc: Oh, that's cool! But when implementing, say, an actor library, the idea of doing all that book-keeping is terrifying from a performance perspective.
22:32:40
kristof
Whatever the final result, though, I'm sure it'll be tremendously faster than Ruby or Python. I'd really like Common Lisp to take the reigns as *the* go-to dynamic language with simple-to-use concurrency abstractions.
22:33:11
drewc
kristof: IIRC, lexical scope was 'created' by implementing actors using lambdas ..... schemers basically. So indeed, book keeping is also terrible from the book shelf being filled.
22:34:25
kristof
drewc: I'm sorry, is there a better way to implement actors than as lambdas which loop through a queue?
22:35:55
SvenGek
Heh, it took me a little bit to realize that those examples were of a more "purely" functional design
22:38:51
SvenGek
Unrelated, but I saw this implementation of Fizzbuzz using nothing but Ruby lambdas
22:39:31
SvenGek
(actually, it is related to the discussion at hand) "Coding with Nothing" http://codon.com/programming-with-nothing
22:39:41
pjb
SvenGek: (defun .list (&rest elements) (if (null elements) 'nil (.cons (first elements) (apply (function .list) (rest elements))))) (.car (.cdr (.list 1 2 3 ))) --> 2
22:39:43
drewc
or what is the difference between 3 and '(nil nil nil)? what if CONSs were LAMBDAs and NUMBERs were LAMBDAs?
22:40:16
pjb
drewc: you could represent typed objects as a cons containing the type in the car and the value in the cdr.
22:40:34
J_Arcane
For a practice exercise while trying to learn it, I code-golfed FizzBuzz in Clojure, down to I think 90 chars, or 98 for a println version.
22:41:09
kristof
The beauty of isomorphisms is not that one thing is "just as good" as another, but rather that a set of things is entirely the same as another set... just merely relabled.
22:42:24
J_Arcane
kristof: Heh. Well, thems was the rules, plus the original goal was just to get it to fit in a tweet, so chars were important factor.
22:45:37
J_Arcane
SvenGek: I'd done some further compression, but that was offset by needing to loop the results to print them in turn.
22:46:29
J_Arcane
Also, someone had pointed out to me that Clojure is obfuscation friendly, ie. you can strip a lot of spaces.
22:48:21
SvenGek
Lisp is probably good for certain code golf problems, but I never see anyone using it
22:48:32
J_Arcane
SvenGek: (doseq[i(range 1 101)](println(#(condp = 0(mod % 15)"FizzBuzz"(mod % 3)"Fizz"(mod % 5)"Buzz" %)i)))
22:48:55
J_Arcane
SvenGek: Because most are actually terrible at it, because they've been written more for clarity than obfuscation.
23:31:53
revereche
Is anyone online who could help me figure out why a CLISP program from the early 90s isn't working as expected?
23:32:51
revereche
The code has comments explaining what should happen, and it doesn't perform that way. Lemme link
23:33:03
pjb
And if it's a Common Lisp program is it conforming, or does it use implementation specific extensions?
23:33:35
revereche
More background on the code: http://eliterature.org/2006/01/meehan-and-sacks-micro-talespin/
23:34:24
pjb
No, it says Common Lisp! Right there, on the fucking fourth line! --> A reconstruction, in Common Lisp, of James Meehan's program in
23:36:15
Xach
revereche: could you use paste.lisp.org and show what you tried to do and what you expected it to do?
23:42:46
Xach
revereche: It is sadly not uncommon for programs to be written in a way that are not friendly to compilation.
23:43:10
Xach
They are written in a way that expects each form to be read and immediately evaluated, as LOAD does.
23:43:42
Xach
compiling (as with C-c C-k) does not evaluate everything right away, so the program may be expecting to have a piece of data or other info that is not available when it is needed.
23:43:45
revereche
I would have thought back in the days of limited processing power it would be the opposite
23:45:33
pjb
revereche: I've dumped my special variables, you can do the same and compare with yours: http://paste.lisp.org/+32VW/1
23:46:26
pjb
You would want to find wheree there's this difference between load and compile to correct it.
23:46:38
kristof
Xach: Is that similar to the "ambitious evaluation" strategy that Kent Pitman once wrote about?
23:47:57
pjb
(eval-when (:compile-toplevel :load-toplevel :execute) …) with … = from (defstruct (pcvar …)) to (set-macro-character … t))
23:48:04
revereche
pjb: That's a good point, but I'm still pretty new to the language and think debugging might be beyond my abilities at the moment . .. really, I'm just using this as reference for future programs of my own
0:07:36
Shaftoe___
any opinions on what the best way to use a C++ class as no more than struct in lisp? Meaning, I want to use an object that exists in a library, but I don't need the C++ functionality. All I need is the struct layout...
0:08:21
Shaftoe___
(and for clarity, I'm talking about using a foreign library via CFFI. I just need to pass around/return a struct from said library)
0:08:42
pjb
Shaftoe___: The best way would be to define a functional abstraction over the C++ object in C, and CFFI to access those C functions from lisp.
0:09:37
Shaftoe___
pjb: I've thought of that, and it is my last resort. However, the particular structure I'm trying to work with is really no more than a struct. It's been made C++'y because people didn't know any better
0:10:28
nyef_
Shaftoe___: If it's a struct, then you might be able to grovel or otherwise define a suitable alien-struct type, whatever the concept is called in CFFI.
0:11:31
Shaftoe___
nyef_: that's the thing. It's not a struct. It's a class (in the library headers). I *could* just copy/paste the class itself, but that's poor taste.
0:12:01
Shaftoe___
ok. so manually is the answer. I was just checking if there was any way around it that I Wasn't aware of
0:12:42
pjb
There's no difference between structs and classes in C++. Only if you have virtual methods, you will have a pointer to the vtable somewhere in it.
0:14:59
nyef_
Failing that, drmeiste_ might have some ideas. He's got some C++ integration thing going on.
0:16:29
Shaftoe___
nyef_: yes, he's mentioned to me his project using clasp. It is interesting and down the pipe I might actually use it.
0:17:45
drmeister
Your frustrations in exposing C++ class/struct(s) to Common Lisp are the same I felt and why I wrote Clasp.
0:19:59
Shaftoe___
I've finally resorted to segregating large swaths of functionality behind binary boundaries (dylibs) but even communicating with these libraries requires me to either copy/paste code or figure out how to import C++ headers.
0:20:18
drmeister
A day rarely goes by when someone doesn't come into #lisp wondering if there is a better way to expose C++ class/struct/functionality to Common Lisp.
0:21:51
Shaftoe___
I think part of the problem lies with C++ in that respect. But then again, C++ was never made to be binary interoperable. C++ header files just aren't consumable by anyone else but C++
0:24:19
drmeister
I completely agree the problem is C++. In order to support all those "higher level abstractions" that ultimately came from Lisp it's had to twist C++ syntax into the awful mess that it is. It's absolutely hostile to interoperation with other languages.
0:25:39
Shaftoe___
I blame it on small hominid brain size and recognize that it is our collective job to slowly work through this mess. =)
0:26:21
drmeister
That and retain some compatibility with C. The only thing that can read and reason about C++ properly is a C++ compiler front end. Fortunately, Clang/LLVM have exposed the C++ compiler front end as a library and I have exposed that C++ library within Common Lisp. So everything is going to be ok. :-)
0:26:25
nyef_
Alternately, treat the entire C++ ecosystem the same way we do nuclear waste: Bury it in a mountain until everyone forgets about it.
0:28:12
nyef_
If my nick is still in use when I reconnect, XChat appends an underscore in an attempt to find an available nick.
0:40:34
resttime
i have an account to a server which serves pages with apache to a folder in my home directory
0:41:08
phao
Hi. I'm sorry this is quite offtopic, but I don't really know where to ask about this. Is there any good document (book, website, ... anything) on effectively dealing with secondary storage? I'm not looking for "the one righteous way", but more of a material which explorer some particular way(s) of doing this. It could be in lisp, or not. I don't really care about that.
1:02:28
Shaftoe
I wonder if there's ever been a serious security analysis of program tear down bugs.
1:03:26
Shaftoe
I have the impression that there must be some serious security gaps, what with all the haphazard memory management that goes on at the end of the life of a binary
1:11:01
kristof
Shaftoe: You can't execute arbitrary code during that time, though. You also can't access the memory unless you're root, and if root's compromised...
1:11:07
phao
more on how to use it well... and other storage mechanisms too. Like those textbooks on relational DBs used in college.
1:13:59
Shaftoe
kristof: that's what I mean: I wonder if there's been any systematic analysis done on destructors in general. We kind of assume that by the time they're called, everything is safe. But I wonder what would happen to data structures that have been corrupted and where that corruption only becomes apparent at tear down time.
3:34:28
nyef_
Hunh. I didn't realize that my copy of LiSP was here, I thought that it was in New Hampshire.
3:37:49
Fare
somehow, poplog also had a stack-based VM on top of which it had implementations of pop-11, common-lisp, prolog, ml
4:18:12
_tca
Petit_Dejeuner_: to completely not cheat you have to translate all the semantics of the language to the machine's within the language itself.... for whatever you decide the machine is