We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

Lisp everywhere!

00:00

Formal Metadata

Title
Lisp everywhere!
Subtitle
Gurudom is around the corner
Title of Series
Number of Parts
490
Author
License
CC Attribution 2.0 Belgium:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor.
Identifiers
Publisher
Release Date
Language

Content Metadata

Subject Area
Genre
Abstract
Minimalism matters in computing. Minimalism allows for smaller systems that take less resources and consume less energy. More importantly, free and open source minimalism allows for secure systems that are easy to understand. Minimalism is also educational and brings back the fun of the early days of computing where people learn to understand systems from the ground up. As a co-organizer of this devroom I will talk about my journey through many programming languages and ending up with Scheme (a minimal Lisp). Lisp is the second oldest language in use today and growing. I'll show you that once you master Lisp you can use it everywhere from software deployment, the shell, the editor and debugging and for programming systems and in the browser. As a matter of fact, Lisp is everywhere!
Multiplication signElectronic mailing listMaxima and minimaHypermediaComputer programmingProgramming languageExpected valueVideo gamePhase transitionProgrammer (hardware)Lecture/Conference
MathematicsExpressionCore dumpProgramming languageBeat (acoustics)Thermal expansionElectronic mailing listRight angleMilitary baseRow (database)Functional programmingGastropod shellComputer programmingCanonical ensembleMatching (graph theory)Buffer solutionPoint (geometry)File archiverMappingWebsiteProcedural programmingFigurate numberAlgebraic closureLipschitz-StetigkeitGame theoryLine (geometry)Limit (category theory)Text editorCASE <Informatik>Computer-assisted translationParameter (computer programming)Basis <Mathematik>Data managementProjective planeStructural loadLogische ProgrammiersprachePosition operatorNumbering scheme2 (number)Cursor (computers)Game controllerConfiguration spaceBitKeyboard shortcut
Revision controlOpen sourceGNU EmacsGastropod shellParsingScripting languageHash functionLine (geometry)Graphical user interfaceRepetitionProgramming languageExtension (kinesiology)ExpressionElectronic mailing listRow (database)Point (geometry)Level (video gaming)Gastropod shellHash functionScripting languageShared memoryRight angleParameter (computer programming)Computer programmingDatabaseSequelNumbering schemeState of matterLine (geometry)Video gameType theoryNormal (geometry)String (computer science)Text editorVariable (mathematics)Integrated development environmentProfil (magazine)Self-organizationAsynchronous Transfer ModeComputer fileFunction (mathematics)Functional programmingProgrammer (hardware)SpacetimeStudent's t-testLoop (music)Hacker (term)Multiplication signReading (process)PressureDifferent (Kate Ryan album)Data managementThermal expansionServer (computing)Computing platformEmailWeb 2.0WordConfiguration spacePhysical systemPlanningOperator (mathematics)Mixture modelOcean currentModule (mathematics)Procedural programmingComputer-assisted translationMedical imagingMixed realityParsingElectronic program guideRevision controlBitSlide ruleLambda calculusSystem callComputer animation
Computer fontExecution unitRevision controlOpen sourceRepetitionLine (geometry)Gastropod shellGroup actionMeta elementSource codeComputer animation
EmailMaxima and minimaCNNWeb pageLocal ringUniqueness quantificationNumbering schemeElectronic mailing listModule (mathematics)Data managementRow (database)InformationRevision controlLine (geometry)Expected valueComputer animation
Programmable read-only memoryBacktrackingContinuum hypothesisError messageVariable (mathematics)Data typePatch (Unix)Convex hullCountingRow (database)Flow separationRevision controlInformationData managementSource code
RootGraph (mathematics)Rule of inferenceBit error rateHacker (term)Landau theoryOpen sourceRevision controlData managementInformationOpen setPhysical systemAbstractionLevel (video gaming)Right anglePosition operatorSubject indexingRevision controlMereologyConnected spaceBuildingDescriptive statisticsoutputSource codeComputer animationLecture/Conference
DemonScaling (geometry)Metropolitan area networkCASE <Informatik>DemonDerivation (linguistics)Connected spaceElectronic mailing listQuicksortMultiplication signInformationComputer fileData storage deviceBuildingRepresentation (politics)Computer animation
Web pageRevision controlOpen sourceRule of inferenceHome pageComputer wormDefault (computer science)Local GroupNormal (geometry)Inclusion mapDrill commandsData typeContinuum hypothesisDemo (music)CausalityData storage deviceComputer animationSource code
Lemma (mathematics)Bridging (networking)Monad (category theory)RepetitionGraphical user interfaceWeb browserNumbering schemeMessage passingData storage deviceMonad (category theory)Integrated development environmentGroup actionElectronic mailing listProcess (computing)Interpreter (computing)DivisorSoftware bugBuildingProgrammer (hardware)Translation (relic)Link (knot theory)Web browserLibrary (computing)Functional programmingProgramming languageMessage passingProjective planeUniverse (mathematics)BitAlgebraic closureElectric generatorDifferent (Kate Ryan album)Numbering schemeLatent heatRight angleVector spaceArithmetic meanShared memorySource codeKritischer ExponentLevel (video gaming)Hash functionScripting languageDistortion (mathematics)State of matterMetropolitan area networkSimilarity (geometry)DemonConnected spaceFactory (trading post)Row (database)CodeDerivation (linguistics)Multiplication signTransport Layer SecurityDebuggerComputer animationSource code
Lecture/Conference
Point cloudFacebookOpen source
Transcript: English(auto-generated)
Welcome everyone to the minimum list death room for the second time. We're organizing this and You know so far. We've had some great talks. I Hope I can live up to that expectation
So Lisp is the second oldest language used in use today the oldest language is Fortran and I just yesterday yesterday there was a Fortran to LLVM talk so that's also still alive Fourth we also had a talk which is quite old early 70s. I think yeah
Small talk is also quite old. So, you know These old languages seem to seem to stick somehow, which is great So yeah, I've went through many phases in my life I know I've started program in the early 80s and went through, you know from Pascal to through C++ to
Python Ruby whatever's elixir Scala D and I still like Ruby and I still like D so What about lisp? So the first one of the things I learned is that you know the top 2% of the programmers in the world They they can program in lisp. Have you heard about that statistic?
So, of course when you want to be a top 2% programmer, what do you have to do? You have to learn lisp so that was an incentive and then I ran into a number of projects including new geek which is a package manager written in lisp and you know, so slowly I started to and
It's surprisingly easy to learn, you know, you can teach a youngster lisp probably in an hour. I think yeah The basics so that that's that's great but I also discovered the lisp is very much a Ruby or a Ruby is a lisp really, you know And I met Matt who is the creator of Ruby two years ago, and I asked him, you know say wait
How come Ruby is so much like lisp and he says yeah actually people in the early days called it marks own lisp instead of Ruby Yeah, so there's a lot to share then so also lisp is a lot like Python or Python is a lot like lisp and you find these things out, but
There's something else lisp is everywhere and I'm gonna talk about that. So lisp you can find in Emacs You can find in the education great programs AutoCAD in the early days used lisp gimp Julia, Julia was originally written in lisp. You know that
So there are lispers there Logic programming mini-can run Closure in the last 10 years as says, you know wedge itself into the business market New geeks, of course is very much popularizing lisp and and pushing guile to its limits and that's the next talk
Never knew mess Jan was talking about just now Yeah, a lot of lisp in there and the shell anyone heard of shells lisp There we go. So in a nutshell your most broken language language right rights and then
Braces and then a parameter and lisp, you know, the curly the braces are just on the outside. There's all you need to know So when people say there's lots of parentheses in lisp, you know, yeah
And wherever those most languages handle scope and you know with curly braces in the CC style syntax and just you have imperative assignments right and then you do something like Concatenation in lisp you write something very similar just looks a little bit different, you know so you start with a with a brace and then you assign the
Parameters Right and then you do something with it But what you can see is it that is very consistent, you know Because functions are always start at the first position in the brace so that's how they get evaluated and then you get a list of parameters and Even for assignment, you know, it's it's really a function
Yeah, which has a list so and the other thing is that most lists today They allow you to also use square brackets, right? So as long as they match up you can in you can exchange them with with the braces But interestingly it introduced a scope and one of the things I found out quite late which is
embarrassing is That and this is really beats other languages, you know, I think to the core is when you run lisp in a raffle yeah, so You can you can just cut and paste the inside of an expression right and and feed it to the raffle again
Yeah, so if you do debugging, I mean try that in Python So here's a famous lisp. It's it's running in a in an editor And here's an example. Yeah, so Emacs is written in lisp essentially. It has a very small C core that runs the lisp engine
Which means that all the configuration is is done in lisp, too Yeah, so once you get used to the lisp syntax, you don't have to relearn anything What you only need to relearn is how you know, Emacs has created its world of Functions or procedures Which you just can call
Yeah, so I wrote a function at some point that I wanted to copy the line above and I probably did it in the most inelegant way Yeah, because I wasn't really into lisp then but you can essentially write a function that says, you know Take take the cursor position copy the line above and inject it back into the into the text buffer
You can even inject into a different buffer if you want And this is what it looks like, you know, and it starts it starts to look familiar now And then when you have written the function you can bind it to a key Right and this in this case is control backspace and I see if it works
Yeah, right so I wrote this language extension myself, you know, it's a really minor one But I think it just shows the power of of using a configuration language, which is also a programming language
So Emacs is for programmers. So that point I really would like to emphasize, you know, in fact, I Used VI a vim for almost 10 years. I started with Emacs then in a you know in a in a in a mind-meld I went to VI and then 10 years later, you know, I went back to Emacs and And the real the real thing is that because this is such a configurable editor. It becomes a great programming platform, too
Yeah, so programmers love an editor that you can program and that's what Emacs is Racket, so this is another lisp Which is really making lisp popular again, and the racket has a racket that comes with the shell it's called rash
Yes It's an unfortunate name, but there you go And I just want to run quickly through it because racket allows you to mix shell commands with lisp commands, which becomes very interesting So you can install racket. I'll share the slides
and then you can say something like Require some modules right and then hey, that's a that's a shell command see that cat etc hostname And you can pipe it into a lisp procedure and That points me to another one. So what you can do is say, you know, turn some trimmer string or you can say
Let's see, here's the mixer again define hostname is cat etc. So that you have to embed it shell again, right and Do some function operation on it? And then you can just run a plain shell script Yeah, where the parameter is actually lifted out of the lisp evaluator, right?
And that's that's already pretty cool But you can also do things you you know, you can't even fathom doing in the shell like parse and JSON parsing JSON Right. So this is a this is an arrest endpoint which returns a very complicated JSON record
And I can actually I can just you know fetch it with within within the shell using a lisp expression and You know the record in the first stage of the record is a hash is there is a dictionary what are you trying?
Hey Alistair, how are you? All right, is it not the black the blue one the black one? Yeah, right ready for liftoff
Yeah, so you can do something very complicated and then you if out of this JSON record you've you get you know this this string So in a shell script essentially you can do complicated things You can even do you know, you can use SQLite as a back-end and you know Push some state into a SQLite file database
Try and do that in a shell Another thing is the you know, the shell scripting program program where and probably most of us get caught at this at some point You know the shell when you pass us a list of words in there Is it a string or is it a list? yeah, so Here's an example here's the shell script that I used to upload some files to my web server. Sorry to my mail server
yeah, and you can see that the The file name has spaces in it okay, and when I actually run the shell this script which simply is shell and then Using the expansion string star of course it breaks because it starts it thinks these are all different files, right?
Anyone bitten by that before? Yes, so the the rash version is that you Start the shell and You can you can parse the command line using current command line arguments
And you can see if you use single quotes it actually sees that worse But if you use double quotes, it will see it as a string as a sorry as a Something with spaces so to write the full script You could do something like this Where you say, okay, we're gonna run a system command the system star
calls the rsync and and plugs in the FN which is coming from Command line current command line arguments. So this is a lambda and you know in lambda the The extra parameters to the to the to the call are listed last which is counterintuitive for us Ruby programmers
Yeah, so you turn it if but racket comes with it with an with a nice facility just where you can say for list Function name, you know, that's the parameter fetch it from the command line, you know and then run the command And this starts to pretty much look like Ruby to me Yeah, I mean a little bit syntax and then you run it it works, right?
As it should skip this So here's a more full Res script where I just show that you can create a loop. Yeah, so the student file
listen student names with spaces and then I create a name Removing the spaces and then I copy the file a text for text file to the output file And then I run said hey and this is again just a a shell command essentially. Yeah, and this is also a shell command
So what you see is you can you can mix in a loop you can mix shell shell commands again Which have you know, the normal shell syntax, so I think rush rush is pretty cool And for guile, we should we have gash if it could do this type of thing young
Really interesting So there's more reading here. You can read on racket And Why is rash so interesting, you know because rash is totally hackable through lisp So you learn one syntax and you apply it in different for different things
So there's some hacking guides here And it seems to be misplaced somehow What did I do new guile I'm starting with the hacking guys great
That should be the last one so The new gigs you've heard of before if you were in the room is the is a package manager it's a functional package manager and it's It's essentially written in guile, which is a lisp again a different there are many flavors of lisp and this is one it's a scheme and
You know when you install something with with gigs on the command line You can do something like gigs package install racket image racket mode and then I'm gonna put it somewhere. That's what it says Yeah, and then you load the profile which are the number of environment variables and then you can run the program Which is in opt rack. It's been racket and it will give you a prompt. I
Should have given a guile example anyway, so Gigs is written in guile. So we need to install that first and I'm also installing some some nice packages that go with it emacs emacs geyser or geyser and par edit
And when you do that You can Do something like this You can you can start the raffle
Yeah with with the With the meta command X shell and then run geeks raffle so geeks raffle is really just a command line tool and it drops you straight into a lisp raffle and
it allows you to interact with with geeks. Yeah, so the geeks package manager and Here, for example, we say okay use these modules use geeks use new packages scheme and then
Tell me about the racket package And that gives you gives you information on the racket package including which file it sits in new packages scheme and the line number Yeah, so you get this this facility where you can actually interact with with the the geeks package manager through lisp
And you can query data. You can say something like package version racket. Yeah, so let me try that if I So it's dangerous to try things on the command line What did I say racket? Yeah, so here's the package thingy
And then I need to say for example package version racket and returns you the version that's installed
Yeah, so and there's a lot more to that so you can you know You can get all the information that's in the package manager And if I show you what the package manager looks like That's the wrong one. Jeez too many things are open now my poor small brain
So if you have for example, here's the package definition in in geeks Yeah, you could say Define public which is the and then the package name which is called Ruby connection pool and this is a Ruby gem You know, it's it's part of it's a Ruby package that comes with Ruby and it essentially say, you know This is the name. This is the version. This is where we fetch it from it comes from
Through Ruby gems, right? So it's a Ruby gems URI And you can see that the Ruby just you if you know, it's all such it from get it would show You know a git URI so we have a high level abstraction here for Ruby gems The shaft value just says this is what the the you know, the tarball what the shaft value should be like, you know
So you don't accidentally get another one and then the build system is the Ruby build system Then it has a native input. So that's a dependency. It depends on bundler And then you have the synopsis and description. So this this all describes one package in geeks
Which is concise, right and it's also lisp again Yeah, so you can understand it now, right even if you don't even if you have this one You know this 10-minute introduction on lisp that I have given
Anyway, so if you clear the the data that's that was on the repl You can actually get this information that was in the package definition. You can just see it here and do something with it You can also interact with the daemon. I'm not gonna run it now because I don't have that much time But essentially you can you can Open a connection with the daemon which we call s here as a convention or store or
geeks daemon, you know, so there's not much of a convention and then you can Make it what we call a package derivation of the package that you want to build in this case or install This is Ruby and a derivation is sort of the lowest data representation of of a package
So it includes all the dependencies everything and then you simply say something like derivation. Sorry, that's what it returns This is how you fetch the file name of the derivation and in this case, we want to build it. So we say
Build derivations, you know with this with the daemon and then take a list of the derivations in this case It's a Ruby derivation, which is which was fetched here Yeah, so if I run that it should it should install Ruby which is always a bit dangerous. So let me try and kind of paste that
live dangerously when you give a Demo, yeah, so it returns true, but because the package is already installed. Yeah, but
So it doesn't reinstall unfortunately Very convenient for demo. But yeah, so but that's it, you know, that's all there is to it How many? Nine, okay, that's cool. And then we have some a concept called the store monad
So when people talk about monads, they usually think about things like Haskell functional programming languages. You can also do this in Lisp five
No, thanks Yeah, so and The specific specific monadic functions which avoid you to to reference the the daemon or the store or the connection every time So, you know rather than the earlier Here we explicitly had to say build derivations s and then
something yeah, so here we can just say package derivation Ruby and you don't have to relate to the I mean the the monad carries the Definition of the store with it. You don't have to reference to it again And this this this is another way of you know, simplifying the code because you Otherwise, you would have many references to the daemon, you know, and and that's actually not necessary
So to capture doll, you know with gigs the source code is a documentation I think And we show some high-level functionality for building and and and and exploring packages
And the fun thing is you can also use a debugger so you can actually step to it when you build something you can Step through the code that is the kept package definition and what it does with it And there's only unified list syntax So you distro here is a scheme library for hacking, you know through the geeks the new geeks API's and
Here's some links which are available I'm gonna skip this one So just like Emacs geeks is for programmers. Yes. Once once you master Lisp you can do anything really So I'm going to quickly touch on another list, which has become very important in the in a business environment is closure
And It's a little bit I mean the list people in general, you know when they frown when you mention closure because it's a little bit different from most lists But I think it's you know, it is it's not I can't say it's superficial, but it has very interesting ideas
You know, so it's a different conceptually. It's a different beast altogether But it shares things with the other lists including the syntax It's it's it takes a little bit of some freedom when it comes to saying okay, you know rather than writing Where did I go I
Think something disappeared Well, no, that's probably the same so that's a list right but this is a vector right and a vector in in the other lists or at least in scheme would be would be written like this and This is a hash value or a dictionary and this is what it looks like in the other schemes you know, so there's some some some some differences and I think it was a
This is meant to meant to make it nicer for people who are coming from JavaScript Python Ruby and all that But it's the same thing in fact underneath it will it will return similar values And then closure has you know, a lot of ideas around functional programming including immutability and and shared state handling
Which are all important And it compiles to the JVM Which is an advantage if you like it and it's a disadvantage if you don't like that And closure scripts, which is also closure translates to JavaScript
So you essentially have one language that can target either the JVM or JavaScript and I think in a business environment That can be pretty attractive But that's not to say that this is the only way to do things you know because there's a For example be was scheme is is a JavaScript interpreter that runs in the browser And you when you use that you can do something very simple like this, you know, which is HTML and then you script
The be was skinned JavaScript interpreter you pull it in and then you can just write the right scheme again And I think this is this is actually a very interesting tool We scheme is a record ID that runs in the browser. So that's another browser interpreter
PanScript takes a slightly different approach. It's a JavaScript generator. So it's more like closure script Spock is the chicken scheme to JavaScript generator. So these are all project that that that can do pretty complicated things
And it all originates on the fact that writing a lisp interpreter is not that hard, you know a lot of people even learn that you know in school in university at least the maybe not the last 10 years, but Who has learned to write a scheme or you know a lisp interpreter in school
See yeah, there's a few so It shows you it's possible right? I mean if anyone wrote written a c++ interpreter here They also exist, you know, but they're a very crazy beast So Spock can compile to either C or JavaScript, you know
And that's it's a chicken scheme and I'm gonna wrap up now because the take-home message I think is The lisp is one or maybe many languages that serve all I think that's that's the key thing and
You know, there are many great lisps lisp is easy to learn this was everywhere it can be used anywhere It's for newbies and gurus alike in my opinion. You know, I'm probably still a newbie But what is really important in this stage of millennial angst Is That you know, you don't have to worry about what language you have to learn after this
There's so many people that come to me and say, you know, should I learn rust? Should I learn Python? Should I learn R or whatever, you know, and I'm just saying well, you know, that's fine You should actually you should learn them all but once you reach to the stage that you have learned lisp You probably you know, you're over it
Thank you Any any questions?
Yeah, yeah, yeah, so the gal repel saves all the answers