Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

A Haskell I can get behind

Name: Anonymous 2015-12-27 15:41

Name: Anonymous 2016-01-03 17:36

>>5
C macros are turing complete.
The only thing preventing Haskell-in-C-Macros is that
i have no idea of high-level functions use cases(i use loops and function composition macros) in C.
If you explain the usefulness of something in Haskell and
what it replaces in C i could add it to some subheader in void.h, like e.g. haskell.h(even if its mostly useless)
http://w11.zetaboards.com/frozenbbs/forum/4210246/

Name: Anonymous 2016-01-03 18:33

>>10
The simplest example would be modifiedCollection = fmap f collection. Here there are no indices, and collection could be anything from a linked list to array to tree to hash-table, with any type of element as long as function f has one argument of the same type as the collection's elements. The result is a new collection of same type (but possibly different type of elements - the same as f's return type) and same number of elements.
I don't even know how to do that in C without using type-unsafe (void *) function pointers. You probably would need some _generic keywords to branch on the collection type.

Name: Anonymous 2016-01-03 18:39

>>11
Hold on, first the basics. I don't know anything
about Haskell(besides that it chains functions cryptically).
does fmap in haskell work like anything in this header?
http://w11.zetaboards.com/frozenbbs/topic/10957067/

Name: Anonymous 2016-01-03 18:51

>>13

func is typically a macro(_Generic) which selects either another macro or function.
all of the below is mem.h
#define foreach(iter,arr) for(u8 iter=0,elms_##iter=elems(arr);iter<elms_##iter;iter++)//}

#define size1(arg1) ({u8 lensize=sizeof(arg1);\
once;\
if((lensize!=sizeof(vp)))break;\
if(isarray(arg1)|isbasic(arg1)){;break;};\
lensize=msize((vp)(u8)arg1);endonce;\
;lensize;})

#define size(...) sum(apply(size1,__VA_ARGS__))

//{elements in array/ptr,clone(obj)
#define elems(arg) (size(arg)/sizeof(arg[0]))

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List