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); }…
I don't do a lot of C, but isn't this just a global function returning a pointer to a KaNode? If I remember correctly this is just Cs way of specifying a type is a struct same thing with the line in your example "struct KaNode *output = ..." someone feel free to correct me if I am wrong though.
Kamby – A programming language based on Lisp that doesn't seem like Lisp
21–30 of 53 posts
Re: Kamby – A programming language based on Lisp that doesn't seem like Lisp
#22Isn't this very confusing in almost all instances?
Re: Kamby – A programming language based on Lisp that doesn't seem like Lisp
#23Re: Kamby – A programming language based on Lisp that doesn't seem like Lisp
#24Re: Kamby – A programming language based on Lisp that doesn't seem like Lisp
#25Re: Kamby – A programming language based on Lisp that doesn't seem like Lisp
#26> 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?
Re: Kamby – A programming language based on Lisp that doesn't seem like Lisp
#27> 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?
Re: Kamby – A programming language based on Lisp that doesn't seem like Lisp
#28And 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.…
But as Lisp was my first real language, I might be a bit biased. And besides Lisp I like languages like Forth or Postscript, and even Perl ;-)
Re: Kamby – A programming language based on Lisp that doesn't seem like Lisp
#29> 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.
Re: Kamby – A programming language based on Lisp that doesn't seem like Lisp
#30And 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.…
There’s a point in using different signs that mean different things.