Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - octowuss

#1
Whither newLISP? / Re: "place" in the function "inc"
December 31, 2020, 11:30:40 PM
That doesn't make any sense - how does the inc place refer to the location in the function sum to update?

Also, why does the example have a 0 after the x in the parameter list for sum?

I can leave that out and the function still works!


> (define (sum (x)) (inc 0 x))
(lambda ((x)) (inc 0 x))
> (sum 1)
1
> (sum 5)
6
> sum
(lambda ((x)) (inc 6 x))


The documentation for inc says that "place is either a symbol or a place in a list structure holding a number, or a number returned by an expression."

Well, 0 looks like a "number returned by an expression", so I would expect that (inc 0 x) should just return the value of incrementing 0 by x -  i.e. just the value x!

So, it's just not clear how the sum body gets updated! I want a function to be immutable - I don't expect an expression in the body to magically modify the function! This language looks interesting - I come from a TCL background and wanted to learn more Lisp, but this version is full of these incomprehensible "gimmicks" that make it very difficult to work out how to use it! The documentation is woefully inadequate. Sorry.