freenode/#lisp - IRC Chatlog
Search
9:32:22
resttime
Is it possible to connect to a lisp REPL on a device where you can only talk with it via a serial connection?
9:40:23
resttime
Hmmm, I guess to double check: Suupose there's an embedded ARM system like raspberry pi but can only have a single serial connection to communicate to it with something like 'screen /dev/ttyUSB0' (not SSH). THere is a way to connect on a computer with SLIME to the swank server that a lisp is running on this device?
9:41:43
resttime
Never done something like this except SSH tunneling, so I suppose this is fairly new to me.
9:50:54
jdz
There are "protocols" to multiplex a serial line, for instance XMODEM for file transfer.
9:52:43
resttime
Hmmm, I'm probably going to have a lot of research to do. Completely new stuff to me.
9:53:41
jdz
Yes, I just finished reading "UNIX-HATERS Handbook", which states that the stuff from 1980ies should still work today.
9:54:57
resttime
I was hoping there would be some kind of simple way to just do "SSH tunneling port but with a serial connection"
9:55:05
jdz
I've had to poke around with stty and whatnot on OSX to get some stuff working, and I did manage to get it working, so I bet the stuff still works.
9:58:53
resttime
Yeah, it's that 'screen /dev/ttyUSB0' can drop me into a busybox shell on the device and I was wondering if I could do the stuff I would do if I used like SSH on tunneling the swank server port
10:01:11
d4ryus
Are you able to start a swank instance listening on a local port? or is there no network at all?
10:03:55
d4ryus
i had a broken ethernet on my pi and no wifi available. But i was able to start swank and then tunnel stuff via usb terminal and netcat. Was quite a hack yes, but it worked
10:07:06
resttime
Hmmmm, that's reassuring to know. I suppose I will also try and explore whether it's possible to enable networking. I've so far assumed it wasn't because connections with the device have been only serial with the screen utility and I would imagine people would want to switch to something better if they could (hence conclusion that couldn't)
14:40:33
dwts
hey guys, has anyone used lisp for generating code in other languages? I believe I've read this is not that uncommon for lisp. I was thiking about writing lisp code to generate terraform code for me
14:42:05
nyef`
dwts: Umm... You realize that any native-code lisp compiler fits that definition, right?
14:43:04
dwts
nyef`: native as in machine code? I'm interested in generating terraform code which is more like json
14:43:07
Zhivago
There is nothing particularly special about lisp for that task in either direction.
14:43:25
Zhivago
nyef's point is that what you are describing is a compiler, of which there are many written in lisp.
14:44:15
nyef`
Another example would be from the "XP" paper, where they abuse the lisp pretty-printer to produce Pascal syntax.
14:46:04
dwts
nyef`: this one? https://www.researchgate.net/publication/242313131_Using_the_new_common_Lisp_pretty_printer
14:46:18
Bike
dunno what you mean by "treated like code". just saying that writing out data structures can be a little easier.
14:47:21
dwts
Bike: well I want to use lisp to generate some tfvar files. then these files can be executed by terraform
14:47:45
dwts
nyef`: yeah, The site is temporarily down while we do some maintenance. It will be back up shortly.
14:48:24
Bike
i don't see an actual syntax description, but https://www.terraform.io/intro/getting-started/variables.html looks simple enough
14:50:21
dwts
yeah, I just want to automate some processes, I don't want to copy/paste then edit files every time I'm creating a new instance.
14:51:15
dwts
Zhivago: sure, I just got the impression that when compilers mentioned earlier machine code was implied
14:53:30
Bike
in any case this is a configuration file format. doesn't look like it has any control flow. easy
14:54:42
Bike
and it accepts json too. So you could skip work and use one of the existing json output dealies.
14:56:37
Zhivago
If you're generating it as output you might as well make it the simplest and stupidest format available with the best library support.
14:57:38
Zhivago
Particularly coupled with what is probably a buggy parser that isn't used by a zillion people.
14:57:46
dwts
I was planning to feed it us input after generating it to the terraform tool to create me some ec2 instances
14:59:01
dwts
Zhivago: it's open source, so you can go bug hunting if you are interested: https://github.com/hashicorp/terraform , although you don't sound very excited about it :P
15:01:08
Bike
What's the difference between a fish fork and a regular proletarian fork? Longer middle tine?
15:01:29
dwts
Zhivago: your nickname is familiar, i think I've seen your nick in C related irc channels in the past. You'd rather stab yourself because of go or because you disklike that specific tool? :P
15:02:20
Zhivago
Than go bug hunting in yet another random configuration language implementation by some well intentioned people.
15:02:26
Bike
"Fish forks (and knives) often have an incurve shaped form (pictured); we believe this feature was simply to differentiate it from all the other forks that could be present on the table, as potentially there could be a considerable amount." nice
15:05:53
Zhivago
Oh, not at all -- I am looking forward to hearing your tale of woe at some point so that I can then refer back to the logs and tell you that I told you so.
15:15:14
nyef`
Younder: Wikipedia's list of postal killings doesn't include a single incident in NYC.
16:58:36
Younder
_rumbler31, if you are using kermit anyhow why not writer script in kermit. I don't see the need for Lisp.
17:02:07
_rumbler31
Younder: I didn't make it, and I referenced it both for looking into the cocoa apis for enumerating connected serial/usb devices, as well as using them to communicate with them from lisp in my own work, not necessarily using kermit
17:02:46
johnnybanana
that will take any number of expressions and have each be evaluated and printed in order, using the "=>" format, with semicolons separating pairs
17:04:14
johnnybanana
this is what I have so far: (defmacro macro-call (expr) `(format t "~&~S => ~S~%" ',expr ,expr))
17:05:09
_rumbler31
you can give an argument that is a list, and a few control caracters will iterate through it and use the list as the source of each iteration
17:12:24
johnnybanana
(defmacro macro-call (@body args) `(format nil "~{ => ; ~A ~}" (mapcar #'eval ,@args)))
17:13:15
Bike
With their original definition, (macro-call x) => (format t "~&~s => ~s~%" 'x x) which works fine.
17:13:37
Bike
there's no need to use eval. you don't want to use eval, both for general style reasons, and because it makes the original example impossible since eval doesn't know about lexical bindings.
17:15:56
Bike
johnnybanana: what you can do is just expand into several format calls like the one you already had. one for each form. no need for fancier format strings, and definitely no need to loop at runtime
17:21:43
johnnybanana
So this is what I have (defmacro macro-call (&rest form) `(mapcar #'(format t "~&~S => ~S~%" ',form ,form) ,@form))
17:25:21
Bike
I already gave you an example of what your expansion could look like, try aiming for that
17:30:00
_rumbler31
at runtime he wants to emit "=>" so the inner body will look like (write-string " => ; ") (form1) ...
17:45:56
phoe
Because I just realized that I'm about to reinvent wget with my custom code, and that doesn't sound good.
18:19:45
Bike
otherwise it would be kind of tricky to account for different calls returning different values and stuff.
18:22:01
phoe
Bike: wouldn't be too tricky. the multiple-value-mapcar would keep an internal counter of how many values were at most returned; every time this counter is bumped up, new dummy list(s) filled with NILs are returned.
18:30:58
skrtskrt
I am currently working on a macro where it takes a list of variables and a body of code, and ensures that the variables revert to their original values after the body of code is evaluated
18:32:02
phoe
do you mean that you store their values somewhere before the body of code, execute the code, and then set the variables to these stored values?
18:43:05
phoe
since I just realized that a MULTIPLE-VALUE-MAP{CAR,CAN,LIST,CON} would be really handy.
18:46:35
Bike
(let ((hash (make-hash-table))) (setf (gethash 'fuck hash) t (gethash 'shit hash) nil) (multiple-value-mapcar (rcurry #'gethash hash) '(fuck shit stack)) => (T NIL NIL), (T T NIL)
19:01:16
phoe
we need a minimum length of all argument lists but maximum length of all multiple-value-lists
19:02:32
_death
better to just work on lists instead of pretending that you're dealing with multiple values..
19:04:05
Bike
for the argument lists you can do (loop for l = lists then (mapcar #'cdr l) until (some #'endp l) collecting (multiple-value-list (apply function (mapcar #'first l))))
19:04:32
_death
phoe: then use multiple-value-list to get a list of the values and work on this list
19:05:18
phoe
hm, for me this means destructuring-bind + multiple-value-list + some means of collecting the results.
19:24:03
phoe
Bike: I allowed myself to blog it at https://blog.teknik.io/phoe/p/1604 - I hope you have nothing against it.