Crowlang / crow

Crow Lisp
MIT License
6 stars 2 forks source link

Add list abstractions (andmap) (ormap) (map) (foldr) (foldl) #35

Open Bravotic opened 1 year ago

Bravotic commented 1 year ago

Following the Racket documentation, add these list abstractions. These are pretty useful in practice, so they will find a nice home in Crow.

Bravotic commented 1 year ago

Alright, lets get a list of what needs to be done here.

These are all list abstractions used in the Racket programming language and have proven to be useful, so they should probably be added to Crow.

0x1nf3cted commented 1 year ago

hey, i would like to contribute, but is there a readme? so i can understand crow syntax?

Bravotic commented 1 year ago

Hello! No readme yet, sorry about that. The basic syntax of Crow is like most Lisp-like languages, so for example, (println "Hello world") would print hello world. A complete list of functions can be found in here. Documentation is coming really soon, trust me on that.

0x1nf3cted commented 1 year ago

Let me see if I understand correctly. The syntax for map() function in crow, for instance, could be written as CRO_map(int* array, int (*operation)(int)), where int (*operation)(int) is a callback function, right? I'm interested in working on implementing map(), filter(), and sort() in crow.

Bravotic commented 1 year ago

It would actually be written as (map [Function to change data] [Array]) and it would return the new array. That could be used in practice like (map (func (value) (+ value 1)) (array 1 2 3)) to produce an array where each value has 1 added to it. It follows the same syntax and style of Lisp languages, in particular these functions are being modeled after their equivalents in Racket, the documentation for map in Racket for example can be found here. Crow is similar except changes a few variable names and doesn't support certain syntax, for example, our lambda is simply just titled func.

0x1nf3cted commented 1 year ago

ahah i see, i'm working on it, but i have a one last small question, what is state CRO_State *s

Bravotic commented 1 year ago

That simply holds all the values that need to be passed around, for example: variables and their values, what functions we have access to, etc. For most functions you don't need to care about it.

Bravotic commented 1 year ago

Also I should mention since there isn't a readme with links 😅 there is a Crow discord server where I coordinate with the other developer. This is the invite link here. Preemptive sorry its discord lol.

0x1nf3cted commented 1 year ago

ahh sorry, i don't have a discord account

Bravotic commented 1 year ago

No problem, no problem. Make one if you want or you can find my contact info on my website if you need any help or need anything clarified.

0x1nf3cted commented 1 year ago

unfortunately, have not been able to make any advancements in my understanding of the overall structure of the Crow language. Therefore, I will have to wait for a readme or some documentation to be made available to gain further insights into this language.

Bravotic commented 1 year ago

Watch issue #4, hopefully within this week I should have up to date documentation.