Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Jean-Louis Giordano
    @Jell
    I've played with it for a few hours today
    I could 100% do a "beginner's guide to Go Generics" one-hour talk about this
    Jean-Louis Giordano
    @Jell
    could do a cross-over webinar with the Go West meetup group
    jolod
    @jolod
    @Jell Great!
    Jean-Louis Giordano
    @Jell
    I'm checking with Go West if that's of interest
    Erik Svedäng
    @eriksvedang
    Cool. I’ve been writing Go today!
    Magnus Therning
    @magthe
    As long as you fit in "e du go elle?" or calls Wadler "en go gubbe", om all for this 😁
    No, of course I'm unreservedly in favour, @Jell
    Jean-Louis Giordano
    @Jell
    :smile:
    jolod
    @jolod
    "go.lambda" ;-)
    Jean-Louis Giordano
    @Jell
    gonna share here as well: went berserk on Go generics during the weekend and tried to implement Clojure's transducers in Go
    Side-by-side comparison:
    (def in [1 2 3 4 5 6 7 8 9])
    (def xform (comp (map (fn [x] (quot x 2)))
                     (take 5)
                     (map (fn [x] (* x 2)))
                     (map (fn [x] (* x 2)))
                     (map (fn [x] (* x 2)))))
    (def out (into [] xform in))
        in := []int{1,2,3,4,5,6,7,8,9}
        xform := Compose(Compose(Compose(Compose(
            Map(int,int,[]int)(func (x int) int { return x / 2 }),
            Take(int,[]int)(5)),
            Map(float32,int,[]int)(func (x int) float32 { return float32(x * 2) })),
            Map(int,float32,[]int)(func (x float32) int { return int(x * 2) })),
            Map(int,int,[]int)(func (x int) int { return x * 2 }))
        out := into([]int{}, xform, in)
    I think it's great because in go with generics:
    1. it's possible to implement transducer
    2. you really shouldn't :D
    Veit Heller
    @hellerve
    looks great! are they streamable/lazy or do they realize every value right away (i.e. intermediate arrays)
    Jean-Louis Giordano
    @Jell
    they do not realize intermediate arrays (like in Clojure), but in that first version I wrote they actually only work from and to arrays, I need to put a collection interface to make into more "generic"
    (I mean, into only accepts arrays as in & out, xform doesn't care)
    (ok rather, xform cares because you need to give the right type annotation when instantiating it, but you could replace []int with whatever type instead in the type annotations)
    Veit Heller
    @hellerve
    neat!
    Magnus Therning
    @magthe
    I found what I think is a rather good example of refactoring to FCIS. The original is in Python and I attempted a version in Haskell: https://gitlab.com/magus/sync-fcis-refactor
    What do you think about it? Maybe it couybe used in a meetup, a group exercise, ...
    Or maybe someone wants to contribute a version in another language? Clojure? OCaml? F#? Why not JavaScript or C#?
    jolod
    @jolod
    Tiny poll: do you use qualified or unqualified imports in Haskell? (In most languages "import all" statements are shunned, but they are common practice in Haskell. Personally I generally import types and operators unqualified, and qualify everything else.)
    Veit Heller
    @hellerve
    personally i qualify everything until it becomes ridiculous. if i import more than, say, 10 things, then i either import qualifiedly, or just import it all directly (though i don’t really like that all that much tbh)
    jolod
    @jolod
    @hellerve When does it become ridiculous to qualify? :-)
    Magnus Therning
    @magthe

    Organising the imports in Haskell sometimes feels rather silly.

    Stuff like this

    import Data.Conduit ((.|))
    import qualified Data.Conduit as C

    is a bit laughable, but feels necessary.

    Veit Heller
    @hellerve
    @jolod sorry, unclear language: when it becomes ridiculous to list the individual functions to import (which is a different qualification than importing using qualified)
    jolod
    @jolod
    Have any of you found import Mod as Foo (x,y) or import qualified Mod as Foo (x,y) useful (in real code)?
    Veit Heller
    @hellerve
    i cant say ive used it very much
    jolod
    @jolod
    I've never used it. :-)
    Magnus Therning
    @magthe
    @jolod you mean using both named import and limit what functions to import? No, never used that. Also never used import Mod as Foo except (x,y).
    Marco Z
    @ocramz
    :wave:
    Magnus Therning
    @magthe
    Hi @ocramz
    jolod
    @jolod
    @magthe So the idea is to refactor these snippets to FCIS?
    Magnus Therning
    @magthe
    Yes, that's the idea.
    Marco Z
    @ocramz
    hullo again! been missing for a while, how are you all doing?