Recent

Author Topic: LISP  (Read 7280 times)

Weiss

  • Full Member
  • ***
  • Posts: 232
LISP
« on: August 23, 2023, 03:54:37 am »
I wonder how much value in learning LISP these days? The language has rather unusual syntax. Is it going to get better as I keep learning it?

Is there something in LISP that is not implemented, or could not be implemented in other languages? Like FP for example? I am struggling from very first pages in the book on LISP, really questioning myself if this will be time well invested?

alpine

  • Hero Member
  • *****
  • Posts: 1412
Re: LISP
« Reply #1 on: August 23, 2023, 01:04:02 pm »
I wonder how much value in learning LISP these days? The language has rather unusual syntax. Is it going to get better as I keep learning it?
Well, it depends how deep you'll go into it. I can't say that it will get easier, but there is a chance for real enlightenment if you are persistent enough.

Is there something in LISP that is not implemented, or could not be implemented in other languages? Like FP for example?
Higher-order functions e.g.

I am struggling from very first pages in the book on LISP, really questioning myself if this will be time well invested?
I wouldn't say it's worth it in monetary aspect, but sure it will change your attitude of how you write your actual programs.

Hope the book is a good one, not just "scratching" on the subject.
"I'm sorry Dave, I'm afraid I can't do that."
—HAL 9000

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12771
  • FPC developer.
Re: LISP
« Reply #2 on: August 23, 2023, 02:46:45 pm »
For what purpose? What kind of problems do you want to solve ?

E.g. afaik LISP is much more suitable to solving batch problems (logistic or mathematical) than e.g. a GUI program or a different program that gets constant stimuli from potentially different sources.

But from what I've seen over the years is that functional languages in general get people excited, but they rarely stick with them as general purpose go-to language long term.

simone

  • Hero Member
  • *****
  • Posts: 696
Re: LISP
« Reply #3 on: August 23, 2023, 04:19:03 pm »
I studied Lisp and functional programming about thirty years ago during the university years and loved it.
 
Today functional programming is appreciated in some particular contexts, but in general, in the real world, the use of pure functional programming languages ​​(such as Lisp and the more recent Scheme and Haskell), does not seem to me to be very broad.  What I have seen, in the last years, instead, is the introduction of some ideas of this paradigm in procedural/oop languages ​​(C++, Java, C#, Javascript). 

Certainly the knowledge of the functional paradigm is important for a computer scientist.  But unless you have specific needs that motivate adoption of Lisp, I wouldn't invest heavily in it.
« Last Edit: August 23, 2023, 04:54:43 pm by simone »
Microsoft Windows 10/11 64 bit - Lazarus 3.8/4.0 FPC 3.2.2 x86_64-win64-win32/win64

Weiss

  • Full Member
  • ***
  • Posts: 232
Re: LISP
« Reply #4 on: August 23, 2023, 07:20:19 pm »
For what purpose? What kind of problems do you want to solve ?

no purpose, general interest. Keep stumbling across references to Lisp, reflection particularly. Composing a code is my hobby, want to expand a horizon a little.

440bx

  • Hero Member
  • *****
  • Posts: 6364
Re: LISP
« Reply #5 on: August 24, 2023, 02:40:18 am »
<snip> want to expand a horizon a little.
Expanding one's horizon(s) is always a good thing. 

That's probably the reason why I've long lost count of the number of programming languages (and paradigms) I've played with (some for no more than a few days.)
FPC v3.2.2 and Lazarus v4.0rc3 on Windows 7 SP1 64bit.

PierceNg

  • Sr. Member
  • ****
  • Posts: 434
    • SamadhiWeb
Re: LISP
« Reply #6 on: August 24, 2023, 03:16:19 am »
For what purpose? What kind of problems do you want to solve ?

no purpose, general interest. Keep stumbling across references to Lisp, reflection particularly. Composing a code is my hobby, want to expand a horizon a little.

I suggest to pick a topic you're interested in and go from there. Examples:

- implementation of space invaders in Racket: https://alex-hhh.github.io/2020/11/space-invaders.html
- WebAssembly as compilation target for Guile: https://spritely.institute/news/guile-on-web-assembly-project-underway.html
- build native Android and iOS app using Gambit Scheme:  https://www.lambdanative.org/
- write in Scheme to run in web browser: https://github.com/biwascheme/biwascheme

Above all refer to Scheme implementations because it so happens I'm checking out Scheme recently.

Common Lisp, the other major Lisp family, also has lots of stuff going on, see https://planet.lisp.org/

eny

  • Hero Member
  • *****
  • Posts: 1665
Re: LISP
« Reply #7 on: August 24, 2023, 10:15:16 am »
As a non-LISP programmer I liked this https://www.youtube.com/watch?v=-J_xL4IGhJA
All posts based on: Win11; stable Lazarus 4_4  (x64) 2026-02-12 (unless specified otherwise...)

Thaddy

  • Hero Member
  • *****
  • Posts: 18970
  • Glad to be alive.
Re: LISP
« Reply #8 on: August 24, 2023, 10:44:52 am »
I wonder how much value in learning LISP these days? The language has rather unusual syntax. Is it going to get better as I keep learning it?
LISP is as old as I am (1958), but its influence is still visible as more modern languages like Closure and Haskell are clearly influenced by it. Last time I used it, though, was on my Commodore 64 in the early '80's.
Learning LISP therefor is in my opinion very useful if you want to study functional languages but not very useful or productive in practice.
Quote
Is there something in LISP that is not implemented, or could not be implemented in other languages? Like FP for example? I am struggling from very first pages in the book on LISP, really questioning myself if this will be time well invested?
No, everything LISP is Turing complete, like Pascal, so it is possible to implement everything any language can do. There are even nowadays some high level libraries available (Like a clone of C's stdlib in LISP and many LISP compilers are written in LISP).
Time is well invested if you study computer science and/or the logic in maths. Otherwise it may be not worth the effort.

Reminds me to get that C64 from the attick and see if it still works and the floppy drive too.. The C64 LISP was pretty good.

That said, it is good fun, but not in the league of e.g. Fortran, or COBOL which still earns me money after all those years because there is a great shortage in programmers and a huge base in programs....
« Last Edit: August 24, 2023, 10:57:16 am by Thaddy »
Recovered from removal of tumor in tongue following tongue reconstruction with a part from my leg.

MarkMLl

  • Hero Member
  • *****
  • Posts: 8564
Re: LISP
« Reply #9 on: August 24, 2023, 07:55:05 pm »
LISP is as old as I am (1958), but its influence is still visible as more modern languages like Closure and Haskell are clearly influenced by it. Last time I used it, though, was on my Commodore 64 in the early '80's.
Learning LISP therefor is in my opinion very useful if you want to study functional languages but not very useful or productive in practice.

In that case it's younger than I am. I would suggest that Lisp, Forth and APL are outliers as far as general purpose programming languages are concerned and all of them were designed and implemented by people isolated from (and possibly ignorant of) the work that became ALGOL hence the vast majority of today's general-purpose languages.

However I broadly agree with your conclusion: it's worth having a nodding acquaintance with it as the foundation of an (outlying) branch of the language tree.

Quote
No, everything LISP is Turing complete, like Pascal, so it is possible to implement everything any language can do.

I respectfully suggest that you are perpetrating a misunderstanding. "Turing complete" means that a language can implement a Turing machine, and it's possible for a language to implement things that cannot be implemented by a Turing machine.

As a specific example, a Turing machine has a finite number of states, plus an infinite tape. Since the position of an infinite tape requires an infinite amount of state (bits, digits, etc.) to represent, the position of the tape cannot be represented in the control unit. Hence it is not possible to implement e.g. a recursive coroutine mechanism or interrupt handlers, since these require that the position of the tape be stored in the control unit.

The fact that those can be handled in Pascal suggests that Pascal is a superset of the Turing machine architecture. So while Lisp and Pascal might be Turing-equivalent, a Turing machine per se. isn't relevant.

Unfortunately, I've seen a lot of people holding forth on this in the past and using "Turing complete" to promote all sort of wild suppositions.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Curt Carpenter

  • Hero Member
  • *****
  • Posts: 747
Re: LISP
« Reply #10 on: August 24, 2023, 11:37:06 pm »
I'm not sure that any language implements things.   ::)

Thaddy

  • Hero Member
  • *****
  • Posts: 18970
  • Glad to be alive.
Re: LISP
« Reply #11 on: August 25, 2023, 04:08:04 pm »
So we are both old..
One remark: if a language is Turing complete it also means that you can implement everything. That is the beauty of his work. Any programming language that is Turing complete implies that any library possible can be programmed in that language.
This is simple logic, Mark
Recovered from removal of tumor in tongue following tongue reconstruction with a part from my leg.

MarkMLl

  • Hero Member
  • *****
  • Posts: 8564
Re: LISP
« Reply #12 on: August 25, 2023, 07:54:36 pm »
So we are both old..
One remark: if a language is Turing complete it also means that you can implement everything. That is the beauty of his work. Any programming language that is Turing complete implies that any library possible can be programmed in that language.
This is simple logic, Mark

So how can you implement a handler for nested interrupts? You need to preserve the position of the tape under the reader (or of the reader over the tape if you follow Von Neuman, Burks et al.) and since the tape is infinite you need an infinite number of digits (etc.) to store that- for which there's no room in the control unit which is finite.

It's all very well if you allow multiple tapes which may be context-switched, but that's not the standard Turing machine architecture.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Curt Carpenter

  • Hero Member
  • *****
  • Posts: 747
Re: LISP
« Reply #13 on: August 25, 2023, 09:35:42 pm »
As I recall (although it's been over half a century), any multitape Turing machine can be mapped into a single tape machine.  So the question would be whether all the conditions prompting a context switch can be encoded on a third tape.   That question, I think, takes us into the realm of the philosophical problem of The Eternal Recurrence of the Same.  Cantor's transfinite is a messy place.

MarkMLl

  • Hero Member
  • *****
  • Posts: 8564
Re: LISP
« Reply #14 on: August 25, 2023, 10:12:25 pm »
Cantor's transfinite is a messy place.

I was thinking about Hilbert's Hotel etc. as I wrote the stuff earlier. However I'm not convinced that problems which require multiple /infinite/ tapes can *realistically* be mapped onto a single /infinite/ tape... at least without requiring infinite time for the housekeeping in addition to the finite time required to execute the algorithm.

And as for the problem of mapping an infinite number of infinite-length tapes onto a single infinite tape without requiring transfinite time...

Incidentally, I've spent a lot of time "in transit" this week and was telling the friend accompanying me a story yesterday: apparently there was a minor stockmarket crash (a trivial $120m or so) caused by a trader's selection of APL for his fancy maths (derivatives trading or similar). The problem is that "classic" APL doesn't really have iteration, and so he'd called a subroutine ten times assuming that an algorithm would converge in that time... which was fine until it didn't.

Does anybody have a reference for that?

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

 

TinyPortal © 2005-2018