Live data from Hacker News

Kamby – A programming language based on Lisp that doesn't seem like Lisp

kamby.org

31–40 of 53 posts

Re: Kamby – A programming language based on Lisp that doesn't seem like Lisp

#31

Browsing the source code, I came across something completely unexpected. I didn't know you could put code in structs like this sample from kamby/kamby.c struct KaNode *ka_add(struct KaNode *node, struct KaNode **env) { if (node->type == KA_STR && node->next->type == KA_STR) { struct KaNode *output = ka_str(node->str); strcat(output->str, node->next->str); return output; } return ka_num(node->num + node->next->num); }…

Lol, that's a function that returns a pointer to a struct.

Re: Kamby – A programming language based on Lisp that doesn't seem like Lisp

#32
post #17
post #3

And yet its still filled with unncessary parentheses like an involuntary tic.

Lisp code tends to have fewer delimiting punctuation characters than most algol style current languages. I think people tend to dislike languages that have only the minimum necessary, because it's easy to misread code then and redundancy helps compilers catch mistakes as inconsistent syntax. But there's always Forth for the the lighter taste in delimiters: https://github.com/TexTerry/forth-examples/blob/master/pasca.…

That's great, but they specifically sold it as not having Lisp-like syntax. And yet its incredibly Lisp-like.

Re: Kamby – A programming language based on Lisp that doesn't seem like Lisp

#33
post #22

> Variables are not unique. You can declare multiple values for the same variable name using ":=" and append in the stack. If you want to edit the last declaration, just user simple "=" operator. To remove the last variable with specific name in stack, use "del varname" Isn't this very confusing in almost all instances?

So this language is based on dynamic scope? I'm not sure about confusing, but why wouldn't I want to just use LOGO then?

What current LOGO implementation would you recommend?

Re: Kamby – A programming language based on Lisp that doesn't seem like Lisp

#34
By the way, I always wondered why not just take a lisp, put every single thing (even an operator) on a separate line and indent every level of parentheses with a space or two (4 spaces is too much - deep nesting would go too much to the right). So there would be no need for the parentheses in most cases.

Re: Kamby – A programming language based on Lisp that doesn't seem like Lisp

#35

By the way, I always wondered why not just take a lisp, put every single thing (even an operator) on a separate line and indent every level of parentheses with a space or two (4 spaces is too much - deep nesting would go too much to the right). So there would be no need for the parentheses in most cases.

What would this accomplish aside from spreading your code all over the screen, making it both hard to read and edit, and reducing your freedom of formatting for semantic sense?

Re: Kamby – A programming language based on Lisp that doesn't seem like Lisp

#36

By the way, I always wondered why not just take a lisp, put every single thing (even an operator) on a separate line and indent every level of parentheses with a space or two (4 spaces is too much - deep nesting would go too much to the right). So there would be no need for the parentheses in most cases.

Then programs will be too long. Too much scrolling, less information density on screen, more difficult to comprehend.

Re: Kamby – A programming language based on Lisp that doesn't seem like Lisp

#37
post #33

Earlier quoted context omitted.

So this language is based on dynamic scope? I'm not sure about confusing, but why wouldn't I want to just use LOGO then?

What current LOGO implementation would you recommend?

NetLogo

Re: Kamby – A programming language based on Lisp that doesn't seem like Lisp

#38
post #22

> Variables are not unique. You can declare multiple values for the same variable name using ":=" and append in the stack. If you want to edit the last declaration, just user simple "=" operator. To remove the last variable with specific name in stack, use "del varname" Isn't this very confusing in almost all instances?

Seems like an explicit/less confusing way to do variable shadowing, though imho that's not a feature worth implementing in a 400LOC language.

> less confusing way to do variable shadowing

How is this less confusing? := vs = will either push a new variable on top of a stack of identically named variables, or change the content of the top element on that stack? Why would anyone want any of that? Shadow variables are usually associated with hard-to-find-bugs, (i.e. forgetting that there is already a variable named 'xyz' in the current scope) not some great feature we want more of..

Re: Kamby – A programming language based on Lisp that doesn't seem like Lisp

#39

Browsing the source code, I came across something completely unexpected. I didn't know you could put code in structs like this sample from kamby/kamby.c struct KaNode *ka_add(struct KaNode *node, struct KaNode **env) { if (node->type == KA_STR && node->next->type == KA_STR) { struct KaNode *output = ka_str(node->str); strcat(output->str, node->next->str); return output; } return ka_num(node->num + node->next->num); }…

If it makes you feel any better, I can't remember the last time I saw that construction in the wild. Idiomatic C codebases use a typedef for this 10 times out of 10.
Post reply on HN