www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - quick-and-dirty minimalistic LISP engine

reply ketmar <ketmar ketmar.no-ip.org> writes:
here is my little contribution to the everlasting "how you shouldn't=20
write the code" contest. this is very simple (yet fully working) LISP 1=20
implementation. it is slow like a dead snail, it trashing memory faster=20
than you can say "WTF?!", but it does it's job.

this code was ripped out of closed-source project, so no git this time,=20
sorry.

yes, it has both automatic function wrapping and ability to call LISP=20
functions without manual list building.

and yes, it is really used in "real software".

Public Domain / WTFPL.

http://ketmar.no-ip.org/milf_for_the_masses.zip=
Feb 18 2015
next sibling parent reply "Stefan Koch" <uplink.coder googlemail.com> writes:
Oh boy.
the source is messy ...
Feb 18 2015
parent ketmar <ketmar ketmar.no-ip.org> writes:
On Wed, 18 Feb 2015 11:56:51 +0000, Stefan Koch wrote:

 Oh boy.
 the source is messy ...
you have been warned! ;-) it was actually created within several hours to=20 add simple scripting to another project, and i have no plans to improve=20 it. so i decided to make it public, in a hope that it might be useful for=20 somebody, and to show how one shouldn't write D code. ;-) =
Feb 18 2015
prev sibling parent reply "MattCoder" <stop spam.com> writes:
 http://ketmar.no-ip.org/milf_for_the_masses.zip
I'd like to see the source but on the other hand I'm so afraid to download this zip. :) Matheus.
Feb 18 2015
parent reply "Ola Fosheim =?UTF-8?B?R3LDuHN0YWQi?= writes:
On Wednesday, 18 February 2015 at 21:22:56 UTC, MattCoder wrote:
 http://ketmar.no-ip.org/milf_for_the_masses.zip
I'd like to see the source but on the other hand I'm so afraid to download this zip.
Yep, I got aliced on the first line...
Feb 18 2015
parent reply ketmar <ketmar ketmar.no-ip.org> writes:
On Wed, 18 Feb 2015 22:31:00 +0000, Ola Fosheim Gr=C3=B8stad wrote:

 On Wednesday, 18 February 2015 at 21:22:56 UTC, MattCoder wrote:
 http://ketmar.no-ip.org/milf_for_the_masses.zip
I'd like to see the source but on the other hand I'm so afraid to download this zip.
=20 Yep, I got aliced on the first line...
yet you're still alive, so at least it's not fatal. i've cleaned the code=20 a little since publication, but i don't want to remove Alice traces again=20 and again, so let's consider code cleanup as an exercise for the reader.=20 i know that everybody loves textbooks where the most interesting part is=20 left as an exercise.=
Feb 18 2015
next sibling parent ketmar <ketmar ketmar.no-ip.org> writes:
On Wed, 18 Feb 2015 22:37:34 +0000, ketmar wrote:

 On Wed, 18 Feb 2015 22:31:00 +0000, Ola Fosheim Gr=C3=B8stad wrote:
=20
 On Wednesday, 18 February 2015 at 21:22:56 UTC, MattCoder wrote:
 http://ketmar.no-ip.org/milf_for_the_masses.zip
I'd like to see the source but on the other hand I'm so afraid to download this zip.
=20 Yep, I got aliced on the first line...
=20 yet you're still alive, so at least it's not fatal. i've cleaned the code a little since publication, but i don't want to remove Alice traces again and again, so let's consider code cleanup as an exercise for the reader. i know that everybody loves textbooks where the most interesting part is left as an exercise.
p.s. here is newer aliced version, if someone is still interested: http://ketmar.no-ip.org/milf.d not really better than previous one, i just removed some copypasta and=20 added automatic list deconstruction for primitives (see new=20 `registerBuiltins()` for some samples).=
Feb 18 2015
prev sibling parent reply "Ola Fosheim =?UTF-8?B?R3LDuHN0YWQi?= writes:
On Wednesday, 18 February 2015 at 22:37:34 UTC, ketmar wrote:
 yet you're still alive, so at least it's not fatal
I became one year older, but I feel invigorated after this Alice encounter!
 and again, so let's consider code cleanup as an exercise for 
 the reader.
That's quite ok. I enjoy just looking at D code by different authors to get a picture of how the language is used in real code. So thanks for sharing!
 i know that everybody loves textbooks where the most 
 interesting part is left as an exercise.
Yes, especially if you get that part on an exam later on...
Feb 18 2015
next sibling parent reply Bill Baxter via Digitalmars-d-announce writes:
If you weren't deliberately making a joke, you might want to google "milf".
And if you were... Hmm interesting sense of humor you have there.
On Feb 18, 2015 11:40 PM, "via Digitalmars-d-announce" <
digitalmars-d-announce puremagic.com> wrote:

 On Wednesday, 18 February 2015 at 22:37:34 UTC, ketmar wrote:

 yet you're still alive, so at least it's not fatal
I became one year older, but I feel invigorated after this Alice encounter! and again, so let's consider code cleanup as an exercise for the reader.

 That's quite ok. I enjoy just looking at D code by different authors to
 get a picture of how the language is used in real code. So thanks for
 sharing!

  i know that everybody loves textbooks where the most interesting part is
 left as an exercise.
Yes, especially if you get that part on an exam later on...
Feb 19 2015
next sibling parent "Ola Fosheim =?UTF-8?B?R3LDuHN0YWQi?= writes:
On Thursday, 19 February 2015 at 14:50:43 UTC, Bill Baxter wrote:
 If you weren't deliberately making a joke, you might want to 
 google "milf".
What do you mean? It was my birthday! I became one year older!
Feb 19 2015
prev sibling parent reply ketmar <ketmar ketmar.no-ip.org> writes:
On Thu, 19 Feb 2015 06:50:29 -0800, Bill Baxter via Digitalmars-d-announce
wrote:

 If you weren't deliberately making a joke, you might want to google
 "milf".
no jokes, it's Serious Bussiness! do you think that our project architect=20 will allow to build our own milf without googling? or our security team=20 don't know that i want to share our milf? it's all Official.=
Feb 19 2015
parent Bill Baxter via Digitalmars-d-announce writes:
On Thu, Feb 19, 2015 at 8:30 AM, ketmar via Digitalmars-d-announce <
digitalmars-d-announce puremagic.com> wrote:

 On Thu, 19 Feb 2015 06:50:29 -0800, Bill Baxter via Digitalmars-d-announce
 wrote:

 If you weren't deliberately making a joke, you might want to google
 "milf".
no jokes, it's Serious Bussiness! do you think that our project architect will allow to build our own milf without googling? or our security team don't know that i want to share our milf? it's all Official.
Okie dokie then. :-) Just wanted to make sure you knew what you were doing. But seems it's all under control. Don't mind me. You can go about your business. --bb
Feb 19 2015
prev sibling parent reply ketmar <ketmar ketmar.no-ip.org> writes:
On Thu, 19 Feb 2015 07:39:31 +0000, Ola Fosheim Gr=C3=B8stad wrote:

 That's quite ok. I enjoy just looking at D code by different authors to
 get a picture of how the language is used in real code. So thanks for
 sharing!
same for me. i have a habit of downloading various D libraries and poking=20 through the source, even if i'll never need to use that library. it's=20 interesting to see how people think, and sometimes i can steal a trick.=
Feb 19 2015
parent reply "MrSmith" <mrsmith33 yandex.ru> writes:
With master dmd I'm getting

milf.d(2): Error: ';' expected following module declaration 
instead of is
milf.d(2): Error: no identifier for declarator aliced
milf.d(99): Deprecation: typedef is removed
milf.d(223): Error: basic type expected, not ;
milf.d(223): Error: no identifier for declarator int
milf.d(352): Error: no identifier for declarator CellCons
milf.d(352): Error: declaration expected, not 'body'
milf.d(359): Error: found 'body' instead of statement
milf.d(374): Error: expression expected, not 'body'
milf.d(380): Error: expression expected, not 'body'
milf.d(760): Error: expression expected, not 'auto'
milf.d(760): Error: found 's' when expecting ')'
milf.d(760): Error: found '=' instead of statement
milf.d(795): Error: declaration expected, not 'if'
milf.d(796): Error: declaration expected, not 'if'
milf.d(799): Error: declaration expected, not 'for'
milf.d(799): Error: declaration expected, not ')'
milf.d(801): Error: declaration expected, not 'if'
milf.d(802): Error: no identifier for declarator stloc
milf.d(802): Error: declaration expected, not '='
milf.d(804): Error: function declaration without return type. 
(Note that constructors are always named 'this')

Also, there was no alias usize = size_t;
There is no typedef and body is reserved word.

Here is what I got: 
https://gist.github.com/MrSmith33/9bedde7b0721a6b40666
Feb 22 2015
next sibling parent ketmar <ketmar ketmar.no-ip.org> writes:
On Sun, 22 Feb 2015 10:40:24 +0000, MrSmith wrote:

 With master dmd I'm getting
=20
 milf.d(2): Error: ';' expected following module declaration instead of
 is
that is exactly what i wanted. the only "vanilla" version is that in zip,=20 the "aliced" version will not compile by vanilla DMD. didn't the line `module milf is aliced;` rings the bell? Aliced is still D, but with=20 additions i found right for me. so you are right: Aliced doesn't need=20 alias for `size_t`, it has `typedef`, `body` is not keyword in it and so=20 on.=
Feb 22 2015
prev sibling parent ketmar <ketmar ketmar.no-ip.org> writes:
On Sun, 22 Feb 2015 10:40:24 +0000, MrSmith wrote:

p.s. do you know that `macro` is a keyword? and that it does nothing and=20
TOKmacro is not used anywhere? ah, the hidden joys of D!=
Feb 22 2015