IRC channel logs

2015-08-08.log

back to list of logs

<paroneayea>hello!
<paroneayea>anyone around who can help with the FFI?
<mark_weaver>paroneayea: I have a few minutes
<paroneayea>mark_weaver: hey, thanks
<paroneayea>mark_weaver: my goal over the next couple weekends is to write an FFI based postgres lib
<paroneayea>mark_weaver: the main header is not too complicated luckily:
<paroneayea> http://pamrel.lu/7a23d/
<paroneayea>I think this is probably pretty doable?
<paroneayea>mark_weaver: the part I'm running into trouble with is understanding how to deal with structs
<paroneayea>mark_weaver: it looks like from the documentation that for structs where you know the layout, you can just represent those composing them of the same components(?)
<mark_weaver>paroneayea: any place where an FFI type is wanted, you can pass a list and that is a struct type.
<mark_weaver>so, for example, you can handle structs passed in as arguments or returned from functions, by passing in a list where the type is wanted.
<mark_weaver>as I recall, our docs aren't very clear on that point.
<paroneayea>mark_weaver: hm ok... so a list of (list 1 2 (string->pointer "fooo"))
<paroneayea>could substitute for a struct that has 2 ints and a string?
<paroneayea>mark_weaver: these lines worry me that it might be hard for me to figure out how to pass around this equivalent type:
<paroneayea>/* PGconn encapsulates a connection to the backend.
<paroneayea> * The contents of this struct are not supposed to be known to applications.
<paroneayea> */
<mark_weaver>paroneayea: no, the lists can be substitutes for *foreign types*, not for the values themselves.
<paroneayea>typedef struct pg_conn PGconn;
<mark_weaver>use make-c-struct or parse-c-struct
<mark_weaver>to make or extract the structs
<mark_weaver>gotta go afk...
<paroneayea>mark_weaver: okay I'm not totally clear on this, but I'll look at wingo's guile-sqlite3 lib with this in mind for reference!
<paroneayea>mark_weaver: thanks!
***heroux_ is now known as heroux
***mario-go` is now known as mario-goulart
<mark_weaver>paroneayea: I'm back now, and have more time to answer questions
<paroneayea>hey mark_weaver, thanks! :) I'm making dinner now, but maybe in a while, or I'll have more questions queued for you in a nearby day :)
<mark_weaver>okay, I'll be around on and off tonight, and will read the backlogs in any case
<paroneayea>\\o/
<septopus>reading through the little schemer, came across this. can someone elaborate?
<septopus> http://hastebin.com/ofasedoqok.dos
<septopus>specifically on the answer to the question.. what is the structure of the argument?
<taylanub>septopus: perhaps it means that it's clearer to first check whether somelist is null or not (a type-check), and then when its type is determined as a list, do something accordingly (which in this case involves another 'cond' clause)
<taylanub>septopus: but I'm not sure, it's not clear to me either what's meant with the argument's structure
<taylanub>septopus: by the way, this would be more suitable for the #scheme channel
<amz3>héllo :)
<amz3>can anyone explain me what's the meaning of mlist in the following snippet https://friendpaste.com/3oTsxigppc6OcgKxweP6Ao
<amz3>it's racket code
<amz3>ok I get it
<cluck>mutable list?
<amz3>yes
<amz3>I connected the dots, looking at racket documentation
<davexunit>Haunt 0.1 has been released: http://haunt.dthompson.us/introducing-haunt.html
<amz3>`\\o/`
<amz3>a walkthrough would have been nice
<amz3>would be nice
<davexunit>amz3: the home page has some info
<davexunit>but basically I wanted to release sooner rather than later
<amz3>how do you generate the downloads sections ?
<davexunit>amz3: sxml
<davexunit>the source is all in the repo
<davexunit>website/haunt.scm
<davexunit>a bit messy right now
<amz3>looking at it, I was bit lost
<amz3>I find the page too wide
<amz3>maybe it's personal preference
<amz3>yes, the download page is a regular builder
<amz3>I'm back at trying to get simple markdown parser in scheme using the first parser from GLL
<davexunit>yeah, my CSS and stuff isn't great. a lot of run for improvement.
<zacts>speaking of CSS which guile modules / libraries allow for static blog generation (a la Jekyll)
<zacts>I'm looking at using chicken scheme's hyde egg for this, but it would be cool to see what guile offers, or may soon have the potential to offer
***michel_mno_afk is now known as michel_mno
<amz3>zacts: did you look at haunt ? ^
<amz3>I would be interested in a comparison as I never tried Jekyll.
<zacts>nope. let me check it out though
<amz3>Jekyll is used by 99% of dev crowd
<zacts>yeah
<zacts>I would rather use a scheme based solution for nerdy reasons
<zacts>and technical reasons, and educational reasons
<paroneayea>hello #guile!
<paroneayea>also yay davexunit !
<amz3>I find haunt nice. But I won't use it, I work on something I'd like to dogfood
<paroneayea>go haunt :)
<amz3>hi
<paroneayea>hi amz3
<amz3>maybe i will use for some software i build it could be nice
<paroneayea>ACTION keeps going through manuals for postgres ffi driver
<amz3>it is nice
<amz3>^^
<amz3>there is a lot of function to bind?
<septopus>hey dave, did you use gogs to get your site up? it looks good.
<davexunit>septopus: it's actually just gitweb, the nasty perl web ui that ships with git
<davexunit>I threw a theme on it to make it not ugly
<davexunit>works well enough for my needs
<amz3>davexunit: do you use gitolite?
<paroneayea>davexunit: btw I think I was wrong re: posgres being huge in its api
<paroneayea>davexunit: http://pamrel.lu/7a23d/ this is the header for libpq-fe.h (fe for frontend)
<paroneayea>not too much.
<davexunit>amz3: yes
<davexunit>paroneayea: a lot, but doable
<amz3>I don't thinkg that much is required to build a blog
***michel_mno is now known as michel_mno_afk
<daviid>davexunit: cool stuff, congrat for haunt 0.1 release! the web site could win with bit of arganization if you allow me :) [not talking about esthetic here]. would be nice to reuse the font used in the logo name and add subtitles, like About ... if you are interested I can help, let me know
<davexunit>daviid: it's not a font in the logo :)
<davexunit>I made some scratchy letters on a piece of scrap paper and had inkscape auto-trace it.
<daviid>:) you should create one, it's super cool!
<daviid>davexunit's haunt font!! cool
<davexunit>;)
<davexunit>my knowledge of typography is basically 0
<daviid>mine too, but as a creator, you don't need any knowledge of course ... haha
<amz3>^^
<amz3>how can i define a recursive macro?
<mark_weaver>amz3: nothing special is needed, just do the obvious thing.
<sneek>Welcome back mark_weaver, you have 1 message.
<sneek>mark_weaver, francis7 says: PM francis7 for some good news
<mark_weaver>macro expansion happens from the outside in, so what happens is that, e.g. (and x y) expands into (if x (and y) #f) with the inner 'and' being expanded later.
<amz3>I think it doesn't work with define-syntax-rule
<amz3>I should have said that
<mark_weaver>it does
<amz3>ah I try again
<mark_weaver>hmm, well, actually, I think there's a fundamental problem with trying to use 'define-syntax-rule' to define a recursive macro: there's no way to define a separate "base" case.
<mark_weaver>so the recursion will never end
<amz3>yes exact
<amz3>I ll try otherwise thanks mark_weaver
<mark_weaver>well, obviously you need a define a recursion that will eventually terminate :)
<amz3>I skipped this part ^^
<amz3>define-syntax works as expected
<amz3>macros and goops are two areas where I can learn a lot
<amz3>the funny things is that I'am super fan of python class and fiddle with metaclass, but right now I feel no hurry to learn it in scheme
<amz3>something that I found dubious in javascript, inline function definition, is actually very useful in scheme
<amz3>Since i did two times the same program, I can tell that i prefer the scheme implementation, so far.
<amz3>macros and goops are two things I know I don't know ;)
<OrangeShark>amz3: I need to learn more about macros and goops as well
<amz3>define-syntax-rule is an easy way to define macros (define-syntax-rule (increment a) (+ a 1)) it can't be easier
<amz3>the recursive macro we were talking about previously is implemented using define-syntax
<amz3> https://friendpaste.com/3oTsxigppc6OcgKxweG5Aj
<amz3>it's only file lines...
<amz3>five*
<mark_weaver>amz3: this is a case where 'syntax-rules' would be sufficient, and it's a bit simpler that way.
<mark_weaver>(define-syntax seq* (syntax-rules () ((seq* a b) (seq a b)) ((seq* a b c d ...) (seq a (seq* b c d ...)))))
<mark_weaver>I added 'c' and 'd' there to make sure that rule would only match when there are 3 arguments or more.
<mark_weaver>the pattern "x ..." matches any list (zero or more elements)
<amz3>thanks a lot, it helps