Fork me on GitHub
#clojure
<
2015-08-04
>
ghadi02:08:52

Current progress on a PEG parser: https://www.refheap.com/107514

ghadi02:08:12

That's an example of a grammar to match JSON ^

ghadi02:08:46

Compiles to an instruction set for pattern matching

ghadi02:08:44

Based on a little mashup of Lua's LPEG library (which has an amazing paper to go along with it) and Scala's Parboiled2 library

ghadi02:08:22

TODO: write the VM, write the capturing code, and implement the AST optimizations in the LPEG paper

ghadi02:08:53

Have no idea how fast it will be, but if it is 2x slower than a handwritten parser like Jackson I'll be thrilled

danielcompton04:08:47

Is there a get like function which will return the map entry in a map, not just the value?

arrdem04:08:50

danielcompton: clojure.core/find

arrdem04:08:24

the thought is appreciated

cfleming05:08:27

@ghadi: Looks awesome. That LPEG paper is really nice, as is the lib.

cfleming05:08:02

I’m using PEG parsers in Cursive for macro parsing too, although just at the lexeme level, not chars

ghadi05:08:41

Ah, cool.

ghadi05:08:58

Using a lib for PEG in Cursive?

cfleming05:08:11

I’m using parser combinators, but compiling to a VM would be nice too.

ghadi05:08:24

I'm trying to figure out the appropriate API for the stack of captures

cfleming05:08:30

No, using combinators it’s around a page of code

cfleming05:08:55

Ok, my capturing stuff is pretty ghetto. I need to go back and read the paper again.

cfleming05:08:17

I’m going to be adding error recovery soon too, so I can mark syntax errors in the editor.

ghadi05:08:37

which paper, the Hutton one?

cfleming06:08:28

The one I was thinking of was Medeiros/Ierusalimschy

cfleming06:08:14

Is there another one I should be reading? It’s been a while since I read all the PEG lit

ghadi06:08:17

Oh, yeah it's an amazing paper...

ghadi06:08:14

that one is less accessible to me than this article by Ierusalimschy http://www.inf.puc-rio.br/~roberto/docs/peg.pdf

cfleming06:08:36

Nice, I hadn’t seen that, thanks. I’m planning to work on the error recovery stuff soon so I can return partial matches with error info (important during editing since the AST is usually broken).

ghadi06:08:13

you seen cgrand's talk from the first conj?

cfleming06:08:40

No, I haven’t - was that about seqex?

cfleming06:08:35

Nice, I’ll have to watch that. What I ended up with is similar to the Illuminated Macros talk by chouser and Jonathan Claggett

cfleming06:08:23

Which is also well worth a watch if you haven’t seen it.

ghadi06:08:01

cfleming: nice. Second reference to Illuminated macros I've received tonight

ghadi06:08:20

I was there for it but didn't remember it so much about parsing

Pablo Fernandez08:08:20

Is there something like rails’ asset pipeline for clojure, that will smudge all css into one, all js into one, maybe do image spriting?

Pablo Fernandez08:08:34

@magnars: oh… as a ring middleware. Interesting.

magnars08:08:47

yeah, the idea is that assets needs to be first-class, so that you can write middlewares to transform them

borkdude08:08:32

@pupeno: @magnars I also use that one, works good for me

kushalp09:08:22

Let’s say there’s a record that exists like: (defrecord User [id]). What’s the difference between instantiating it with ->User vs. User. ?

ordnungswidrig10:08:51

kushalp: the result is the same. ->User is a clojure function bound to a var while User. invokes the java constructor of the corresponding class User.

ordnungswidrig10:08:42

kushalp: in general I would go with ->User because you can do all things to this var/fn you can do with every other function, e.g. trace in cider, add/extract metadata etc.

kushalp10:08:11

@ordnungswidrig: thanks for the clear explanation

razum2um12:08:01

anyone using spark with clojure? what is your experience?

sp3n12:08:00

anyone using counterclockwise for clojure dev? since upgrading i can’t seem to launch a headless repl for my project or even for a default leiningen project

sp3n12:08:11

getting various java heap space errors

sp3n12:08:13

clojure.lang.Compiler$CompilerException: java.lang.OutOfMemoryError: Java heap space, compiling:(deps/cljfmt/v0v1v10/deps/rewrite_clj/v0v4v12/rewrite_clj/potemkin.clj:59:18)

val_waeselynck14:08:51

@sp3n: never had such issue. Usually, when something goes wrong with Eclipse, I swich workspaces, then come back

sp3n14:08:30

hey @val_waeselynck thanks for the reply - i hadn’t had this issue before either, only since i updated

sp3n14:08:36

what do you mean by switch workspaces?

sp3n14:08:10

ah wait i found the setting

sp3n14:08:57

i think i was using the old ccw-settings from my previous version which was screwing with things

sp3n14:08:15

thanks for leading me to switch workspaces - seems to be all working again now simple_smile

val_waeselynck14:08:58

yeah, although I love CCW (especially the structural editing and the REPL) you definitely want to get used to the usual crash simple_smile

benedek15:08:59

wondering how many ppl miss proper clj support in atom? would be pretty easy to do an integration with cider-nrepl and/or refactor-nrepl for atom but not sure if it worths the effort...

jeluard15:08:05

@benedek: someone started working on an ClojureScript editor for Atom : https://github.com/darwin/plastic

benedek15:08:55

thx @jeluard for info. will check it out

darwin15:08:40

it is not useable at this point, if this experiment proves itself, it will be clojurescript first, clojure second

darwin15:08:05

give it few more years simple_smile

jeluard15:08:09

@darwin do you have more details about what you are planning to implement?

darwin15:08:48

this is my one-month old brain dump, at that time, plastic was a fork of LightTable, later I started over as Atom package https://gist.github.com/darwin/d8fc8556e6fbdc7dee11

darwin15:08:54

not very specific, just some thoughts, I’m not a big planner, we’ll see how far I can get

viniciushana16:08:37

Kinda curious: anyone here has been using Atom for Clojure development?

mikeholmesuk16:08:16

@viniciushana: Yep, am wavering between that and lighttable at the moment.

viniciushana17:08:09

Interesting, how do you solve navigating through references? I think that’s the main point I stick with Cursive

cddr17:08:51

In this gist, how come foo is unbound within the inner function applied by the map? https://gist.github.com/cddr/e8a800cd8d416f5d71d7

potetm17:08:03

@cddr: First guess is that map is lazy. So the mapping fn isn’t actually invoked within the binding form.

cddr17:08:11

Ah that's it! Wrapping doall round it makes it work

blueberry19:08:10

Does anyone know how to change the text in the REPL prompt in Emacs Cider? When I have a long nested space, it takes a lot of the screen width... So, instead of something.something.something.myns> i would like it to just display the last part, myns>

pmooser19:08:10

@blueberry I think you can define your own function and set it as the value cider-repl-prompt-function

pmooser19:08:27

"set it as the value of ..." I meant

sjol21:08:10

@potetm: Thank you! I managed to get a better fix on this by using lightable and in my clojurescript code ended up having to use for, though.