freenode/lisp - IRC Chatlog
Search
3:36:17
drmeister
This is a one year old macbook pro that Apple gave me to replace my previous one a year ago that also had mysterious, irreproducible video issues.
3:37:18
drmeister
Today was terrible. I'm going down to Washington on the train to give an important talk at the Department of Energy (seriously) and my laptop keeps crapping out on me.
3:37:47
drmeister
It's a good thing I went down with a colleague - I was able the get the presentation converted to Powerpoint and on to his Lenovo.
3:39:13
drmeister
I was contemplating a drive by the Apple store and throwing it on their doorstep. Then I remembered that I'm born Canadian and we are raised better than that.
3:40:45
drmeister
I hate irreproducible hardware problems. Just break already and I can get it fixed.
3:41:21
drmeister
I've got it sitting upstairs with the screen black and I'm going to let it run all night. Maybe there's some tin whisker on the motherboard that will fry the thing.
3:43:04
nyef
I at least used to have an intermittent screen-going-blank issue, but I always figured it was software. It hasn't happened since my last full reinstall, so I'm hoping it's gone for now... And I have a new computer coming at some point anyway.
3:44:07
nyef
(Well, somewhat software, I figure the embedded controller was killing power to the entire video system for some reason.)
3:47:17
drmeister
There were issues with specials not being recognized as such and one case where an (eval-when (eval compile load) ...) wasn't being evaluated.
3:49:44
drmeister
I'd like to generate some HIR and start converting HIR to LLVM-IR. I'd like to have a taste of how that is going to work.
3:51:25
drmeister
You put a "meister" directory in SICL - I presume that was copied from my fork? I'm trying to wrap my head around how that works with my fork and your original and whether I should keep the fork or what.
3:52:08
drmeister
I thought the fork would be useful because I can push changes into it and then you can compare the changes to your code and decide whether they are a good idea or a bad idea.
3:53:07
drmeister
Hmm, well then I'm confused. When I fetched your upstream changes and rebased them into mine there were messages about the "meister" directory. I must have misinterpreted them.
3:53:37
beach
But I told you already that the PRINT-OBJECT method specialized to a condition is not how I would have done it.
3:53:51
drmeister
Good, well, that's one less thing to have to wrap my mind around. It's so flexible at this point I can tie it in a bow.
3:54:31
beach
However, because you did create that method, I am now considering putting in enough infrastructure for internationalization.
3:54:39
drmeister
What was the problem with what I did? You said there were constraints on print-object for conditions.
3:56:45
drmeister
Was "internationalization" a result of autocorrect? Or do you mean to support different languages for error messages?
4:01:54
drmeister
I'm trying to figure out what the point of not printing conditions when *print-escape* is.
4:04:07
beach
But it would be recommend to define print-object methods as if the :report had been given.
4:06:44
drmeister
I see, I'm confusing the :report option with the print-object method. They can be two different things. Providing an argument to :report generates a print-object method and then explicitly providing a print-object will override that method.
4:08:14
drmeister
Or do I still have that wrong. You are saying that a :report can be given AND a print-object can be provided. Or does the print-object specialized to a condition replace what is generated by the :report option?
4:11:05
drmeister
In ECL CLOS there is a print-object method specialized to CONDITION. That method looks up the 'report-function slot of the condition and if its a string it prints it and if its a function it funcalls it.
4:13:10
drmeister
So a print-object method specialized to a condition derived from CL:CONDITION will be called first and if it invokes call-next-method then the default behavior specified by the :report option will be carried out.
4:15:27
stassats
ok, everything, i was saying that it should do only about the last part of your sentence
4:15:29
beach
In SBCL, when I do (define-condition bla () ()) and then (make-condition 'bla), the result is printed using the #<BLA ...> syntax. *PRINT-ESCAPE* is T
4:18:55
beach
drmeister: It looks to me like the default method on PRINT-OBJECT specialized to CONDITION should use PRINT-UNREADABLE-OBJECT.
4:21:13
drmeister
If *print-escape* is T then it invokes (call-next-method) which probably invokes PRINT-UNREADABLE-OBJECT.
4:22:22
stassats
either way will be equivalent to what clhs describes, as long as you don't expect the method dispatch that clhs describes
4:23:17
stassats
as long as you don't write any print-object methods yourself, you can't notice a difference
4:25:33
beach
drmeister: So in ECL/Clasp, when you define a new condition with a :REPORT init, no new method is created?
4:26:59
drmeister
I don't think a new method is created. The only place print-object is mentioned in the conditions.lsp source file is in that (defmethod print-object ((c condition) stream) ...)
4:27:56
drmeister
The :report argument gets put into the 'report-function slot and that print-object method specialized to CL:CONDITION reads that slot.
4:31:23
loke
Xach: assuming you're reading messages after you wake up: I've created the two bug reports on zs3 now.
4:32:03
beach
And then: (compute-applicable-methods #'print-object (list (make-condition 'bla) *standard-output*))
4:34:57
beach
"Specifying (:report report-name) in the definition of a condition type C is equivalent to: ..."
4:38:13
beach
But at least I now understand the reason for the different interpretations of the Common Lisp HyperSpec.
4:44:32
nyef
beach: CLHS 9.1.3 also seems relevant, plus a restriction "* The :report option of define-condition, not defmethod for print-object, must be used to define a condition reporter." from the page for Condition Type CONDITION.
4:49:26
beach
This discussion deserves a chapter in my book "Common Lisp for Language Implementers".
4:50:53
beach
drmeister: So I was wrong about the restrictions you have to respect when writing a method on PRINT-OBJECT for reporting those conditions. You aren't even allowed to write such a method.
4:54:36
nyef
beach: You might also be right in your expectation vis-a-vis compute-applicable-methods, though.
4:55:33
nyef
It'd be another matter if print-object were defined to be a generic function rather than a standard-generic-function.
4:57:38
nyef
stassats: I wouldn't know either way, but compute-applicable-methods only has behavior defined for standard generic functions.
4:58:07
specbot
compute-applicable-methods: http://metamodular.com/CLOS-MOP/compute-applicable-methods.html
5:02:17
beach
murftown: You use SLIME and then press "v" on your stack frame. You don't use line numbers.
5:04:32
beach
This is how I am thinking of doing internationalization: Define a LOCALE class containing lots of things like printing dates, but also an instance of the class LANGUAGE. There is a *CURRENT-LOCALE* variable. There is a condition INTERNATIONAL-CONDITION with a :report of REPORT-CONDITION which is a generic function that is called with the condition, the stream and the value of (LANGUAGE *current-locale*).
5:05:26
beach
Client code can use INTERNATIONAL-CONDITION as a superclass and write methods on REPORT-CONDITION specialized to their favorite language.
5:07:38
nyef
... I can't think through the condition and :report logic and whatnot right now, but one thing that does come to mind is that "localized-condition" might be a better name than "international-condition".
5:08:19
beach
Client code can of course choose not to use INTERNATIONAL-CONDITION in their own condition types. And they can override the behavior by creating a subclass of a condition that *does* use INTERNATIONAL-CONDITION as a superclass, just by providing their own :REPORT.
5:08:41
nyef
Reason being that even within a nation, you can have different localization requirements (consider Quebec!), but you can also have multiple nations sharing the same locale in some sense.
5:09:30
beach
I am constantly trying to get dates printed in ISO8601, messages in English, and wind speeds in m/s.
5:10:47
Zhivago
One interesting point that you might have missed regarding i18n is that input and output can often have different localization requirements.
5:11:19
stassats
but people in the same city can speak different languages, so, how localized is it?
5:15:10
beach
I feel my day has already been very productive, even though it has lasted for only 2 hours so far.
5:15:25
Zhivago
Hmm, I guess anything you do using specials for i18n is doomed to probably suck pretty hard, regardless.
5:16:21
nyef
Okay, it's late, I'm going to wish you all progress on your projects and luck wherever you need it, and head to bed.
5:21:56
drmeister
beach: When I (asdf:load-system :cleavir-ast-to-hir) the :cleavir-env package doesn't get defined. Is that to be expected? Should I also need to (asdf:load-system :cleavir-generate-ast)?
5:27:01
drmeister
(asdf:load-system :cleavir-generate-ast) (asdf:load-system :cleavir-ast-to-hir) works now - thanks.
5:30:42
drmeister
beach: When you get back I tried: (setq ast (cleavir-generate-ast:generate-ast '(let ((x 1)) (+ x x)) *clasp-env*))
5:32:29
drmeister
I'll be up for a little while longer if you get back in time. Otherwise I'll talk to you tomorrow.
5:54:14
drmeister
You were generating HIR a while ago. Is the expression above using the new multiple value return stuff you just added?
5:54:20
murftown
hey so you know how #'foo represents the function foo not the variable foo? How can I get #'somevar where somevar gets evaluated to a symbol name?
5:56:28
beach
murftown: If you just type somevar, it means the variable with that name. It doesn't get EVALUATED TO the variable with that name. When evaluated, it returns the VALUE of the variable with that name.
5:57:17
murftown
beach: but that's what I have is somevar whose value is a SYMBOL, i.e. a potential name for a function
5:58:12
beach
murftown: Let me get this straight. You have a variable, and the name of that variable is a symbol. That symbol is the name of a function. Given the variable, you want to return the function?
6:13:40
murftown
stassats: well it solved my problem. I already tried (funcall somevar arg1 arg2) but it didn't use the function namespace for somevar
6:21:12
murftown
stassats: ok, I see it doing mostly the same thing, but I still can't fix my code to work without fdefinition for some reason
6:26:33
murftown
beach: sounds good. if interested I'd be happy to show you guys what my use-case is here. I created a macro called cpnd-funcall that allows me to input a list as a "function name", and it will call the function with the same name, i.e. (cpnd-funcall '(hello func with compound name)) will call function #'|(hello func with compound name)|
6:57:20
murftown
how can I turn a list (a b c d e) into one where each element is quoted, ('a 'b 'c 'd 'e) ?
7:00:07
loke
It prevents evaluation. If you have a list (a b c d e) there is no evaluation going on, unless you pass it to EVAL
7:08:28
murftown
Zhivago: whoa, really! I was looking for something like that but I can't wrap my mind around that yet
7:20:13
loke
I have a need to do basic source code highlighting in Coomon Lisp. Anyone know of any packages that can do this?
7:36:44
siwica
I am currently learning lisp. What would be a good programming project that I could do to learn it?
9:19:28
wasamasa
siwica: like, if you notice some day that there's not a single decent epub reader for linux desktops, you go ahead and write one
9:20:04
siwica
wasamasa: I have some experience with languages in other paradigms, so I wonderes if there are a few "canonical" beginners problems for functional languages.
9:20:11
wasamasa
siwica: because you've been bothered enough by it to turn it into a project for yourself
9:21:56
wasamasa
in fact, I'd call it the lisp dialect furthest away from FP, simply because you're forced to modify global states to get anything meaningful done :P
9:23:23
wasamasa
siwica: if you want to discuss other lisp dialects than common lisp, I encourage you to strike up a conversation on ##lisp or the respective channel of that lisp dialect (for elisp, that would be #emacs)
9:23:24
|3b|
siwica: this channel focuses on common lisp (and interprets 'lisp' on its own as common lisp), which supports lots of programming paradigms to varying extents
9:24:36
wasamasa
siwica: if you want to learn a language that's supporting FP only, take a look at haskell
9:29:40
|3b|
from what i've seen, people talking about function programming with "lisp" usually mean some subset of scheme
10:12:59
didi
Is there a convention for using comments on top of lisp libraries, specially single file ones?
10:45:14
Shinmera
Ah, I missed you, old friend. http://shinmera.tymoon.eu/public/screenshot-2014.11.19-11:44:48.png
11:16:18
pjb
minion: memo for Shinmera: since setting an undeclared variable is implementation dependant, an implementation could define automatically _lexical_ variables for them, so you may have fun at the REPL and keep your programs working. But this would need additionnal code in the implementation.
11:43:23
pjb
Zhivago: beach set up a lisp project list! http://metamodular.com/Common-Lisp/suggested-projects.html
12:13:30
Shinmera
pjb`: I'm still confused a bit. If I say define a function that uses some variable that is neither lexically bound nor declared special and then later use defvar, are the consequences implementation dependant?
12:13:30
minion
Shinmera, memo from pjb: since setting an undeclared variable is implementation dependant, an implementation could define automatically _lexical_ variables for them, so you may have fun at the REPL and keep your programs working. But this would need additionnal code in the implementation.
12:18:31
francogrex
hi, in a program some arguments are passed as keyword: for example (r% "rownames" NONRBIND :do.NULL nil) but the case of the keyword matters for example: ;R! Error in function (x, do.NULL = TRUE, prefix = "row") ;R! unused argument(s) (do.null = FALSE)
12:19:32
francogrex
as you can see I must pass do.NULL as it is and not do.null as it is being translated to be passed to the receiving app. Can it be done to "fix" the case of the keywords
12:20:30
|3b|
pjb: is accessing non-existent variables specified somewhere to be implementation dependent as opposed to undefined?
12:23:44
|3b|
other option is tricks with reader case, but unless you have a modern-mode lisp that would probably be annoying too
12:24:14
|3b|
(either you would have to type everything else in upper case, or you would have to type :DO.null to get "do.NULL")
12:27:38
|3b|
so if it prints as "do.null" you are discarding any case info in the symbol, and putting 'correct' case in the symbol name won't help
12:51:37
francogrex
Xach: I am passing args keywords and the app wants them in a specific case: (r% "rownames" NONRBIND :do.NULL nil) => ;R! Error in function (x, do.NULL = TRUE, prefix = "row"): unused argument(s) (do.null = FALSE)
12:52:29
alpha-
they propose tag filesystem instead of hierarchical - you can do thi in linux if you wanted
12:53:31
alpha-
they propose unified memory with ram ascache but the point us unclear since linux kernel already caching read data in ram
12:54:19
Shinmera
In that case it's your wrapper's job to translate the keywords into the proper case.
12:55:25
Shinmera
alpha-: If the three gazillion different file formats are not a good enough proof that serialization is a problem, I don't know what is.
12:57:14
|3b|
francogrex: either do (eql :|a| :A) => nil, or configure the reader to preserve or invert case
12:58:04
|3b|
francogrex: just keep in mind that preserving case means you need to type all CL symbols in upper case, and inverting case will invert case which you would need to undo when printing
13:00:58
Shinmera
Or you have to wrap it. (defun r-rownames (&key do.null) (r% "rownames" NONRBIND :|do.NULL| arg))
13:04:16
|3b|
'racket' implies a specific scheme implementation + extensions and extra libraries, so not quite as direct a comparison to CL as a language
13:21:25
francogrex
|3b|: you expected :do.Null to be transmitted as :DO.NULL but I think the programmer has placed a code that converts the cases to downcase before passing it on to R: this in his source: (string-downcase (substitute #\_ #\- (symbol-name arg)))
13:22:26
Shinmera
francogrex: in that case no matter what kind o symbol is read it's not going to end up being the right case.
13:24:50
francogrex
the programmer assumed all args are downcase because in general they are, except for that 0;1% situation
14:23:25
schjetne
I've been thinking of doing a toy Lisp 1.5 implementation as a bit of historical re-enactment
14:33:49
schjetne
The predecessors to Common Lisp, but I guess any legacy code still in use has been ported to CL
14:34:45
schjetne
That was one of the objectives of CL, to make transition from older dialects as smooth as possible
14:48:15
pjb
|3b|: it's undefined. Implementations are free to implement whatever they want in this case: signal an error, create a special variable, create a lexical variable, launch a ballistic missiles onto the programmer, whatever.
14:48:59
pjb
|3b|: most implementations seem to find useful to create a special variable. I would argue that it would be more newbie friendly, and otherwise REPL user friendly, to define a (global) lexical variable.
14:49:43
pjb
Shinmera: yes, if you define a function with a undefined free variable, and later define it, it is undefined, implementation dependant, what may happen.
14:52:13
pjb
alpha-: this is not htat crazy: http://wiki.osdev.org/Main_Page http://micropenguin.net/files/Other/OS/os-dev.pdf
14:54:31
pjb
minion memo for francogrex: you can restore normality with (|SETF| (|READTABLE-CASE| |*READTABLE*|) :|PRESERVE|) and thereafter, write the CL symbols in uppercase: (DEFUN myfun (&KEY do.NULL) (PRINT (LIST 'hi do.NULL))) (myfun :do.NULL 'Lo)
14:55:08
pjb
minion memo for francogrex: cf. also my emacs commands upcase-lisp and upcase-lisp-region.
14:59:57
pjb
schjetne: legacy code doesn't have to be converted to run in Common Lisp in a lot of cases. cf. eg. http://www.informatimago.com/develop/lisp/com/informatimago/small-cl-pgms/wang.html.in
15:00:37
pjb
schjetne: but of course, if you want to make it evolve, you would better upgrade it to CL.
15:02:38
pjb
You store the element with (setf aref), or you adjust-array the array. You can't do both at the same time.
15:03:12
pjb
Of course you can wrap both operations in a single function of yours, but notice how adjusting a 2D array in general will not create a single new slot, but a whole column or a whole row!
15:05:20
pjb
schjetne: Notice however, that sometimes some porting may be needed. One thing is that in old lisps, bindings are always dynamic, so you often have to add special declaration (or thru some macrology, since they're expected to be implicit). Another problem is when you're dealing with an old lisp that is a lisp-1 (again solvable thru macrology).
15:06:18
pjb
schjetne: and finally, in some old lisps, some datatypes allow accessors reserved nowadays for different types. Notably, (CAR symbol) and (CDR symbol) (with the corresponding RPLACA/RPLACD) were meaningful in some lisps! (cdr symbol) would give the plist.
15:07:27
pjb
But I would say that such macrology is good as long as you only want to run a small legacy function. If you had a big legacy system using a lot of those dialect specific features, you'd want to go metalinguistic, and re-implement the old lisp (or indeed, port the code).
15:07:59
pjb
Notice how Norvig re-implemented the algorithms in Common Lisp in PAIP, instead of running directly the old code.
15:08:48
schjetne
When you say the cdr of a symbol gives a plist, is that a property list of things bound to the symbol?
15:09:23
pjb
But in old lisps, the symbol name, the symbol value, the symbol functions, etc, were stored on the plist too.
15:10:30
drmeister
Does anyone use "magit" on emacs? It opens COMMIT_EDITMSG to edit a message - how do I save/close that buffer to continue the commit? I'm committing Common Lisp code.
15:12:00
schjetne
pjb: I haven't really looked much into all the different symbol cells, I should probably do that.
15:18:51
axion
when vector-push-extend needs to resize the underlying storage, how does it do so? increase by 1, by initial storage length, or?
15:20:52
Shinmera
"vector-push-extend new-element vector &optional extension" "Extension is the minimum number of elements to be added to vector if it must be extended."