Rewrite Your Scripts In LISP - with Roswell

  Рет қаралды 21,119

Gavin Freeborn

Gavin Freeborn

Күн бұрын

Пікірлер: 69
@GavinFreeborn
@GavinFreeborn 2 жыл бұрын
One thing I didn't get to mention in the video was that you can also add external libraries by adding them to the #+quicklisp section of your script. Really simplifies dependency management and makes it so you can compile them into your final executable.
@beauteetmusculation8191
@beauteetmusculation8191 2 жыл бұрын
Which clearly is a big win. That's the reason I like compiled languages: making statically-linked programs.
@pascal7947
@pascal7947 2 жыл бұрын
Nice video. I love the interactive programming in Lisps. In the Clojure world there is Babashka, which is a really cool way to write scripts.
@c1dk1n
@c1dk1n 2 жыл бұрын
@FichDich InDemArsch That's like, your opinion, man.
@jeffspaulding9834
@jeffspaulding9834 Жыл бұрын
As much as I love CL, I do complicated shell scripts in Perl. Everyone thinks Perl is all about string manipulation, but Perl was actually written to replace complicated shell and awk scripts. There's a reason almost every UNIX includes Perl as part of the base system install - it's the glue that holds everything together.
@laughingvampire7555
@laughingvampire7555 Жыл бұрын
yes, perl was the goto scripting language for admin and IP management, a friend who has been perl coder for the last 25 years had books on "how to admin windows with perl" I read the book and it was amazing. I did an internship in the bioinformatics department of the school of Biomedicine in my college, I got to work some dna sequencing stuff, it was amazing and fun, mostly was making web interfaces for clustal and other bioinformatics In web development perl had an awesome feature that is lacking in all other scripting languages, the concept of "tainted data" and this lead perl to secure web apps while the php people were shipping code with huge signs of "inject sql here please" all over the place.
@jasenq6986
@jasenq6986 11 ай бұрын
or python
@jeffspaulding9834
@jeffspaulding9834 11 ай бұрын
@@jasenq6986 Python's for if you want to script but hate shell scripting.
@LabiaLicker
@LabiaLicker 7 ай бұрын
@@jasenq6986 yeah nah
@logicaestrex2278
@logicaestrex2278 Ай бұрын
@@LabiaLicker python is also included in almost every distro and is extremely flexible. i do like perl, but python works as well
@vindarel
@vindarel 2 жыл бұрын
+1 about Python, Go and CL's best-in-class interactivity. Roswell's added value here is that it is easy to share one's script, but it is worth noting that it is *not* /necessary/ in order to build a binary (and compress it). So I myself often just build a binary without Roswell. I refer to the Cookbook!
@freesoftwareextremist8119
@freesoftwareextremist8119 2 жыл бұрын
I like roswell for building for the fact that it is super easy to make it buildable for people who don't know about Lisp. Imagine explaining them that they need to install SBCL, quicklisp, run archane commands in the REPL...
@vindarel
@vindarel 2 жыл бұрын
@@freesoftwareextremist8119 Sure ! (although these can also be scripted) And the simplest option for end-users (or one's own server) remains to provide a binary (specific to the target platform).
@alexisgallagher5109
@alexisgallagher5109 3 ай бұрын
swift-sh gives you this in Swift, which also has a REPL. rust-script is comparable in rust. Glad to learn about roswell.
@staypufd2001
@staypufd2001 2 жыл бұрын
When you put asterisk's around a global, they have classically called "Ear Muffs".
@boots7859
@boots7859 Жыл бұрын
It would be interesting to see file size comparison. I know you mentioned it towards the end of the vid about having to compress the image, etc, but ultimately if it ends up with 10Mb for a simple script it makes the vaule proposition a bit different.
@lawrencedoliveiro9104
@lawrencedoliveiro9104 2 жыл бұрын
Did you know you can run just about any language in a Jupyter cell, without needing a custom backend kernel for that language? You can just use the standard “%%script” cell magic. For example, a bash command: %%script bash echo 'hi there!' LISP with SBCL: %%script sbcl (+ 2 2) SBCL without the startup banner and prompts: %%script sbcl --script (+ 2 2) ; produces no output (princ (+ 2 2)) ; need to do explicit output SBCL without the output cruft as before, but restoring automatic printing of expressions: %%script sbcl --noinform --eval "(require 'sb-aclrepl)" --eval "(setq sb-aclrepl:*prompt* \"\")" (+ 2 2) In all cases, copy the “%%script” line as is, and put whetever you want in the rest of the cell.
@jeffspaulding9834
@jeffspaulding9834 Жыл бұрын
Emacs' org-mode has similar functionality (org-babel). It doesn't have the nice widgets, though.
@Imaltont
@Imaltont 2 жыл бұрын
Common Lisp seems really nice for this kind of thing. I would say though that Ocaml is also great for this kind of thing. You can get a similar workflow to SLIME/Sly in emacs with Tuareg, compiles down to a binary executable, and comes with these kinds of tools (language server in merlin, opam package manager, easy to get dune (project manager/build tool) and utop (better REPL than the default) through opam, debugger etc) instead of having to hunt them down the same way as with Common Lisp's quicklisp/asdf/roswell. The MLs is also another beautiful family of languages, and they are especially elegant when it comes to pattern matching/lots of conditions on a list of data/parsers. They are much more rigid than the Lisps, but they work great for this kind of stuff.
@GavinFreeborn
@GavinFreeborn 2 жыл бұрын
Outside of a little SML (and if you count Haskell) I haven't done too much with the ml family but I'd definitely be interested in giving ocaml a look. As far as I know you can't manipulate a running program with ocaml the same way you can with lisp can you? For reference take a look at this demo kzbin.info/www/bejne/bKGwqpuoeciAsNk . If you can I'd be really interested in giving it a try! I haven't actually seen anything other than CL provide such functionality.
@Imaltont
@Imaltont 2 жыл бұрын
@@GavinFreeborn The compiled binary you can't edit while it's running afaik, no, but you can while developing, by sending new definitions to the REPL for evaluation. Tuareg gives you this in a SLIME-like way in Emacs, though afaik it doesn't have as many features as SLIME. To my knowledge there are a few other languages than the Lisps that have the image based workflow, most notably is probably Smalltalk. There are also probably other niche/academic languages that can that I just can't think of/don't know of yet.
@GavinFreeborn
@GavinFreeborn 2 жыл бұрын
@@Imaltont Thanks! I'll definitely still give Tuareg a look either way
@herrkrake8106
@herrkrake8106 2 жыл бұрын
@@Imaltont Oh, poor thing Smalltalk.
@SaHaRaSquad
@SaHaRaSquad 2 жыл бұрын
The thing that always turns me away from Common Lisp is how cumbersome the REPL is. You can't use arrow keys to repeat a previous command like in Bash, instead you now have garbage in the commandline. You can't just continue after getting an error message, because every single error imprisons you in a weird debugger menu that needs a different key to exit every time. I'm sure it makes sense in a way but it seems the interface ignores all advancements in CLI tools of the past decades. Guile Scheme isn't much better but at least the input to exit the debugger is consistent. Emacs Lisp is the only language I know of that may throw syntax errors based on the contents of a comment (yes, really). Maybe I missed a great alternative but I'm used to Bash & Python, and SBCL felt like a step backwards to me even though I kinda like the language itself. I must say, however, that Roswell is a great recommendation. It made setting up SBCL so much easier.
@GavinFreeborn
@GavinFreeborn 2 жыл бұрын
Maybe take a look at github.com/fukamachi/mondo which is intended to make the lisp repl more interactive. Common lisp's is more customizable than most languages for this reason the default isn't intended to be fully featured
@GavinFreeborn
@GavinFreeborn 2 жыл бұрын
The repl in lisp is more extendible than most languages repls so it doesn't actually include a "interactive shell" the included shell is intended more for editors to easily integrate with (adding lots of features to the default makes this hard. There are plenty of programs that provide a more bash like repl
@SaHaRaSquad
@SaHaRaSquad 2 жыл бұрын
@@GavinFreeborn Nice, mondo is a lot better. Thanks for the link
@commarchinin
@commarchinin 2 жыл бұрын
My personal CL scripting experiences have been relatively negative. In particular, handling paths is pretty commonly a big deal in scripts, which really isn't a fun time in CL. That said, I think that's mostly a personal preference thing, and I agree on which way out I'd like my scripts' parens.
@DMWatchesYoutube
@DMWatchesYoutube Жыл бұрын
It's funny how something so common is often forgotten, rust seems to have a big challenge ahead in formalizing file paths
@EdouardTavinor
@EdouardTavinor 11 ай бұрын
I think what you say about go can be applied to a lot of modern tooling. Other languages can be even more verbose here. For example, if you just want to write and test one function in java you need to write a file with a class definition and either a main method or another file which uses something like junit. With clisp or emacs lisp in emacs you just evaluate the defun and then write an expression that calls the function and evaluate that.
@GekoPoiss
@GekoPoiss 9 ай бұрын
Any programming language or library is easily portable and with sensible tooling if you use Nix.
@valentinussofa4135
@valentinussofa4135 2 жыл бұрын
Patrick Winston's book has made me interested in the topic of lessons about LISP. Nice video content. Liked & Subcribed. 🙏
@yafz
@yafz 2 жыл бұрын
Nice demonstration!
@ruffianeo3418
@ruffianeo3418 Жыл бұрын
Not sure if roswell in the mix would make it easier or harder for new lispers. The workflow without it is not really more complicated.
@doesnt_even_lift
@doesnt_even_lift 2 жыл бұрын
I was thinking about re-writing my scripts using babashka, partly because I really like that things can be piped into it on the commandline like a regular shell for testing. Other than speed from compilation, are there other benefits I would be missing out on by not using CL with roswell? I'm not very familiar with the differences between a clojure-based scripting language and a common lisp based scripting environment
@lawrencedoliveiro9104
@lawrencedoliveiro9104 2 жыл бұрын
4:54 Note what “exec” does: it tells the shell to replace itself with the program it is executing, rather than spawning a separate subprocess. Not sure why that is necessary: why not put the “ros” command directly in that first shebang line, and avoid going through a shell at all?
@GavinFreeborn
@GavinFreeborn 2 жыл бұрын
Portability really. Not every user will have ros installed in the same place. `#!/bin/env -S ros run ...`would work however -S isn't POSIX compliment and any user using a non gnu `env` would fail to run the program. Without the -S the extra options/args given to Roswell would not work.
@N0zer0
@N0zer0 2 жыл бұрын
5:15 Why not just simply #!/bin/ros? You don't even need -Q since it's the default mode of operation.
@GavinFreeborn
@GavinFreeborn 2 жыл бұрын
Portability really. Not every user will have ros installed in the same place. `#!/bin/env -S ros run ...`would work however -S isn't POSIX compliment and any user using a non gnu `env` would fail to run the program. Without the -S the extra options/args given to Roswell would not work. As for the -Q I am not 100% sure on their reasoning but I guess it's just to make it so those who don't want quicklisp just need to change one char since +Q will disable quicklisp support.
@GlobalYoung7
@GlobalYoung7 2 жыл бұрын
thank you 😊
@erickwarteng2427
@erickwarteng2427 2 жыл бұрын
What font are you using
@GavinFreeborn
@GavinFreeborn 2 жыл бұрын
PregmattaPro
@herrkrake8106
@herrkrake8106 2 жыл бұрын
Try Consolas. The best one for my taste.
@programmingguy6081
@programmingguy6081 Жыл бұрын
The point of shell scripts is you don't need to install anything and you can do everything in a simple text editor. Also most people using scripting languages are not programmers. Instead of lisp just use awk or perl. Most OS`es come with one or both of these. If on windows just use powershell.
@ceticobr
@ceticobr 2 жыл бұрын
Nice vídeo. Liked and subscribed.
@gamerboy4566
@gamerboy4566 2 жыл бұрын
What’s the font you are using?
@GavinFreeborn
@GavinFreeborn 2 жыл бұрын
PregmattaPro
@gamerboy4566
@gamerboy4566 2 жыл бұрын
@@GavinFreeborn Thanks
@herrkrake8106
@herrkrake8106 2 жыл бұрын
Lisp syntax look like a total gibberish! What is the best and shortest way to wrap one's head around if programming experience is only occasional python and shell scripting? Setup stumpwm, next, guix and emacs?
@GavinFreeborn
@GavinFreeborn 2 жыл бұрын
Best way is to almost forget about the parentheses. The editor will indent your code for you so all you have to do is read the indentation. Kinda like you would with python just everything is a function call. E.g. (> (+ 1 2) (+ 3 4)) You don't really need to care about the closing parentheses. All you do is see ogh this is a comparison of argument 1 and argument 2. Then look at the aligned arguments. It takes a bit of getting used to but once it clicks it's just like reading every other language.
@herrkrake8106
@herrkrake8106 2 жыл бұрын
@@GavinFreeborn Got it! Which dialect suits better for big data driven projects from your point of view? Closure looks nice from these perspective, but it has reputation of good frontend tool, I suppose. Don't you think so?
@GavinFreeborn
@GavinFreeborn 2 жыл бұрын
@@herrkrake8106 I think you meant clojure which is a fine option. You are likely thinking of clojurescript which is basically just a very of clojure that compiles to JavaScript. Clojure it's self runs on the JVM (same thing scala, java, and kotlin use) so you shouldn't have any issues there. I haven't done much data science work so I can't really speak as to its offerings there unfortunately.
@herrkrake8106
@herrkrake8106 2 жыл бұрын
@@GavinFreeborn Oh, thanks for a fast answer! Gonna dig deeper with clojure script then. Appreciate you sharing your thoughts!
@rexcastrosurvey
@rexcastrosurvey Жыл бұрын
Hey mate im learning lisp atm. Im learning for looking on code on example . Theres a way to open protected lisp code? Thanks and more power . i subscribe on your channel
@GavinFreeborn
@GavinFreeborn Жыл бұрын
Protected? What do you mean?
@lepton099
@lepton099 Жыл бұрын
IDE for write in lisp, i´´m beginner , THANKS A LOT
@angelluna2884
@angelluna2884 Жыл бұрын
portacle
@lamprospitsillou6325
@lamprospitsillou6325 2 жыл бұрын
The one who betrayed us and joined the dark side... Just kidding ! I don't use Emacs Or lisp but i love picking in this huge world of lisps and Emacs 😁! Really interesting videos.
@GavinFreeborn
@GavinFreeborn 2 жыл бұрын
I assume this is in reference to the lack of viming I've been doing 😅. I have been considering making more vim content since even though I use it very little there are surprisingly few people covering the topics I considered actually interesting to work with.
@jwiskikruger8921
@jwiskikruger8921 2 жыл бұрын
this theme is beatiful, can you tell me the name pls?
@GavinFreeborn
@GavinFreeborn 2 жыл бұрын
It's my own theme actually. Your can find it in the `lisp/spaceway.el` directory under my emacs configs
@jwiskikruger8921
@jwiskikruger8921 2 жыл бұрын
@@GavinFreeborn thank you
@AK-vx4dy
@AK-vx4dy Жыл бұрын
Install dark mode please :( Ok jokes aside, decrease brightness in camera or change white balace, your selfie is overexposed badly.
@GavinFreeborn
@GavinFreeborn Жыл бұрын
I've since changed this. See my later videos
@mlongval
@mlongval Жыл бұрын
"High key video" anyone?
@collinsa8909
@collinsa8909 Жыл бұрын
Your fumblings with the language is enough warning signs that it would more likely be a pain to work with than advertised
@GavinFreeborn
@GavinFreeborn Жыл бұрын
Common Lisp letting me fumble and recover during development is one of the biggest things that makes me enjoy working with it.
@terryphelps4204
@terryphelps4204 2 жыл бұрын
I like the content of this video, but: You have go-ahead-and disease like so many KZbin video makers have. You say "go ahead and" all the time. It doesn't mean anything.
@GavinFreeborn
@GavinFreeborn 2 жыл бұрын
Thanks for the feedback. I'll avoid the go ahead and statments
M-x Compile: A Deep Dive into Compiling Code with Emacs
15:46
Gavin Freeborn
Рет қаралды 4,2 М.
Creating Your First Lisp Project - Quicklisp, asdf, and Packages
24:47
Gli occhiali da sole non mi hanno coperto! 😎
00:13
Senza Limiti
Рет қаралды 18 МЛН
女孩妒忌小丑女? #小丑#shorts
00:34
好人小丑
Рет қаралды 74 МЛН
КАКУЮ ДВЕРЬ ВЫБРАТЬ? 😂 #Shorts
00:45
НУБАСТЕР
Рет қаралды 3,3 МЛН
Why Are Lisp Macros So Great!?
16:28
Gavin Freeborn
Рет қаралды 15 М.
How Lisp is designing Nanotechnology (with Prof. Christian Schafmeister)
52:58
LEARN EMACS LISP - Mostly The Strange Parts
29:22
Gavin Freeborn
Рет қаралды 17 М.
LOOP Common Lisps Superior For
20:53
Gavin Freeborn
Рет қаралды 11 М.
Learn Emacs Lisp in 30 Minutes
30:22
Gavin Freeborn
Рет қаралды 9 М.
Code Completion In Emacs - Everything You Need To Know
16:57
Gavin Freeborn
Рет қаралды 26 М.
tree-sitter explained
15:00
TJ DeVries
Рет қаралды 81 М.
Why You Should Learn Lisp In 2024
21:50
Gavin Freeborn
Рет қаралды 64 М.
ПОЧЕМУ МИКРОФОНЫ ИГРОВЫЕ? 🧐
0:46
KEKTAR
Рет қаралды 736 М.
Как противодействовать FPV дронам
44:34
Стратег Диванного Легиона
Рет қаралды 246 М.
Слетела прошивка на LiXiang L7
1:01
Настя ЧПЕК Туман
Рет қаралды 4 МЛН
Nokia imba #trollface #sorts
0:31
SodnomTsybikov
Рет қаралды 6 МЛН