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 2015-12-27 15:50

2007

Name: Anonymous 2015-12-27 16:17

a haskell in every pot everyday

Name: Anonymous 2015-12-27 19:08

Now write Haskell in C macros

Name: Anonymous 2015-12-28 15:22

>>6
Do you want to bugger Haskell Curry, ya necrohomophiliac faggot?
I think it'd be more of a bestiality thing.

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:45

>>12
Yes, it works like map(A,func), but that one's for arrays only. How would you go about abstracting it to different collection types like trees and hash-maps? Also is the func just a (void *) pointer, or does its type actually get checked when it's applied to func(A[i])?

Name: Anonymous 2016-01-03 19:18

So am i right?
What fmap does is
1.just selects a structure iterator(probably can be done via _Generic or __builtin_choose_expr/__builtin_types_compatible_p
2.iterate trough it and apply function (for_each(i in a) func(a[i])
nothing mindblowing yet.
But what if i wrote my own structure, does fmap
construct an iterator on its own?
Is fmap hardcoded for haskell structures only?
i.e. its giant switch with all thousands of possible structures and object or its some interface to iterators
which is fundamental to haskell?

Name: Anonymous 2016-01-03 19:55

>>18
fmap is easily doable without any GC.
#define iterator(obj,i) _Generic ( obj , hugelistof_all_posible_structures:nextmember(obj,i))

is the below macro(argmacro.h subheader) lazy eval?
//macro chain,fail to terminate
#define mch(func,args...) opapply(&&,func,args)

Name: Anonymous 2016-01-03 21:53


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