IRC channel logs


back to list of logs

<ijp>hmm, so haunt is erroring on make saying it can't find It definitely exists, so which is the environment variable should I be looking to tweak?
<ijp>inb4 guix environment :)
<macrodeath>hi all, does anyone have experience defining macros that produce new top-level functions? I can't seem to do this, and googling isn't really helping.
<macrodeath>i.e. a make-struct macro so that (make-struct <name> ...) produces (define make-<name> (lambda ....))
<rain1>sure just produce it
<rain1>ill write it
<rain1>oh you make a new symbol out of existing symbols
<rain1>you're not happy with changing the invocation to this? (make-struct <name> make-<name> ...)
<rain1>in order to make implementing the macro simpler
<macrodeath>That'd work, because it's easy to define a macro that uses an existing object. I guess I'm struggling to understand why I can't write (define (symbol-append 'make <name>)). I read online about some stuff with syntax->datum, and some sort of difference between a regular old symbol and an identifier? But to be honest it doesn't make sense to me and doesn't seem well explained
<rain1>it can be done
<rain1>you have to use syntax-case instead of syntax-rules, and datum-
<rain1>datum->syntax and syntax->datum
<macrodeath>can you please explain what a datum object is and what a syntax object is? I don't really understand the distinction, and I feel like that might be a source of my problems
<rain1>datums are just normal scheme data like symbols, lists etc. - that's the level at which you would turn name into make-name
<macrodeath>Ok, that makes sense
<rain1>syntax are special objects that scheme uses while doing macroexpansion on your source code - they include extra data about scope
<macrodeath>which is how scheme accomplishes hygenic macros?
<rain1>yeah exactly!
<rain1>if it just used regular lists instead of syntax objects it wouldn't be able to stay hygienic
<rain1>but this sort of symbol creation thing is 'bending' hygiene a bit
<rain1>I'll make an example code to show how to do it
<macrodeath>thanks rain1, very helpful!
<rain1>so sym and make-sym and datum, whereas make-<sym> and anything inside #` is a syntax object
<macrodeath>Alright. What about the #, syntax? I haven't seen that before
<rain1>are you familiar with quasiquote/
<macrodeath>I'm familiar with the common lisp's macro system, I assumed (probably wrongly) they were somewhat similar. So I know about escaping, I'm guessing that #, does a syntatic evaluation?
<rain1>in quasiquote `(x y ,z) is like (list 'x 'y z)
<rain1>but #` and #, are syntax-quasiquote and syntax-unquote
<rain1>they're analogous but they also involve the extra scope metadata we were talking about
<rain1>no you're right to assume that :)
<macrodeath>the syntax->datum #'<sym> is also bugging me. what value will sym take on after this evaluates?
<macrodeath>on line 5
<rain1>so the relevant concepts for that are phases: macro expansion time and run time
<rain1>we had to use syntax-case rather than syntax-quote to be able to do regular scheme functions at macro expansion time
<rain1>when it wants to expand this piece of source code (define-foo bar) it invokes the macro where the template sets <sym> to the syntax-object bar
<rain1>and then it's just executing a normal scheme function syntax->datum on that, the result will be the symbol bar
<macrodeath>but then we use symbol->string on sym, and sym is set to the syntax-object bar, so how does that work?
<rain1>(and that is happening at macro expansion time)
<rain1>#'<sym> is a syntax-object, but sym is just a regular symbol - it doesn't have any metadata associtaed with it anymore
<rain1>so its exactly like doing (symbol->string 'bar)
<macrodeath>and why couldn't we just call (symbol->string <sym>) in the first place? I've tried this and it doesn't work
<rain1>that's because it's not really a symbol - it's a syntax object which has extra data and stuff
<macrodeath>ahhhhh, I got it!
<macrodeath>Thanks so much rain1
<rain1>great :)
<koz_>I'm building Guile from sauce. How do I tell 'configure' that I want the C parts to be built using -O2? It doesn't seem to do that by default AFAICT.
<koz_>Never mind, figured it out myself.
<amz3>héllo nalaginrut
<amz3>what's up?
<rubdos>Hi! Any good reason not to go for guile as scripting language in my fancy new project?
<M-TimePath>Target audience
<rain1>that's what guile is for
***daviid is now known as Guest59674
***daviid` is now known as daviid
<nalaginrut>amz3: heya
<dsmith-work>Morning Greetings, Guilers
<paroneayea>davexunit: another patch headed your way
<paroneayea>[PATCH] post: Allow posts to set their own slugs.
<paroneayea>for Haunt
<paroneayea>it's very small.
<davexunit>paroneayea: is it not possible to use a custom slug procedure for this?
<davexunit>I'm wondering if this is for built-in convenience or something is lacking in the abstraction
<paroneayea>davexunit: it is possible!
<paroneayea>davexunit: I thought maybe it would be generally pretty nice for others.
<davexunit>just wondering.
<paroneayea>and it's only one line.
<davexunit>a 'slug' metadata item or something?
<davexunit>sounds good!
<paroneayea> :title "(display \\"Hello, World!\\")"
<paroneayea> :date (make-date* 2016 02 09)
<paroneayea> :tags '("hello")
<paroneayea> :slug "hello-world"
<paroneayea>for instance
<davexunit>yeah, that looks good
<paroneayea>and it'll still use the normal slug generation if that's not there
<davexunit>I like it.
<davexunit>I'll apply that and the other pending one
<paroneayea>davexunit: I really love Haunt.
<davexunit>I'm glad!
<davexunit>makes me feel like I'm picked a decent abstraction
<wingo>have you had any thoughts mark on the ports stuff
<ijp>davexunit: did you ever go through the little prover?
<davexunit>ijp: I went through the first chapter
<davexunit>maybe the second
<davexunit>didn't get much farther
<davexunit>it's good
<davexunit>I just can never complete a book ;)
<ijp>I'm going through at the moment, it's really making me appreciate the coq UI
<davexunit>the j-bob source is a little hard to grok, which didn't help.
<davexunit>written in a very weird style.
<ijp>I think it's the weakest of the three
<davexunit>it's definitely been informative for me.
<davexunit>I knew nothing about computer-assisted proof systems before I started
<davexunit>now I know next-to-nothing
<ijp>the problem isn't really the book, but j-bob
<paroneayea>ijp: what's the problem with j-bob?
<ijp>it's a pain to use
<ijp>the prover essentially takes a list of actions and a specification of the path to where the action should be applied, and does them in order. If any step fails for any reason, it just returns the last transformed version of proof
<ijp>it requires the human to keep track of a lot of unnecessary crap
<ijp>also, the "law of dethm" is quite a complicated primitive
<davexunit>paroneayea: applied your patches! thanks again!
<paroneayea>davexunit: thank you!
<paroneayea>ijp: hm ok!