freenode/#lisp - IRC Chatlog
Search
12:19:31
VincentVega
Just got meself (gensym) to return two #:G0's nearly in a row. Thinking it has something to do with that reproducability rationale that I read about in one of the sbcl bugs. Currently working out a minimal example (which is proving to be a tad tricky), any insights would be appreciated...
12:26:40
VincentVega
Interesting. Can't say I really understand this bug to say for sure that this is the same one at this point, but yeah, it does look like it got the same roots. Thanks for the link.
12:28:20
phoe
well, you could try going to #sbcl and post your problem, maybe also link this issue if it's related
12:35:22
heisig
I recently promised I would start a collection of 'Common Lisp tweaks'. Well, here it is: https://github.com/marcoheisig/common-lisp-tweaks
12:36:55
heisig
I intend to grow this list whenever I hear about a new trick on IRC, so newcomers won't have to dig through decades of IRC logs to find them.
13:51:54
jmercouris
One thing I’ve been thinking about is that a defmethod is like a guard for a function call
14:16:00
jmercouris
I had been asking about the unique set of basic operators about a year ago i think
14:16:15
jmercouris
At the time I couldn’t articulate what I was trying to describe, but that is it!
14:17:45
beach
The paper by Baker is good. He explains various ways of implementing Common Lisp special operators using other Common Lisp special operators, and often the other way around too.
14:19:03
jmercouris
One thing that I think about a lot is maybe it would have been better if the default was doubly linked lists in lisp
14:20:04
beach
jmercouris: That would break almost every aspect of the semantics of large parts of Common Lisp.
14:21:14
heisig
If you are smart, every operation on lists is already O(1). And singly-linked lists help create beautiful recursive programs.
14:23:39
jmercouris
I think there are some algorithms that would be simpler to write with doubly linked lists
14:24:12
beach
jmercouris: If you have (defparameter *l0* (list 'a 'b 'c ...)) then (defparameter *l1* (cons 1 *l0*)) and (defparameter *l2* (cons 2 *l0*)), would then (rest *l1*) and (rest *l2*) be EQ with doubly linked lists?
14:25:28
heisig
jmercouris: Insertion at the front is O(1). Removal from the front is O(1). All you have to do is turn the list the right way round.
14:26:20
nij
Has anyone thought of making "notes" on discussion on #lisp, as the conversation here has been logged.
14:26:47
nij
Namely, now we are discussing why singly-linked list is the default. Maybe there could be a way to add a summary quickly that refers to this part of conversation?
14:28:41
beach
nij: While there are a few subjects with recurring questions, singly-linked vs doubly-linked lists as the default in Lisp is not one of them.
14:28:54
heisig
jmercouris: As for looking behind - if you only need to look a fixed number of list elements behind you, you an scan the list and keep track of the last K elements you just visited.
15:48:53
Josh_2
When using formatter, what do I pass as the stream arg to have it output as a string?
15:57:20
pfdietz
I had a situation that looked like (format nil (if <form> <string1> <string2>) ...), which I think runs faster if the IF parts were strength reduced with calls to formatter.
18:33:16
jmercouris
The browser is going well, please use the #nyxt channel for discussion about it :-)
19:27:03
nij
`$ sbcl` opens an sbcl repl in terminal. What should I do to launch another repl that connects to the same running instance?
19:27:38
nij
A way to virtually do this is to use swank.. but that's another layer. I hope there's a way to do it directly. (c.f. https://www.reddit.com/r/Common_Lisp/comments/4oe9me/is_it_possible_to_connect_to_a_repl/)
19:30:28
phoe
in theory there could be a sbcl-specific way that starts a socket that accepts netcat connections and spawns a new thread with a new REPL for each client
19:31:44
nij
The problem with this is that.. on the second instance, I don't get the full experience of a nice repo.
19:32:10
nij
phoe: How about this. With the first sbcl launched in a terminal, how to connect to it from SLIME?
19:41:08
nij
Hmm.. ok. I cannot figure out what M-x slime-connect really does.. but guess that's the only clean way so far to do it.
19:45:58
_death
if I understand you correctly, the daemon runs as root, and the daemon would have a swank server.. emacs (the client) needs not run as root, though if it connected to a swank server running as root that would indeed be a problem
19:47:07
_death
if you run the daemon as root want to communicate with it, the protocol should likely be very constrained, so you wouldn't send lisp forms to evaluate as-is
19:50:04
nij
Yeah.. if root runs sbcl with a swank port open, anyone that connects to that port has access to the repl, and in practice, the root's privileg.
19:50:38
nij
SpaceIgor2075: #lisp is a channel for common-lisp. General lisp questions go to ##lisp, and clojure questions go to #clojure :)
19:55:56
nij
_death: Wait.. isn't that weird? If connecting to an sbcl repl means access to the user' (who ran it) privilege, why wouldn't connecting to a swank server require a user password?
19:56:28
nij
Otherwise, openning a swank server in local network means anyone here can mess with my machine!
20:02:38
_death
nij: you have a firewall for that.. and on a local network everyone trusts everyone anyway
20:06:19
_death
nij: if you want to let only authorized clients connect, you can then set up an ssh tunnel, like you may do on the internet
20:09:15
nij
_death: Do you mean this? 1. setup a localhost swank server. 2. let others connect to localhost via ssh?
20:09:34
nij
(I'm still developing my networking knowledge from scratch.. so i might miss some basic stuff.)
20:10:12
phoe
bind the socket to 127.0.0.1 - this way it won't get exposed to the wider network and the only way of connecting will be local connections, e.g. a SSH tunnel
20:11:06
_death
nij: yes, and the port can be filtered so only local access is allowed.. the ssh tunnel can deal with that..
20:11:15
nij
But it's still not too handy if I want to allow my running repl *PARTIALLY* to someone else.
20:12:16
nij
Hmm.. I'm thinking that every commands sent from that inferior user will be first wrapped with the user's identity.
20:13:58
_death
nij: there is no widespread solution.. there are things like cl-evalbot, and a real sandbox could be a virtual machine
20:15:29
phoe
hmmmmm, maybe you could force swank to connect via a unix local socket that is only accessible by root
20:15:33
_death
nij: I think there is also a slime pull request that sets up a connection using unix domain sockets.. but I've not looked into it
20:16:06
phoe
ensure that the socket is owned by root:root and has permissions 600 - should be enough
20:18:08
rogersm
In general, there's not a lot of benefits with local unix sockets and some downsides
20:21:31
_death
basically if you have a ~/.slime-secret file containing something (e.g., a uuid) only those who can read it can respond to swank's challenge
20:22:00
Nilby
I used to telnet to the lisp machines repl. It wouldn't let me change anything and many functions were restricted, until you authenticated as a user. There was no such thing as root.
20:33:59
nij
Hmm.. I cannot find where the socket is created by (swank:create-server :port 2718).. any idea?
22:09:10
Josh_2
is there a library around that allows me to implement something like <command> <various flags> <different options based on flags> ?
22:33:15
Josh_2
lisp, basically getting a string like "compass -x 5 -y 5" that would return results higher than x 5 and y 5 etc
22:33:43
Josh_2
this is in lisp and the arguments are not sent from the command line but from a user
22:34:08
Xach
Josh_2: there are one hundred thousand command-line parsing libraries. if you can split your command by whitespace, maybe some of them could help.