freenode/#lisp - IRC Chatlog
Search
20:24:38
Bike
i might also mention that the only way to detect copying is eq and that it's otherwise an implementation detail
20:30:22
phoe
I kinda feel compelled to, because C++ people are gonna ask "what is copied then, because I really want to mutate this number like I can do in C"
20:39:30
ordoflammae
phoe: it seems like, if you're going to program lisp, you shouldn't want to "mutate" a number location, since that kinda' goes against the whole ideal of functional programming.
20:40:28
ordoflammae
Bike: It seemed like phoe was talking about mutating what number a particular variable is referencing without using that variable (pointers, etc.)
20:40:54
ordoflammae
I mean, yeah, you can't actually mutate the actual number (whatever that might mean), but you can mutate a particular address location.
20:41:34
ordoflammae
But you really oughtn't be doing that with lisp, you're kind of running against the grain of the entire language.
20:43:15
nij
One thing about CLIM is that.. the interface it produces is not emacs, so all good bindings aren't usable there. Is there a way to make emacs more "CLIM-like"? If so, what kind of work should be done?
20:53:38
nij
Bike: is this an attempt to make an editor in which the experience is close to a lisp machine?
21:10:45
jcowan
gigamonkey: The Chez Scheme compiler works exactly thereseb described: each pass converts Scheme to simpler Scheme, until what's left is an S-expression representation of machine language. But every stage can be run using the Chez interpreter and produces the correct result. SO if a stage is bad, you can just leave it out until you fix it.
21:13:38
jackdaniel
most notably presentations - note that when in the repl you return an unreadable object, you still can inspect it
21:42:46
Bike
when typep (or whatever) sees a type specifier defined by deftype, it uses the macro-function deftype defines to expand into a new type specifier to work with
21:45:39
kagevf
engblom: you can use invert-face RET default to toggle between light and dark mode in emacs
21:46:22
loli
for example https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node51.html they give square-matrix
21:48:46
loli
Ideally I can test my list-of on certain types like I have a list of ints and I can typep it
21:49:12
Bike
if you're defining list-of in the obvious way as (deftype list-of (type) `(or null (cons ,type (list-of ,type)))), it won't terminate
21:51:23
Bike
SATISFIES works with a global function name, so you probably can't make that work, unfortunately
21:51:48
loli
so I have to generate every type I care about? How do arrays work with their type specification
21:52:13
phoe
and there's a whole thing about array specialization that conses don't need to care about
21:52:43
loli
what a shame, so I guess I'll make a macro definition that spits out order-1 types from a forall
21:57:32
loli
we can state it takes an integer and gives back an integer, does this not use the same satifies system, or is it baked in like the array?
21:58:20
loli
yeah... satisfies sadly only takes arguments with 1 argument, Maybe I can prop something together with dynamic variables to inject it?
21:59:23
loli
I tried this before: (deftype list-of (type) `(and list (satisfies ,(is-type-of type)))). Now let us try dynamic binding
22:06:55
loli
yeah I could see a gensym approach working if you specalized the type at every single application instance you found
22:16:39
gigamonkey
CL-ASHOK: I think Conrad Barski came up with the "Made with Secret Alien Technology" and the googly-eyed alien logo before he wrote Land of Lisp.
22:18:23
loli
for those curious about the solution I have. the specalizer looks something like this. https://ghostbin.lain.la/paste/jwg6j Note that the concatenate call is incorrect because I forgot the function to coerce a symbol into a string
22:19:19
Nilby
dieggsy: block until what? you could bt:join-thread on it's taskmaster thread if that's what you mean.
22:20:14
dieggsy
Nilby: until i kill the thread i suppose --- that is what i mean, i think. how do i get it's taskmaster thread ?
22:25:05
loli
this works across packages as well, no weird name kludging due to dynamic variables right?
22:26:17
loli
how nice, we can probably make it even slightly nicer by giving it a name so the error messages are nicer
22:26:44
loli
shouldn't it complain about a not global functions ince we are just accessing the lambda inside the gethash
22:27:34
saturn2
get-predicate calls compile to make it a global function if it does not already exist
22:30:11
loli
one last question, how do you use typep with types that take types like this? I never figured that one out
22:32:45
loli
the odd thing about this form is that it takes the symbol, so I don't see how I can apply it
22:37:37
Nilby
dieggsy: You can do it, but it's not in the API, so I probably shouldn't reccomend it.
22:38:20
Nilby
dieggsy: This is probably a bad idea, but (bt:join-thread (slot-value (slot-value hunchentoot::*acceptor* 'hunchentoot::taskmaster) 'hunchentoot::acceptor-process))
22:39:23
dieggsy
Nilby: fair. i'm trying to set up a simple server for local Oauth 2.0 authentication. Basically I just need a one time server that waits (blocks), gets a request with some info, sends back "done, close this tab", then dies and other code can go on to do stuff wtih that info
22:39:58
dieggsy
i've done it in CHICKEN, but there I had manual control over the thread the web server started in
22:41:03
dieggsy
or, maybe i'm being an idiot and i just work the entire logic into the easy-handler. .... that would make more sense I think
22:41:05
loli
hmm one small error, saturn2 it seems when I compile the file it says the type is undefined, is this due to staging?
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