freenode/#lisp - IRC Chatlog
Search
22:45:17
dieggsy
Nilby: would you happen to know if i can make an easy handler send a response and *then* shut down the hunchentoot server too?
22:45:55
dieggsy
the way i understand it the easy handler depends on the last return value as opposed to some kind of send-response function, so i don't see that working either
22:48:59
loli
I've never really gotten over the gensym issues like this in the past, since the language doesn't help. saturn2 I guess what we could do is declare a package for these functions to live, so it doesn't clash, sadly we can't gensym that namespace
22:52:08
Nilby
dieggsy: This seemed to work (bt:make-thread (lambda () (sleep 5) (hunchentoot:stop hunchentoot:*acceptor*))) or I guess you could just call (exit) or something.
22:55:44
loli
I'll complete this extension later, I at least have a plan to fix it, thanks again saturn2
23:01:08
saturn2
loli: i think there's probably a way to make it all work by using load-time-value, but it's tricky...
23:10:42
josrr
dieggsy: maybe you can use hunchentoot:send-headers; it returns a stream where you cand send de response. https://edicl.github.io/hunchentoot/#send-headers
23:26:53
saturn2
loli: okay i guess i was wrong, there's no way to make the load-time-value trick work in a deftype, it only works in a regular macro or symbol-macro
23:27:20
loli
how does that work, saturn2, I've had this issue when I tried implementing module functors into CL before IIRC
23:28:07
saturn2
well, if you need your macro to have persistent side effects, you can make it expand to (progn (load-time-value (side-effects-here)) (other-stuff))
23:31:42
saturn2
but in that case you might as well just give your custom type predicate a symbol name and use regular defun
23:32:17
loli
do hygenic macros help at all? I know Racket has a reflective tower with their macro system
23:33:25
loli
it seems a lot of research has gone into pushing hygenic macros, I think they are much stronger, but I lack enough scheme knowledge to see how they got their tower of abstraction
23:34:25
dieggsy
i dunno about stronger, pretty much every scheme will provide unhygienic macros as well cause there's some things you can't do with hygienic macros
23:35:39
loli
but the interesting thing is, he mentions in a number of his articles about better composing macros
23:35:48
saturn2
i always thought hygenic macros mostly just saved you from having to type alexandria:once-only
23:37:35
saturn2
what you would need is a way for a macro to hook into the loading mechanism and do stuff when the containing file is loaded
23:37:54
loli
http://okmij.org/ftp/Scheme/macros.html#ck-macros I believe here he mentions the CPS style passing they typically do. But I believe Racket provides good kinds of abstractions for this as well
23:39:06
Bike
i think the problem is just that CL's type system can't do what you want it to do, rather than anything about macros exactly
23:40:39
dieggsy
i know i could just write one, but is there a standard CL way to denote a bytestring
23:45:17
dieggsy
cool, that does work. send-headers and stopping within the handler also seems to be working. neat
23:46:11
dieggsy
saturn2: eh, it's simple enough i'd rather not pull in another dep, but that's a good library to keep in mind, thanks
23:48:26
josrr
dieggsy: hunchentoot depends on flexi-streams; you can use flexi-streams:string-to-octets
0:13:19
nij
,tell beach : Have you found out how to use CommonDoc to parse Scriba, say the example in this page? http://commondoc.github.io/docs/formats.html
0:27:59
nij
::notify beach : Have you found out how to use CommonDoc to parse Scriba, say the example in this page? http://commondoc.github.io/docs/formats.html
0:29:07
Colleen
Unknown command. Possible matches: 8, set, say, mop, get, block, time, tell, roll, help,
0:29:10
Colleen
Unknown command. Possible matches: 8, set, say, mop, get, block, time, tell, roll, help,
0:29:31
Colleen
minion: Unknown command. Possible matches: 8, time, tell, set, say, mop, get, tell to, have a, grant,
0:29:39
Colleen
See 'help about' for general information. Try 'help X' to search for or retrieve information about a command.
0:29:53
Colleen
Command Syntax: tell USER &STRING COMMAND
Documentation: Show someone else the output of a command.
0:42:18
srandon111
i heard that common lisp support in netbsd is poor and that it does not support threading
0:43:37
gourdhen
it's just I notice you guys spend a lot of time talking about the gc - and not talking about lisps without gcs
0:45:18
no-defun-allowed
And then the performance of some memory manager that isn't a GC can be way worse, and often even more unreliable (unfair comparison: average reference-counting implementation vs. Metronome on a bad day).
0:46:06
no-defun-allowed
Bike: https://github.com/carp-lang/Carp/blob/master/docs/LanguageGuide.md#dynamic-functions says you get lists at compile-time.
0:46:09
gigamonkey
But (based on skimming the docs) if you want a static, no gc language for interrop with libs in some environment in a Lisp dialect (so you can have macros) their thing seems fine.
0:46:30
gigamonkey
I have never heard of it before today so I have no idea how good the thing actually is.
0:46:34
no-defun-allowed
That's the other thing - I don't want to be caught dead with a static language.
0:48:24
no-defun-allowed
gourdhen: In short, the GC is a pain if you have a bad one, but not having one is more of a pain.
1:00:06
moon-child
I think it's more that a language without a gc either leaks or has fundamentally different semantics than what you would expect from a lisp
1:02:02
no-defun-allowed
I mean, you can call it Lisp or "a dialect" or even "an exo-lisp" or whatever crap people say, it still looks awful to write any programs with.
1:04:32
no-defun-allowed
Wonder how well a Haskell "dialect" with dynamic types and mutable objects would be received. Lispers excuse a lot more than that.
1:05:30
no-defun-allowed
gigamonkey: I'd keep the infix notation, and make >>= do what it does in C just to throw them off.
1:08:29
no-defun-allowed
Point is, it can be called whatever, if it doesn't have late binding I'm out
1:10:16
gigamonkey
srandon111: There's a download for a binary of an old verison. Grab that and the latest source and see if you can build the latest. Might Just Work.
1:11:41
no-defun-allowed
sbcl.org won't load here today, but I swear I saw a release note that said they restored the non-threaded build; potentially suggesting that there is a threaded build. Or not.
1:34:10
dieggsy
are global parameters that can be setf'd pretty common ? if not, are there alternatives ?
1:35:03
dieggsy
what i mean is, say i have some client library for a web API that requires a client id and a secret ke - is it reasonable to have (defvar client-id) (defvar secret-key) and have the person using the library setq them?
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.