freenode/#lisp - IRC Chatlog
Search
13:58:29
Bike
i'm not sure i understand this client? i'd expect a higher level to just establish handlers like usual
13:59:25
beach
Yes, and the client can still do that. I am just providing reasonable defaults with these mixin classes.
14:01:28
Bike
standardized restart? like... you have a function (or around method) that calls the normal compiler with e.g. a handler that turns unbound-variable into warn and consider-special, for a normal compiler?
14:02:29
beach
No, "standardized restart" as in compile-an-error-message-instead and compile-anything-you-like-instead.
14:04:06
Bike
i'm not actually sure how that would work with consider special? i guess you could turn a into (locally (declare (special a)) a) but that seems kind of complicated
14:05:57
beach
Presumably, most clients, such as Clasp, would call the function indirectly through the symbol and the symbol already exists.
14:11:41
Bike
mm. thinking about it. i don't think it would duplicate anything major. it would be a little slower than it is now but that doesn't matter. so nevermind.
14:17:42
Bike
the restart would be separate from the errors, too. that's kind of interesting. like (restart-case (call-next-method) ...) in an around method on convert, i guess
14:18:31
beach
The restart-case would be in the low-level function, and the around method would have invoke-restart. No?
14:44:54
beach
The first condition is the root condition that will be handled by the :AROUND method.
14:45:47
beach
PROCESS1 symbolizes a client that wants to interrupt compilation as soon as there is a problem.
14:47:21
Bike
oh. i thought the standard restart was "compile some provided form instead of the form that caused the compiler to signal any error"
14:47:32
beach
I might find a way for client code to handle specific conditions specially, thus making it possible to provide individual restarts for different situations, such as SUBSTITUTE-A-DIFFERENT-NAME.
14:48:17
beach
Such a restart would have to be invoked differently by client code in each different situations, I would think.
14:48:43
beach
That would make it almost impossible for client code to customize the compiler with a reasonable investment.
14:50:32
beach
If every time the compiler sees a problem (there might be dozens of such situations) a different kind of form has to be supplied (a different variable name in a SETQ, an alternative binding in LET, a different function name in a call), then client code would have to handle each individual condition type and do something different with the restart in each situation.
14:52:17
beach
That's the point. Client code can choose a reasonable default and get work done more easily.
14:52:46
beach
Like I said, maybe I can find a way for clients who so wish to have finer control over the process.
14:54:01
beach
I mean, there is always a way of course, but it has to be reasonable, as in just having to address the exceptional behavior it wishes to provide, as opposed to "all or nothing" as in "either use the default or provide a handler for the following 67 conditions".
15:01:30
Bike
ok well what i was thinking was that if the restart is "provide another form", a client could do like (handler-bind (...specially handled conditions... (compilation-program-error #'runtime-compile-error)) ...), and then cleavir has (defun runtime-compile-error (e) (invoke-restart 'new-form `(error 'runtime-compile-error :error ,e))) or so.
15:04:35
Bike
Okay, so you have this blunt instrument restart that takes one argument and just replaces the form being compiled with a new one, right.
15:05:13
Bike
And the client says, if the compiler runs into pretty much any error at all while compiling some form, replace that form with something that will signal an error at runtime, that refers to the error signaled at compile time.
15:05:53
Bike
(and if it wants to handle stuff specially, which it probably does, it can just put those handlers first)
15:06:23
Bike
right, so in that case it can still just do this (replacing the entire LET form), or it could use a different restart to replace the binding or whatever.
15:09:45
Bike
i guess it works better for compilers than for editors, which would probably want to continue going through the let form, and such
15:11:04
Bike
i suppose "just use nil" doesn't really strike me as a reasonable default for most applications. but of course it could just be like you had but with a more specific restart name, and the editor can ok yeah you get it.
15:12:03
beach
I think the main thing then is to create different restarts, at least one of which is RECOVER.
15:12:31
beach
... and to create a hierarchy of conditions that can be handled the same way, i.e. by invoking the same restart.
15:14:26
beach
With a reasonable condition "graph", client code could handle only certain categories, rather than each leaf separately.
15:24:27
dlowe
I guess so. Anyway, that has lisp with an AI bent, though it's the "symbolic manipulation" AI model, not the "massive storm of linear algebra" AI
15:27:20
beach
hound1358: Most people who hang out here use Common Lisp for applications that are not related to artificial intelligence.
15:27:55
beach
hound1358: And that book, by Peter Norvig, although using examples from "traditional AI, is really a book about program design using Common Lisp.
15:30:12
Xach
hound1358: so it might help to find someone doing what interests you and look at what they use.
15:30:20
beach
hound1358: Maybe I am wrong, but Lisp was good for AI back in the days when it was thought that AI could be accomplished with so-called symbolic programming. I have the impression that the techniques used today are more about massive data sets.
15:30:21
hound1358
Bike: Well.. i read that lisp, altough is a general purpose language, it was especifically designed for AI
15:30:36
Bike
lisp has a reputation for AI because it was used for it a few decades ago, because AI at that time was based in symbolic manipulation and lisp can do that without libraries or anything.
15:31:42
Bike
it has no special facilities for neural networks. lisp is, indeed, good, but it's not a silver bullet of any kind
15:32:11
Xach
Just yesterday someone ripped off my lisp-powered sign maker to make and sell physical signs :~(
15:34:00
Xach
I would love for you to keep your enthusiasm while losing your misconceptions. Please don't think of corrections as discouragements.
15:34:07
Bike
meaning that you can compile generated code, or that it has self-hosting implementations? both are nice features, but also have nothing to do with AI.
15:36:08
Bike
you can do that with anything. being able to emulate another program's behavior is what makes a Turing-complete computer a computer.
15:37:19
Bike
yes, everything. you can write a brainfuck program that has access to its own source code, modifies it to improve it, and then runs it (and that program does the same, and so on)
15:37:33
Bike
it might be easier in lisp, i guess, but it's not like an incredible qualitative difference.
15:37:46
beach
hound1358: The strong point of Common Lisp is that it is "interactive", i.e., the meaning of a program is defined by a sequence of "interactions" that modify some global state of the system.
15:39:19
beach
hound1358: This feature greatly improves development by letting the programmer experiment by running incomplete code.
15:39:29
optikalmouse
beach: that implies quite a lot; while the system is in production you can modify it without restarting servers and instances and doing a whole deploy cycle
15:41:58
optikalmouse
beach: it was awesome to see when coding smalltalk with the seaside web framework; hit the endpoint, it doesn't exist, code it up, hit another one, oops forgot validation, code it up, and just progressively building it up
15:45:36
Bike
i feel kinda bad for being discouraging but i guess it's better than allowing weird expectations
15:50:41
beach
pils_: Are you reading integers? Common Lisp integers either have an infinite number of leading 0s or an infinite number of leading 1s.
15:52:38
pils_
yes i want to fill a list from a file and some rows in that file start withnzero's: 0 0 0 4 5 0 0 . if i read that with with-open-file and print it the result is 4500
15:52:48
beach
pils_: Also, WITH-OPEN-FILE does not do anything particular, other than opening the file and then closing it at the end. It's what you do in the body of WITH-OPEN-FILE that has meaning.
16:36:30
malice`
I've said it's not a great way. It's doable, and depending on the spec might not be a bad idea, but I prefer other resources.
16:41:54
malice`
I've found a code that uses (setf (some place) (values something something-else)). Is that a reasonable code?
16:42:47
malice`
It looks like it won't on non-custom setfs, like (setf *some-place* (values 1 2 3)) ; it would set *some-place* to 1.
16:45:30
malice`
I'm not sure if I like this method though. Are there any benefits for this other than concise code?
16:54:26
Bike
like if you have two variables in a structure that are the result of a call to FLOOR, you might as well just do (setf (my-place ...) (floor ...))
16:55:20
malice`
Bike: yeah, but I guess that I'd prefer to wrap that in another function, like (set-my-place var) so that I'm sure the call to floor is there, and not some other data
17:10:29
fiveop_
(asdf:load-system <system> :force t) where <system> is the name of a package inferred system seems not to work like one would like. Is there a workaround?
17:14:12
fiveop_
compare (ql:quickload <system>) (asdf:load-system <system> :force t) for values :lil and :alexandria for example
17:14:24
Bike
i think you need :force :all to rebuild dependencies in any case, but it really ought to force the actual system...
17:15:19
fiveop_
well t works as expected as well, the root package of a package inferred system is usually pretty empty
17:16:15
fiveop_
No. I want to load the packages that belong to the "system" but not its external dependencies. I guess ASDF cannot distinguish them.
17:16:26
malice`
Bike: umm, what I meant is that instead of providing an interface for, let's say, a "result" class that has a (setf result) method that you would use like (setf (result x) (floor some-number)), I'd prefer to have a (set-result-of x some-number) or (setf (result-of x) some-number)
17:16:52
Bike
fiveop_: oh, so when you said "package inferred system" you meant "a particular group of asdf systems"
17:18:15
fiveop_
https://common-lisp.net/project/asdf/asdf/The-package_002dinferred_002dsystem-extension.html#The-package_002dinferred_002dsystem-extension
17:21:12
Bike
so i'm guessing :force t is just forcing the actually specified one, and the inferred systems work the same as the external ones
17:21:32
Bike
:force lets you explicitly specify a list of systems to force, so you could do that, but that's not super convenient
17:22:47
malice`
Bike: yes, it would depend on the class and its purpose, so I think that the discussion here would be pointless without concrete example
17:28:19
fiveop_
Looks like I'm not the first one http://asdf-devel.common-lisp.narkive.com/wExt24rn/operations-on-package-inferred-system
18:26:29
sukaeto
<lieven> CL or Ada with representation clauses are a far superior solution that unfortunately won't become popular any time soon
18:26:51
sukaeto
yeah, Ada is a great language for real time systems and for talking directly to hardware
18:35:26
sukaeto
tetero: that wouldn't surprise me - it used to see a lot of military use. Also, Ada is not an acronym - it's named after Ada Lovelace
18:36:50
tetero
sukaeto: I'm terrible at writing acronyms for languages or software consistently. I know it's Unix but I often write UNIX. I know it's Lisp but I often write LISP. Sorry ;)
19:40:24
yaroe
I've been using CL for years for various tasks. The new team manager decided to dish CL also there are some serious software written in it. Arguments are :
19:40:45
yaroe
- lisp is exotic (he knows that lisp is the official extension language of the GNU project but he don't think that matters : GNU/Linux isn 't that a key OS)
19:43:56
vtomole_
Yeah we never finished out convo yesterday, i'm trying to understand the stack machine.
19:46:29
Bike
okay, well, what i said yesterday is that compilation essentially means translating an algorithm in one universe of operations (lambda, function calls, numbers) into another (jump, bit patterns), and the latter will often be more impoverished for the sake of making it easy to execute
19:46:31
dlowe
yaroe: The best thing you can do is admit that it's not popular, and explain that it will take a lot of time (and money) to reimplement the existing CL codebase in something else, and the result will have a costly period of bugginess
19:47:24
TeMPOraL
I'd add that, on the other hand, any developer worth their salt will be able to quickly learn to read the code; learning tech on the fly is kind of what good devs do for a living
19:47:39
Bike
a computer mostly just has operations for manipulating fixed-length binary words, and somehow we get IRC clients out of that
19:49:02
tetero
TeMPOraL: I'm not sure why, but most developers I know find Lisp completely unreadable, my hypothesis is that it just goes counter to what they're used to
19:49:20
dlowe
but emphasize that there's time costs (it will cost a lot to move away), opportunity costs (you won't be able to work on other things), productivity costs (due to the increased number of bugs)
19:50:06
Bike
vtomole_: usually a closure is represented as a pointer to code (the function) and a vector (closed-over variables)
19:50:40
Bike
the vector is, say, provided as an argument to the function, and accesses to the closed-over variables are compiled as references into the vector
19:50:43
TeMPOraL
and all that "prefix notation sucks" talk really means they don't understand the evaluation order of their "mainstream" language
19:50:48
tetero
TeMPOraL: I find that with some things people just shut down. Like introducing a mathematical symbol like sigma, which is really super easy to understand if explained
19:53:18
Bike
vtomole_: that's one way. and obviously none of that is specific to it being a stack machine.
19:53:20
TeMPOraL
dlowe: true, but that doesn't change the fact on the ground: a lot of arguments for "lisp is hard to read" apply exactly the same way to the usual languages
19:53:32
TeMPOraL
which suggests that those arguments are bogus; they're rationalizations for something else entirely
19:53:34
dlowe
on the other hand, I've never seen anyone fail to get used to lisp when they depended on it for a paycheck
19:53:52
tetero
It's that I'm a fairly new Lisper and when I discovered it I happily wanted to show it to my friends, and while I'm not great at Lisp, I don't see how the parens make it hard to read at all. I'm rather happy that I don't have to use { } and ( ) all the time
19:54:00
dlowe
TeMPOraL: sure, I'm just saying that "no one here has trouble with it" is good evidence
19:54:54
TeMPOraL
also, between IRC, HackerNews and lisp events, I'm not so sure they'd have trouble finding someone to work on Lisp code
19:55:05
TeMPOraL
my impression is that there's lots of people who like Lisp and would like a job in it
19:55:21
vtomole_
Bike: How about procedures? What does ((lambda (x) (* x x)) 2) translate to on a primitive machine like x86 or stack machine?
19:56:59
vtomole_
Bike: I'm not asking for pseudocode, just the general idea of how this would be compiled.
19:57:03
Bike
well, that could be inlined as "PUSH 2, PUSH 2, MULT", or it could be "L: DUP, MULT; PUSH 2, JUMP L"
19:57:27
Bike
well, so you have some code somewhere that's the function body, and then when you want to call the function, you prepare the arguments and then jump to that code.
19:57:59
Bike
in my example "L: DUP, MULT" is the function body, and you call it by pushing the argument and then jumping to L.
19:59:35
vtomole_
Bike: How about every huge procedures? Bigger stack? Or execute it in small chunks?
20:02:30
Bike
i'm being abstract here. just assume you have infinite space for code and infinite space for a stack.
20:06:05
vtomole_
Bike: How would this:(defun square (x) (* x x)) be different on the stack machine vs the lambda expression I posted earlier?
20:10:44
vtomole_
When you call (square 4), the stack machine needs to know about the location of "square" body, right? How will a hash table help?
20:11:06
jackdaniel
vtomole_: if you are interested in such machines, you may want to read ECL bytecodes compiler/interpreter code (implemented in C)
20:11:47
jackdaniel
src/c/compiler.d and src/c/interpreter.d in the source tree (with many comments describing it)
20:13:09
p_l
vtomole_: usually the stack machine will have something like PUSH 4, CALL <address of square function>
20:15:46
p_l
vtomole_: many cases usually end up in a vector of addresses st a known location, with eqch function having a known offset from the start of the vector
20:16:18
p_l
that's how interrupt handlers are called by cpu on pretty much every computer, for example
20:18:06
p_l
vtomole_: a surprisingly good place to learn some basics of how it is all linked together in practice is old 8bit home computer manuals
20:22:09
vtomole_
p_l I'll look into those, i just found this:http://stevelosh.com/blog/2016/12/chip8-cpu/
20:26:26
p_l
Mind you, simple doesn't mean useless or slow... while MIPS might be a bit big, MMIX is pretty nice and very modern design that is still described fully in one chapter
22:50:39
TruePika
Error opening shared library floating.dll : %1 is not a valid Win32 application. .
1:08:56
defaultxr
is it possible to prevent function redefinition in the same file from causing warnings? warnings will prevent my project from compiling properly for quicklisp. i have a macro that i'm using to generate functions but sometimes i want to override one of the functions that the macro generates. putting those functions in a separate file would make the project needlessly messy and disorganized.
1:19:18
Bike
defaultxr: there are some implementation specific things to try, but i'd really recommend reorganizing your code so that the generated definition is not generated.