freenode/#lisp - IRC Chatlog
Search
2:43:14
gigamonkey
dieggsy: note, however that you almost certainly want to use the *name* convention for DEFVAR'd and DEFPARAMETER'd variables.
2:43:57
dieggsy
gigamonkey: oh, i actually sent them that way, i guess matrix did something weird because markdown syntax lol
2:52:18
mister_m
I have a list of strings I'd like to turn into a property list, is there a function that will give me an uninterned symbol to use as a "key" for a property list?
2:53:52
mister_m
sorry, to be more clear: I have a string that I'd like to turn into a symbol that will not be interned in the current package
2:59:25
dieggsy
If i'm e.g. going to generate a lambda-list in a defmacro from a list of strings should i use intern or make-symbol ?
3:01:13
gigamonkey
In general it's best not to create new symbols that are exposed to your users. Though I'm sure there exceptions.
3:02:47
dieggsy
gigamonkey: it's json, parsed with jonathan.the relevant bit looks something like ... :|parameters| '("char_id" "lang") ...
3:03:22
gigamonkey
If the symbols are going to be exposed as part of the API, you should probably INTERN them into the appropriate package.
3:03:35
dieggsy
gigamonkey: do i have to intern them though? i'm using intern for the defun name, but if i'm making symbols for a parameter list
3:03:43
gigamonkey
If they're just parameter names in the macro expansion, you can use MAKE-SYMBOL or GENSYM.
3:04:30
gigamonkey
Yeah, if the name is purely internal I'd use MAKE-SYMBOL or GENSYM. Probably MAKE-SYMBOL in this case is it seems slightly more descriptive of what you're doing.
3:06:29
gigamonkey
And you may want to further lispify the names, e.g. (mapcar #'(lambda (s) (make-symbol (substitute #\- #\_ (string-upcase s)))) '("char_id" "lang"))
3:34:28
beach
phoe: So instead of accepting the term I introduced a long time ago for a concept that otherwise does not have a widely agreed-upon name (i.e., uniform reference semantics), you introduce four new terms.
5:07:41
perdent
How can I acquire a 10 traces and plot them with a lisp plotting library, and examine them from this remote server in lisp? nc 138.68.182.108 31262
5:08:56
perdent
So I captured the embedded device that was used to encrypt the ciphers I am trying to break. How would I be able to recover its Encryption Key? here is the socket_interface: https://pastebin.com/4z0bwjAT and here is the remote lab layout: https://ibb.co/q9j59Mq
5:15:23
no-defun-allowed
You would presumably do differential power analysis on the device, which involves sending some plaintext to the device, observing the power draw, and determining something about the (otherwise hidden) intermediate values in encryption.
5:16:04
no-defun-allowed
One source suggested there is correlation between the power draw and Hammond weight (LOGCOUNT) of some value used in a computation.
5:35:42
minion
phoe: please look at semantics: For a concise definition of the Common Lisp semantics of assignments and function calls, please see http://metamodular.com/common-lisp-semantics.html
5:36:39
beach
Others can have a look as well of course, and I would appreciate feedback. But I am not going to redefine established terms.
6:17:04
beach
If "value" means "not a pointer", then some expressions when eVALUated, do not return a value.
6:20:12
phoe
beach: when people ask in terms of C++ semantics, then Common Lisp is neither C++-call-by-value nor C++-call-by-reference
6:21:16
beach
My page explains what Common Lisp does, using well established terms, and making references to other languages. That I think, is the best way of presenting the ideas.
6:22:24
beach
I also think that people, be it C++ programmers or others, who ask about Common Lisp semantics, do so because they are willing to learn established terminology. And we should not disappoint them.
6:23:07
phoe
I try to describe what CL does by comparing and differentiating it with what C++ does, and I consider that to be the best strategy
6:23:17
beach
Since I whipped up that page rather hastily, the details may not be great, but I think the basic idea is there.
6:25:08
phoe
beach: and established terminology is that looking up "call by value" in Google produces a page whose 70% results are things that you don't care about
6:26:27
phoe
yes, and I'm translating from what Google says to what Lisp does, whereas you explain what Lisp does without using any of this
6:26:52
beach
There might even be a significant correlation between people who write things that Google picks up, and people who are not willing to study the literature of computing.
6:28:27
no-defun-allowed
Just saying (as I was jogging my brain for Lisp implementations which interpret, to measure the performance of my own), you have a whole lot more to get C++ programmers to unlearn than the lack of uniform reference semantics.
6:28:36
phoe
I don't think it's a good approach to say that if a C++ programmer wants to learn Lisp, they should first study the literature of computing instead of using Google to learn by differentiation
6:29:24
jdz
Pretty sure this has been a common suggestion here that "learning by differentiation" is a mistake and should be abandoned from the very beginning.
6:29:25
phoe
there was this idea of a book, Lisp for C++ programmers, that basically tries to teach by pointing out all the differences
6:31:34
no-defun-allowed
I have been wondering if differentiation makes it easier or harder for the reader to think they can get away with re-using C++ concepts unless otherwise stated.
6:31:45
engblom
When I see something like (declare (ignore obj)), is it a line that could actually be removed and the program would do the same thing?
6:32:35
phoe
(lambda () 42) and (lambda (&optional x) 42) both do the same thing when called with zero arguments, but one of them can cause the compiler to warn you that you might have forgotten to use a variable that you established
6:33:30
phoe
no-defun-allowed: people are going to reuse language concepts all the time via reflexes, that's the whole problem of learning X as a second language - no matter if it's a language for programming or a talking
6:33:57
phoe
and I can attest to that as neither English nor Lisp are my "native" programming languages
6:34:30
phoe
so I guess that the best thing to do here is point all of the differences out and make sure that the C++ programmer reading the book remembers that this, this, and this is explicitly done differently in Lisp
6:35:05
jdz
phoe: In my experience that's only when learning the second language. After that this reflex diminishes with each additional language one learns.
6:38:05
jdz
It just might be worthwhile to help people become aware of this phenomenon (and fight it) than to play along and hope for the best.
6:39:13
jdz
I'm afraid that in this case a C++ person will play around for a while and then declare something like "Lisp is really weird, everything's wrong and in the wrong places. I'm going back to C++!"
6:41:11
phoe
jdz: how does one fight it? achieving a real beginner's mind is a pretty daunting task on its own and I don't think it can be expected of everyone who wants to learn Lisp
6:41:11
jdz
Yes, in this case the person might stick with Lisp, but it might take quite a while for them to start "thinking in Lisp". And quite a bit of damage might be done along the way.
6:42:28
jdz
phoe: Learning a new thing is not easy, yes. But trying to teach somebody Arabic by telling "it's just like English, you just write from right to left."
6:42:35
saturn2
maybe C++ programmers need a whole book on unlearning C++ before they even start on anything else
6:42:46
Nilby
On the other hand when I did C++, I tried to make it do keyword arguments, fake lambdas, and GC.
6:43:41
Duuqnd
A company I've worked with used code generation of c++ which felt a lot like poor man's macros to me
6:44:16
Nilby
My rage at the C++ committee was nearly at the level of my admiration for the CL committee.
6:44:31
no-defun-allowed
Reminds me of a tutorial book that was posted to #lisp which (at least) beach and I reviewed. The first declaration was declaring some variable to be a FIXNUM.
6:45:05
moon-child
phoe: to make an analogy to natural language, it's generally considered a bad idea to learn by translating--by modeling forms in the new language in terms of the forms of one's native language. One should rather attempt to think natively in the new language, without bias
6:45:14
ecraven
I sometimes envy c++ for things like https://github.com/nholthaus/units. not sure how to do that sort of compile-time checking in any Lisp (which might be entirely my fault ;)
6:45:30
moon-child
I think programming languages are different from natural languages in many respects, but that there is an extent to which the same principle applies
6:46:19
Nilby
Duuqnd: In the old days when I was doing it, you were nearly forced to do some pre-processing. e.g. QT used to have to pre-process to do callbacks right.
6:47:15
jdz
ecraven: You might find this article series interesting: https://medium.com/@MartinCracauer/a-gentle-introduction-to-compile-time-computing-part-3-scientific-units-8e41d8a727ca
6:47:19
Duuqnd
I can't show any code examples of what this company did since I'm under NDA but it was big files of code completely auto-generated based on XML files.
6:50:35
jdz
phoe: There is value in such books, but they should tell outright that they're just a crutch (or training wheels), until one learns to think in the new language properly.
7:22:12
beach
But it only sort-of works, since Emacs has no idea about the role of different identifiers in different contexts. So you will likely get suggested completions that are completely wrong.
7:22:47
phoe
engblom: I have company-mode installed which shows all possible completions, along with slime-company
8:07:33
engblom
I have been trying to find any documentation for slime-repl with all the shortcuts. In particular I am trying to find how to run something again that I run earlier. I know I can scroll past all output until the cursor is on the form I want to run and then press enter, but that is too much work. How to I get the history without having to scroll?
8:08:40
engblom
Would it be easy to remap that to something else? M-p will open dmenu (as I am using xmonad as window mangaer)
8:09:24
engblom
Preferable I would want up and down arrow in slime-repl for history and page-up and page-down for scrolling.
8:09:27
beach
M-p is used in many many Emacs situations, so it would probably be better to remap what xmodad uses.
8:10:52
beach
engblom: It is generally faster to use keys that are easily accessible without lifting your fingers from the home row on the keyboard.
8:13:22
beach
Maybe when I officially retire in a bit more than 9 months, I should also retire from #lisp.
8:14:19
engblom
Anyway, xmonad is heavily using alt-key already and as I need xmonad functions more often than emacs functions, I want to keep alt as reserved for xmonad. This means I need to change emacs to work with xmonad.
8:15:07
engblom
beach: I came from vim. But I got told that I better use emacs those times I write lisp.
8:15:44
beach
engblom: It was a sarcastic remark, related to the fact that a lot of things I suggest lately are criticized.
8:17:05
no-defun-allowed
Generally that is the window manager key (Windows even provides some shortcuts using it as a modifier) and no application will provide shortcuts using it.
8:17:15
engblom
no-defun-allowed: It is too uncomfortable to use window key as often as I have to use for window manager (as the thumb has to go under the hand). I still think I could use it for emacs as I more seldom need M- there.
8:17:49
Nilby
One trick is to use Control-Meta-<> for window manager things and if you need it in emacs do Escape Control-<>
8:33:16
xificurC
http://www.lispworks.com/documentation/HyperSpec/Body/f_rm_dup.htm states "The order of the elements remaining in the result is the same as the order in which they appear in sequence."
8:34:42
no-defun-allowed
Unless you do (remove-duplicates '(1 2 1 3) :from-end t) in which case you get (1 2 3)
8:34:54
moon-child
xificurC: the elements 2, 1, and 3 all appear in that order in the original sequence
8:37:28
beach
xificurC: "if any two match, then the one occurring earlier in sequence is discarded."
8:40:25
beach
xificurC: Here the first and the third elements match, so the first is discarded. If you want the second one to be discarded, then yes, use :FROM-END T. Maybe your example is confusing because you have a partial numeric order, which has nothing to do with what this function does.
8:49:15
jdz
It might also help to use different items, and tweak :test and/or :key parameters. Like (remove-duplicates '("one" "two" "ONE" "three") :test #'string-equal).
8:53:02
engblom
I also got a good solution for my meta-key problem: I wanted to still use the physical alt-key for window manager, so I swapped with xmodmap alt and windows, and then configured xmonad to use windows. Now the physical windows key is alt in emacs.
8:56:25
engblom
beach: As I am not using American keyboard, I can not get [ without using Alt Gr (=right alt).
8:59:08
engblom
Anyway, now things are working for me. Thank you for putting up with the frustrating of helping me with these maybe odd things.
9:19:56
White_Flame
it's been many years since we had an ACL license, and I don't remember .cl at all :)
9:22:29
moon-child
.lp, maybe. (l)ist (p)rocessing. But I agree .cl is optimal if you're strictly 8.3
10:28:38
pyc
Is there a way to create a local variable in the current scope? I know LET but LET requires me to open a new scope and if I need LET within LET, then the code becomes deeply nested. Is there a way to do something like (setq-local foo "value") such that it is defined in the current DEFUN but not defined in the global scope?
10:29:33
no-defun-allowed
You could write (let (x) ...) to leave X "uninitialized" and then set it later.
10:29:50
no-defun-allowed
By "uninitialized" I mean it will be bound to NIL, but the expectation of the reader is that it won't be used until it is set.
10:37:12
pyc
Okay, Understood finally from here: http://www.lispworks.com/documentation/HyperSpec/Body/s_let_l.htm When there is no init-form, the extra parentheses isn't required.
11:29:35
White_Flame
pyc: &aux in the lambda list will create variables for the DEFUN scope without LET
11:34:43
White_Flame
but any lexical variable is generally modelled equivalently, all can be rewritten as ((lambda (local1 local2...) ...) init1 init2...) in the current scope
11:44:20
phoe
there's a nasty edge case if variables are named after lambda list keywords but most of the time you don't need to care about it
11:57:24
White_Flame
just does more runtime parameter checking to support &optional, &key, etc if present
11:58:13
White_Flame
if you mean the example above, one would hope the compiler would inline literal lambda usage like that
12:00:40
White_Flame
check that there's 1 parameter, else error. put parameter into return value. return
12:01:44
White_Flame
and the fasl isn't a compiled snapshot, like a saved image is. It's fast-loading instructions to do the same that the toplevel stuff does
12:04:30
White_Flame
of course, for something that small you'll probably be looking mostly at the function epilogue, especially if the 1st parameter & return registers are the same
12:06:33
White_Flame
there might be some environmental differences that cause codegen change, like having everything available in a single compilation unit or not
12:10:26
White_Flame
and if you had macros in your fasl files, they'd still evaluate at load, and if they read global vars or config or anything, they'd generate different machine code based on what was there at time of .fasl load
12:16:04
nij
Hmm.. so how to compile is not in spec, and dependent to each implementations.. I guess I have to study the source of sbcl then.
12:23:37
nij
I see.. it seems like the magic is hidden in https://github.com/sbcl/sbcl/blob/d35ad6f9bee212499cb827fec3195bf2064c10a2/src/compiler/target-disassem.lisp#L2060
12:23:57
Nilby
Just read to code to a lisp compiler. You don't have to fully understand it to get an idea how it works.
12:26:43
White_Flame
I meant to run DISASSEMBLE and look at the output, not read DISASSEMBLE's source code ;)
12:27:27
White_Flame
there's also sb-disasm:disassemble-code-component which can display more componentry, like function prologues, that disassemble on its own might elide
12:30:37
Nilby
For example you can see sbcl defines compilation in terms of VOPs or virtual operations, which are like a macro template for generating platform specific code. Operations in lisp are defined to be a set of these virtual operations which have various properties, pre/post conditions, etc. Then these are evntualy refined down to platform instructions in lisp objects, which can be turned into bits and stored in memory and executed or
13:12:53
beach
Suppose we had a parsed and exploitable version of the dpANS. I mean, we don't but such a thing could be had if enough effort were put into it. If we did have such a thing, how should it be managed?
13:13:02
beach
I feel it would not be advantageous to have a multitude of clones and individual modifications to it. What would we use it for?
13:13:08
beach
I can see at least a better Common Lisp UltraSpec, i.e., a free version of the Common Lisp HyperSpec with better markup.
13:13:14
beach
I can also see a version of it in the form of an object graph as I have suggested many times for documentation representation.
13:13:15
beach
And I would like to use such a thing for WSCL, i.e., create a more specified specification that would then also keep (as footnotes maybe) the original wording of the standard, and explain the differences. Any suggestions?
13:17:26
jackdaniel
re managing: there should be a trusted authority to moderate it (i.e to remove spam or to resolve conflicts)
13:17:56
Nilby
I just want to be able to access pieces of it in development tools, and be able to control how it's presented. But I support all those other uses.
13:19:20
pyc
do you ever use the format control "~d"? I see "~a" suffice for most situation. Is it a good practice to use "~a" all the time and use other format controls only when we need to?
13:19:48
jackdaniel
re different versions of the same part of the document - either there are different versions linked in the same page (I'm not sure what to do with footnotes - they may not apply to the implementation-specific version)
13:20:41
jackdaniel
or there is one "base version", and implementation-specific things go after that under different sections
13:22:00
nij
I just fancy a better presentation will drag more people into #lisp. But I support all those other uses.
13:22:17
beach
I am paying attention to all suggestions, and I may ask questions about them, but I am not going to argue a particular idea myself at this point.
13:26:10
beach
nij: More people will use Lisp when it starts being taught in more undergraduate programs in computer science. I am now of the opinion that any such undergraduate program should teach Common Lisp, or something similar, in order to be considered as such. I don't know of a single person who thought about using Common Lisp and then decided against it because of the markup of the Common Lisp HyperSpec.
13:26:40
beach
xificurC: Sure. Did you try the suggestion with strings to see what it does? I think that was a clever idea.
13:26:43
nij
If I become a professor, I will volunteer teaching in CL. But before that I must have polish my skills xD
13:27:43
beach
xificurC: With that example, the duplicate elements are distinguishable, but they are still considered duplicates because of the comparison function.
13:28:00
xificurC
beach no but I understand what's going on now. I still find the wording I quoted utterly misleading though
13:55:35
beach
Would there be reasons to grant access selectively to a parsed dpANS? It would be "easy" to accomplish, since the result of the analysis would be automatically subject to copyright according to the Berne convention. If so, what kind of access would be granted/refused?
13:56:06
beach
It may require legal actions to enforce, of course, and funds for such actions may not be available.