Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 29 2019 00:21
    devth starred brandonbloom/fipp
  • Jan 24 2019 18:09
    cmpitg starred brandonbloom/fipp
  • Jan 21 2019 17:54
    cichli opened #56
  • Jan 18 2019 21:40

    brandonbloom on master

    Add dbg macro (compare)

  • Dec 06 2018 03:48
    brandonbloom commented #54
  • Dec 06 2018 03:48
    brandonbloom closed #54
  • Dec 03 2018 06:54
    xingzhefeng starred brandonbloom/fipp
  • Dec 03 2018 02:11
    shaunlebron opened #54
  • Nov 29 2018 07:20
    rumaysaalvina starred brandonbloom/fipp
  • Nov 27 2018 18:55
    vraerek starred brandonbloom/fipp
  • Nov 24 2018 15:27
    dazld starred brandonbloom/fipp
  • Nov 17 2018 03:20
    beders starred brandonbloom/fipp
  • Nov 13 2018 10:26
    r4um starred brandonbloom/fipp
  • Nov 05 2018 18:21
    brandonbloom commented #53
  • Nov 05 2018 18:21
    brandonbloom commented #53
  • Nov 05 2018 15:10
    aeriksson commented #53
  • Nov 05 2018 15:10
    aeriksson commented #53
  • Nov 05 2018 15:06
    aeriksson commented #53
  • Nov 05 2018 14:45
    aeriksson commented #53
  • Nov 02 2018 21:57
    brandonbloom commented #53
Brandon Bloom
@brandonbloom
just playing with this gitter thing. neat
anyway @kovasb: I'd love for you to try the latest Fipp from CLJS for Gamma!
Kovas Boguta
@kovasb
yup. will try it out this weekend
testing gamma with new fipp, getting
WARNING: Use of undeclared Var fipp.engine/class at line 133 file:/Users/kovasb/.m2/repository/fipp/fipp/0.6.1/fipp-0.6.1.jar!/fipp/engine.cljc
Brandon Bloom
@brandonbloom
@kovasb: your link is now stale, but it was a bad dev check. have you tried latest? simply removed hte bad check
Kovas Boguta
@kovasb
yeah will upgrade to latest
Brandon Bloom
@brandonbloom
success?
chouser was sad i switched from finger trees to rrb vectors :-)
Colin Fleming
@cmf
@brandonbloom I'm looking at how to use fipp in Cursive, as we discussed
Two obvious problems I can see that I can work around - one is that print is hardcoded, the other is that serialize-node for :pass calls str on its arg - I'd hoped to pass an arbitrary object there.
I'll work around the first by just duplicating pprint-document for now, and for the second I can create a new primitive and extend serialize-node to create a {:op :pass :text <my object>} node.
Since for pretty printing the colour coding is done using a style object, not an escape sequence.
Colin Fleming
@cmf
One other question as well - I remember we talked about fipp being streaming, but from what I can tell to print a single data structure requires that the formatting doc for the whole structure be in memory, right?
Since it's all within a single [:group ...]
So if someone prints a gigantic map, I have to read the whole thing before formatting starts.
Colin Fleming
@cmf
Actually, it looks like I can get that by dropping to the lower level formatting primitives that serialize outputs.
Brandon Bloom
@brandonbloom
Regarding streaming: use lazy seqs. If they are treated strictly somewhere, it's bug.
@cmf the group construct is sensitive to both right margin and nesting depth with an upper bound. Lazy seqs will be flattened on demand. That use of laziness is essential to the space guarantee.
Brandon Bloom
@brandonbloom
@cmf seems like pass maybe shouldn't call str. Might be easy/safe to remove, if the same string-coercion behavior is recovered later in the print call (which you're going to override anyway, right?). if you file an issue (or a PR!) I'll take a look some night this week.
Colin Fleming
@cmf
@brandonbloom Ok, I see. I actually wrote an interface last night using the lower-level primitives, and it's pretty nice, so I might just stick with that unless there's a good reason not to?
There is still some trickiness there that I couldn't solve with a tired brain at 1am. Since it's a recursive descent parser driven by an imperative lexer, converting that into a lazy seq was pretty funky.
I then realised that the main processing pipeline is a transducer, and since I have an imperative thing driving it and an imperative thing (printing) consuming it, I was wondering if I could just use a main imperative loop to "push" the formatting ops through the pipeline, but it sounds like you're saying that that may violate the space guarantee?
Or is that if I'm building using the higher-level primitives? That would make sense, thinking about it.
Colin Fleming
@cmf
Ok, so I got this working by implementing my logic as a transducer which takes a string and outputs the low-level formatting ops for the interpretation of that string. Outstanding.
Brandon Bloom
@brandonbloom
if there are any on-lookers: cmf & i discussed via external channels - goodness coming down the cursive pipe :-)
Colin Fleming
@cmf
Petra Jaros
@Peeja
I'm trying to pretty-print some code, but rather than turn it into a string, I want to turn it into React elements to mount in a React app. Is that something I can do with fipp? Can I get it to return something more complex than a single string in the end?
Brandon Bloom
@brandonbloom
@Peeja That's exactly the sort of thing @cmf did for Cursive just above ^^
it's not something that's particularly easy though
the Cursive IDE prints objects that intellij understands so they can be clickable, etc
Hopefully @cmf can chime in to let you know how he did it, but if I recall correctly, he had to modify the pipeline here: https://github.com/brandonbloom/fipp/blob/f644b88329e09a61d33ad15b603856e74dc74039/src/fipp/engine.cljc#L238-L239
Brandon Bloom
@brandonbloom
However, it's worth noting that the DOM isn't really a sensible target for a streaming printer
if I understand correctly, intellij can do streaming output of it's special UI elements in the console window
in theory, you can do that in a browser as well, but there's a practical limit to the amount of stuff you're going to want to render on screen
in which case, it may make more sense to take inspiration from Fipp's implementation, rather than try to force it to work for your usecase
you can also do more interesting things in an interactive medium, like expand/collase and format interior nodes lazily
@Peeja hope that helps!
Colin Fleming
@cmf
@Peeja @brandonbloom my apologies, I just saw this - I cannot get gitter to notify me reliably unless it spams me.
@Peeja if you need info about what I did in Cursive, just let me know.
Tristan Strange
@triss
hey all. I'm a cider user and want to use fipp as my default printer. Can anyone explain how this achieved?
Brandon Bloom
@brandonbloom
Hi @triss, unfortunately for you, I'm a Vim user, so I don't know offhand. I believe the Cider folks have Fipp as an option built in.
Good luck
Tristan Strange
@triss
cheers @brandonbloom I'll take a look one day. Got puget going in the end.