create account

Developing a Lisp by steevc

View this thread on: hive.blogpeakd.comecency.com
· @steevc ·
$7.64
Developing a Lisp
Over the last thirty-odd years I have worked with many programming languages including BASIC, Pascal, C, C++, Python and Java. One I had heard about, but never had to deal with is [Lisp](https://en.wikipedia.org/wiki/Lisp_(programming_language)). Recently I have been reading [Metamagical Themas](https://en.wikipedia.org/wiki/Metamagical_Themas) by Douglas R. Hofstadter, who also wrote GΓΆdel, Escher, Bach. I found this book in a charity shop.

![Book](https://files.peakd.com/file/peakd-hive/steevc/Ff5M24gQ-image.png)

This is a compendium of columns he wrote for Scientific American in the 80s. It ranges over subjects from Rubik's Cube to self-describing sentences. It also has a couple of chapters on Lisp and these inspired me to try coding with this old language that dates back to the 50s. I like that it is a very consistent language. Everything is a list and can contain further listed nested within it. This does result in lots of brackets/braces.

```Lisp
This is SBCL 2.0.1.debian, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
* (+ 2 4)
6
* (+ 3 5 7)
15
* (car (reverse (list 1 2 3 4 5)))        
5
* (defun rac (l) (car (reverse l)))
RAC
* (rac (list 4 5 6 7 8))
8
* 
```

As with languages like BASIC and Python you can enter lines or expressions and get immediate results as well as storing programs in files. I installed this version of [Common Lisp](https://en.wikipedia.org/wiki/Common_Lisp) on Ubuntu Linux. This seems to have some differences to the version in the book as to what functions are available. It is possible to create new functions that would recreate these, e.g. Common Lisp has the (+ a b) function, but the book uses (add a b). We can define that missing function:

```Lisp
0] (defun add (a b) (+ a b))
; No debug variables for current frame: using EVAL instead of EVAL-IN-FRAME.
ADD
0] (add 2 4)
; No debug variables for current frame: using EVAL instead of EVAL-IN-FRAME.
6
0] 
```

I am still working out what the messages you get mean. Some errors give lots of lines of error text that is not too readable. I expect there are ways to deal with that. The way functions and variables are defined is different to the book too.

I am looking at some other tutorials such as [Lisp Koans](https://github.com/google/lisp-koans/) and [The CL Cookbook](https://lispcookbook.github.io/cl-cookbook/).

I am not sure when I would use Lisp, but understanding the different features of various languages can give you insights that can be applied elsewhere. Lisp is used as a scripting language for some applications. It has been used a lot in artificial intelligence, which I expect is where Hofstadter used it. Having extra tools in your toolbox is generally a good thing.

I am only playing with trivial examples for now. I need to find some real world use cases to work on.

Code hard!
πŸ‘  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 86 others
πŸ‘Ž  , ,
properties (23)
authorsteevc
permlinkdeveloping-a-lisp
categoryhive-169321
json_metadata"{"app":"peakd/2020.07.2","format":"markdown","description":"Early steps with Lisp programming","tags":["programming","coding","lisp","stem","palnet"],"links":["https://en.wikipedia.org/wiki/Lisp_(programming_language)","https://en.wikipedia.org/wiki/Metamagical_Themas","https://en.wikipedia.org/wiki/Common_Lisp","https://github.com/google/lisp-koans/","https://lispcookbook.github.io/cl-cookbook/"],"image":["https://files.peakd.com/file/peakd-hive/steevc/Ff5M24gQ-image.png"]}"
created2020-07-29 19:50:30
last_update2020-07-29 19:50:30
depth0
children14
last_payout2020-08-05 19:50:30
cashout_time1969-12-31 23:59:59
total_payout_value4.198 HBD
curator_payout_value3.439 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length3,113
author_reputation1,372,741,192,440,693
root_title"Developing a Lisp"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd0
post_id98,786,988
net_rshares22,434,836,699,401
author_curate_reward""
vote details (153)
@basilmarples ·
$0.03
cool. that looks like a gem of a book you found! hehe
Sadly my understanding of code is limited to a few tuts on codecademy and lego coding on scratch!
πŸ‘  
properties (23)
authorbasilmarples
permlinkqe9w29
categoryhive-169321
json_metadata{"app":"hiveblog/0.1"}
created2020-07-30 08:10:57
last_update2020-07-30 08:10:57
depth1
children4
last_payout2020-08-06 08:10:57
cashout_time1969-12-31 23:59:59
total_payout_value0.014 HBD
curator_payout_value0.015 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length151
author_reputation33,487,055,276,459
root_title"Developing a Lisp"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,795,722
net_rshares139,824,789,020
author_curate_reward""
vote details (1)
@steevc ·
It is definitely an interesting book even if I don't get it all. It's thinking about thinking and that's a good exercise. I want to do more coding for fun. I am sure there are things I could do with Hive itself.
properties (22)
authorsteevc
permlinkre-basilmarples-qea0k5
categoryhive-169321
json_metadata{"tags":["hive-169321"],"app":"peakd/2020.07.2"}
created2020-07-30 09:48:06
last_update2020-07-30 09:48:06
depth2
children3
last_payout2020-08-06 09:48:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length211
author_reputation1,372,741,192,440,693
root_title"Developing a Lisp"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,796,876
net_rshares0
@basilmarples ·
$0.03
wow! yes that would be exciting!
a few of us are starting a discord channel to discuss the potential of my charity dApp concept and achimmerten's CHARY coin which he already utilises as a charitable concept. Im camping this week but I think we'll be organising a group chat,perhaps next week sometime.
Let me know if you might be interested. 
Also I dont suppose you read the comments section on that initial concept post I did? Id love to have your opinion on some of the things grampo mentioned.... especially the use of the rewards pool and how it reduces the value from the big stakeholders. Would that be a major issue with my dApp concept?
πŸ‘  
properties (23)
authorbasilmarples
permlinkqebpjo
categoryhive-169321
json_metadata{"app":"hiveblog/0.1"}
created2020-07-31 07:45:24
last_update2020-07-31 07:45:24
depth3
children2
last_payout2020-08-07 07:45:24
cashout_time1969-12-31 23:59:59
total_payout_value0.014 HBD
curator_payout_value0.015 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length645
author_reputation33,487,055,276,459
root_title"Developing a Lisp"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,813,188
net_rshares141,309,847,607
author_curate_reward""
vote details (1)
@builderofcastles ·
$0.03
LISP is one of those things.
Its impossible to describe to people because its underlying premise is different.

Its like trying to describe a 2 wheeled motorcycle to a person who had only ever worked on 4 wheeled cars.
Its just different.

But, that difference make certain things really simple.
Like trying to describe thought processes, and thus AI.

Like the print command understands one and multiple, and thus will change syntax.
> Our Hero had a sword
Our Hero had two swords

Nothing like the basic, blocky, error prone, printf() of C

I hope you enjoy your learning curve.
πŸ‘  
properties (23)
authorbuilderofcastles
permlinkqe93fm
categoryhive-169321
json_metadata{"app":"hiveblog/0.1"}
created2020-07-29 21:55:06
last_update2020-07-29 21:55:06
depth1
children1
last_payout2020-08-05 21:55:06
cashout_time1969-12-31 23:59:59
total_payout_value0.014 HBD
curator_payout_value0.015 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length580
author_reputation273,511,389,474,245
root_title"Developing a Lisp"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,789,036
net_rshares140,221,105,817
author_curate_reward""
vote details (1)
@steevc ·
It's definitely different, but I like that as it makes me think. I like the elegance of it. Just need to learn more of the basics so I can exploit that.
properties (22)
authorsteevc
permlinkre-builderofcastles-qea0dc
categoryhive-169321
json_metadata{"tags":["hive-169321"],"app":"peakd/2020.07.2"}
created2020-07-30 09:44:00
last_update2020-07-30 09:44:00
depth2
children0
last_payout2020-08-06 09:44:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length152
author_reputation1,372,741,192,440,693
root_title"Developing a Lisp"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,796,838
net_rshares0
@cadawg ·
$0.03
Sorry for the late reply. Thanks for posting in the Programming community.

I tend to stick to the more "modern" languages, but I can see how the older languages still have a place. I still like my PHP Even if no-one else does πŸ˜‚
πŸ‘  
properties (23)
authorcadawg
permlinkre-steevc-qfkgux
categoryhive-169321
json_metadata{"tags":["hive-169321"],"app":"peakd/2020.08.3"}
created2020-08-24 11:49:45
last_update2020-08-24 11:49:45
depth1
children2
last_payout2020-08-31 11:49:45
cashout_time1969-12-31 23:59:59
total_payout_value0.014 HBD
curator_payout_value0.015 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length228
author_reputation100,771,927,095,688
root_title"Developing a Lisp"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id99,245,402
net_rshares131,999,697,806
author_curate_reward""
vote details (1)
@steevc ·
I have been doing a programming course that is about the theory of things like recursion. This one uses ML, which I did not know at all. I would not use it generally, but it is really elegant and has a lot in common with Lisp. Principles you learn in one language can be applied to others.
properties (22)
authorsteevc
permlinkre-cadawg-qfkjnk
categoryhive-169321
json_metadata{"tags":["hive-169321"],"app":"peakd/2020.08.3"}
created2020-08-24 12:50:09
last_update2020-08-24 12:50:09
depth2
children1
last_payout2020-08-31 12:50:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length289
author_reputation1,372,741,192,440,693
root_title"Developing a Lisp"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id99,246,219
net_rshares0
@cadawg ·
Yeah, for sure. The first language is the hardest by a long shot. I'm going to be doing a class on AI soon, so that should be interesting for sure. I do believe it's going to be taught in python though!
properties (22)
authorcadawg
permlinkre-steevc-qfkjux
categoryhive-169321
json_metadata{"tags":["hive-169321"],"app":"peakd/2020.08.3"}
created2020-08-24 12:54:33
last_update2020-08-24 12:54:33
depth3
children0
last_payout2020-08-31 12:54:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length202
author_reputation100,771,927,095,688
root_title"Developing a Lisp"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id99,246,286
net_rshares0
@stav ·
$0.03
I studied Turbo Pascal at college and although I enjoyed it, I was rubbish.  Would probably have been better if I spent more time studying it instead of sitting in the local pub with the Pascal book in my bag.
πŸ‘  
properties (23)
authorstav
permlinkre-steevc-qea424
categoryhive-169321
json_metadata{"tags":["hive-169321"],"app":"peakd/2020.07.2"}
created2020-07-30 11:03:42
last_update2020-07-30 11:03:42
depth1
children1
last_payout2020-08-06 11:03:42
cashout_time1969-12-31 23:59:59
total_payout_value0.014 HBD
curator_payout_value0.014 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length209
author_reputation52,141,742,331,876
root_title"Developing a Lisp"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,797,904
net_rshares131,730,661,356
author_curate_reward""
vote details (1)
@steevc ·
I really liked Turbo Pascal at the time. I did quite a lot with it. They added object oriented programming at some point and I thought that was cool.
properties (22)
authorsteevc
permlinkre-stav-qea4bn
categoryhive-169321
json_metadata{"tags":["hive-169321"],"app":"peakd/2020.07.2"}
created2020-07-30 11:09:24
last_update2020-07-30 11:09:24
depth2
children0
last_payout2020-08-06 11:09:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length149
author_reputation1,372,741,192,440,693
root_title"Developing a Lisp"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,797,992
net_rshares0
@vcelier ·
$0.03
>  I have worked with many programming languages including BASIC, Pascal, C, C++, Python and Java

But you never tried the [Ada programming language](https://www.adacore.com/community)? You should give it a try whenever you have time.
πŸ‘  
properties (23)
authorvcelier
permlinkqe9stb
categoryhive-169321
json_metadata{"links":["https://www.adacore.com/community"],"app":"hiveblog/0.1"}
created2020-07-30 07:00:48
last_update2020-07-30 07:00:48
depth1
children1
last_payout2020-08-06 07:00:48
cashout_time1969-12-31 23:59:59
total_payout_value0.014 HBD
curator_payout_value0.015 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length234
author_reputation471,651,021,631,730
root_title"Developing a Lisp"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,794,810
net_rshares140,069,225,814
author_curate_reward""
vote details (1)
@steevc ·
$0.12
I've not used Ada, but I think a colleague has. There are a few of the classic languages I've not used, but not sure I need to mess with Fortran and Cobol. I've actually done a lot of BASIC for a living, but not for a while now.
πŸ‘  
πŸ‘Ž  
properties (23)
authorsteevc
permlinkre-vcelier-qea0hb
categoryhive-169321
json_metadata{"tags":["hive-169321"],"app":"peakd/2020.07.2"}
created2020-07-30 09:46:24
last_update2020-07-30 09:46:24
depth2
children0
last_payout2020-08-06 09:46:24
cashout_time1969-12-31 23:59:59
total_payout_value0.058 HBD
curator_payout_value0.058 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length228
author_reputation1,372,741,192,440,693
root_title"Developing a Lisp"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,796,859
net_rshares507,722,670,691
author_curate_reward""
vote details (2)