<galex-713>Are “variants” like in ocaml possible with guile? <galex-713>That is a type that can be multiple types, in order to define data structures <ijp>in Scheme, types usually correspond to predicates, so variants boil down to a macro that generates a bunch of different record types and a common predicate for all <ijp>possibly with some sort of typecase to destructure <ijp>this has probably been implemented 578 times as a macro <galex-713>ijp: why not (define (myvariantp val) (or (typep val) (typep val))? <ijp>which is what said macros usually do <galex-713>ijp: is there a way to make records with fixed-type members? <ijp>you can, but it won't make them cheaper <galex-713>can you make records from arrays to improve performance? ***wleslie is now known as toothlesshd
***toothlesshd is now known as wleslie
<davexunit>galex-713: typed structs aren't available yet. <davexunit>I started writing a simple struct unboxing implementation, but it turns out that it's not what the guile maintainers ultimately want. <davexunit>I want my game engine to take advantage of f64 unboxing in the new guile. I have record types for things like 2d/3d/4d vectors that would benefit greatly from their fields being unboxed. <davexunit>lloda: but there are optimizations that cannot be made yet, like storing f64s in structs <davexunit>I mean, you can store f64s in structs, but the compiler cannot unbox references to them <davexunit>a hack that I've tried is to use a struct with a single field that is an f64vector, but it made my code significantly more difficult to work with. <davexunit>I wasn't able to squeeze out enough of a performance boost to make it worth it. <ruste>davexunit: Just used haunt to build my github page. Fantastic stuff. <ruste>Randome scheme question. Suppose I want to make a macro that takes two symbols and expands to a pair of define statements that assign them values. I can't think of a way to do that. <davexunit>I wrote the damn thing, yet I still have a half-finished blog migration... <davexunit>still using pelican and haven't blogged in a year... <ruste>Maybe with a lisp style macro and an unquote, but that just feels icky. <davexunit>(define-syntax-rule (define-some-stuff one two) (begin (define one 1) (define two 2))) <ruste>Yeah! I've been trying to write up all my projects! It'll be a while. <davexunit>'begin' is interesting. definitions within the 'begin' form are hoisted into the place where 'begin' appears <davexunit>so, if this macro was used at the top-level of a module, then the definitions would apply to the top-level of that module. <ruste>Okay. I'll have to try that in 2.0 when I get home. <ruste>That is interesting. That's not what I would have expected. <ruste>I did my best to compile 2.0 for windows but to no avail. <ruste>1.8 is the only one in cygwin. <ruste>I sorely miss my linux environment at work. <davexunit>but I think that one or two people submit patches to help make guile work better/at all on windows <ruste>Yeah. I tried building 2.0 in a shell account I have but I've only been able to build it from source on slackware on my chromebook. <ruste>Hopefully someday. That would make game development in guile a lot more interesting. <ruste>Having a much wider audience. <davexunit>I've built guile from source on a number of distros <davexunit>it works just fine on any gnu/linux distro or os x <ruste>I've always had trouble with declarations in pretty basic libraries. <ruste>I think the shell account I'm building it on is gentoo. <ruste>Getting something about pollfd being declared or defined strangely. <ruste>I think I've run into similar problems whenever I've tried in the past. <davexunit>I don't know what gentoo's problem is, but the guile packages in their repos have been messed up for years <davexunit>whoever maintains those has no idea what they are doing. <ruste>Yup. It's a shell acount though so I can't just install a package without a lot of effort so I'm just building from a tarball. <koosha>Is there some cheet sheet for guile ? <koosha>dsmith-work: hahha , Okay , thanks . <ruste>koosha: I usually just keep the latest manual open as one giant page in my web browser and C-f when I need something. <ruste>Does anyone here regularly use GOOPS? I don't think I've ever seen it used. <galex-713>ruste: I think it is only used for OOP libraries, like GTK+ <ruste>galex-713: That's pretty much the the impression I got. <ruste>I think it has its uses but pretty much all of its proponents take it waaay to far. <ruste>You don't need OOP in a language to write OOP code. <ruste>I think most of my code ends up being relatively object oriented. <ruste>And I write mostly scheme and c. <galex-713>object oriented means abstraction/encapsulation + heredity + polymorphism <galex-713>Only polymorphism is useful here, and yet it becomes a nightmare with heredity <galex-713>At least you maybe need a good type system, but not OOP <ruste>They keep it way too cold in here. Hard to type with numb fingers. <webshinra>(say the one which defend the C type system) <ruste>Common lisp has us beaten on implementation standardization and popularity. <ruste>It's too bad they're just too blind to see that guile is the best lisp. <galex-713>It’s kinda like ε > guile > scheme > elisp >= common lisp > C > * <galex-713>If we were talking about kernels, common lisp would be linux, scheme would be BSD, guile would be Open/NetBSD and epsilon would be hurd <ruste>So it's a performant kernel that will have a variety of relatively general dsls built on top with the option to customize and add more? <ruste>But not really in this case. <galex-713>There are like a few dozens primitives on which you base any programming language you want <ruste>Huh. Personally guile = C > Scheme >> all else. <ruste>I like it for the same reason I like guile. <ruste>Both get out of my way, just in different ways that are useful to me in different ways. <galex-713>C is cool only because it is fast and widely used <galex-713>So we use it until guile/epsilon becomes better <ruste>Guile doesn't impose any sort of paradigm on me. <ruste>C doesn't care at all what I do with it. <ruste>Do the wrong thing, seg fault. <galex-713>C is hard and ask you to do lot of useless stuff <ruste>That's why I use guile most of the time. <ruste>While it does enforce a paradigm. It's a trade for the power and less of a trade than C++ <ruste>At this point I only touch C if I have to, but I prefer it to many of the alternatives. <koosha>Why guile doesn't accept this code ? : ( define (foo) (define x 4 ) ) <dsmith-work>mordocai: I think it is as far as bpt's code. There have been Guile releases since then, so there may be issues.. <koosha>dsmith-work: Is it needed ? I just want to edit the x value in my function . <dsmith-work>koosha: Pretty much the same as (define (foo) (let ((x 4)) )) <koosha>dsmith-work: But why defining it is wrong ? <galex-713>koosha: because you are defining a new variable with the same name but more local scope <galex-713>like (let ((var 1)) (display var) (let ((var 2)) (display var)) (display var)) prints 121 <dsmith-work>(define (foo) (let ((x 4)) #! must be an expression here !# )) <galex-713>more precisely, I explained what was going on, not why wasn’t it going to work x) <galex-713>Anyway, even if it worked, at the end of your foo proc, normally x would have the same value, which is completely useless <dsmith-work>It a thing that doesn't make sense. Like (define x) or (set! x) <koosha>Right . Where can I read about it in doc ? <avoine>this guile-emacs related story just land in the ycombinator front page <ijp>it arguably shouldn't, but that ship has sailed <galex-713>dsmith-work: you use (define x) to declare your variable (and its scope) before to use it <dsmith-work>koosha: "The expressions in body are evaluated in order, and the value of the last expression is returned as the value of the let expression." <galex-713>ah yeah, that is because define returns <undefined> while let doesn’t <galex-713>That’s so bad define doesn’t return the defined symbol, like elisp <galex-713>also that if returns undefined instead of nil sometimes :( <ijp>the symbol wouldn't help you at all <galex-713>ijp: I already made macros/functions using that <galex-713>ijp: it’s the common-lisp/elisp void list, (), except you can use it as #f too <ijp>anyway, definitions are segregated from expressions <ijp>galex-713: I know what it is, but guile doesn't use it <ijp>(except for elisp compatibility, and even that doesn't work right) <ijp>so the return value of a definition doesn't make sense <galex-713>Yet scheme has all these cool stuff like named let, etc… <avoine>but this is still a work in progress <mordocai>Yeah, I might see if I can get it up and running at home to try it out. Looks like latest commit was march so relatively recent