2015-10-13
| 00:17 | mungojelly | i want to insert something every nth item in a sequence, i did (filter #(not (= % filler)) (interleave thingiwantlotsof (concat filler (take n thingiwantoccasionally ... but that seems silly? :) |
| 00:18 | justin_smith | ,((fn every-nth-fill [item coll n] (apply concat interleave (partition-all n coll) (repeatedly item))) :spacer (range 10) 3) |
| 00:18 | clojurebot | #error {\n :cause "Wrong number of args passed to keyword: :spacer"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "Wrong number of args passed to keyword: :spacer"\n :at [clojure.lang.Keyword throwArity "Keyword.java" 97]}]\n :trace\n [[clojure.lang.Keyword throwArity "Keyword.java" 97]\n [clojure.lang.Keyword invoke "Keyword.java" 110]\n [clojure.core$repeatedly$fn__5099 in... |
| 00:19 | justin_smith | ,((fn every-nth-fill [item coll n] (apply concat interleave (partition-all n coll) (repeat item))) :spacer (range 10) 3) |
| 00:19 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.core$interleave> |
| 00:19 | justin_smith | ,((fn every-nth-fill [item coll n] (apply concat (interleave (partition-all n coll) (repeat item)))) :spacer (range 10) 3) |
| 00:19 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword> |
| 00:19 | justin_smith | :P |
| 00:19 | mungojelly | that makes more sense yeah, partition into the pieces, put the spacer between, yeah that expresses what i'm doing thanks :) |
| 00:20 | justin_smith | ,((fn every-nth-fill [item coll n] (apply concat (interleave (partition-all n coll) (repeat [item])))) :spacer (range 10) 3) |
| 00:20 | clojurebot | (0 1 2 :spacer 3 ...) |
| 00:23 | mungojelly | ok somewhat related question, i've taken 200000 of that pattern, and then i want to go in and change some stuff in the long version, but it seems silly to keep a zillion repetitions to express that i want to change something in the middle, is there something for expressing that idea of "this repeated, but with these changes" |
| 00:24 | justin_smith | mungojelly: you may be able to express your pattern using take / repeat / cycle? how to express it in code would really depend on the pattern |
| 00:26 | mungojelly | i can write what i want easily enough i think, i just want to have a patch set like [[12345 :q] [123255 :z]] and then build a seq that takes the patch if available or else the base sequence |
| 00:26 | mungojelly | it takes forever to know what's NOT out there already so i know when i need to spell it out :) |
| 00:28 | mungojelly | i just found out today about bardo which does all sorts of interpolation, i could write out any of those ideas of how to interpolate but it's so much nicer to just have them all at hand and bang around with them |
| 00:30 | mungojelly | there's no concept already of like a sparse sequence, so you just give it the indexes of the things that ARE filled, and then when you pull on it it gives you "nil" or a default unless you've got something there |
| 00:30 | mungojelly | oh i think i saw a matrix package, that must have sparse matrixes, i'll look tehre |
| 04:12 | tdammers | so I'm getting "Unsupported operation: can't eval locals" when trying to call a macro inside a macro |
| 04:13 | tdammers | what does that mean? what am I doing wrong? |
| 04:22 | Kneiva | tdammers: Can you check it with macroexpand? |
| 04:23 | tdammers | nope |
| 04:23 | tdammers | it doesn't compile |
| 04:23 | tdammers | I'll try to come up with a minimal case, hold on |
| 06:22 | shourya | Going a little off topic here, any easy language to learn? |
| 06:25 | tdammers | shourya: depends on what you already know, how deep you are willing to dive, and what kind of goals you have |
| 06:25 | tdammers | shourya: some languages are easy to pick up but get progressively harder as you do more complex stuff; others have a steeper learning curve but pay off eventually |
| 06:26 | shourya | I'd go with the steeper learning curve languages. |
| 06:26 | shourya | tdammers: what's the first language you started with? |
| 06:28 | algernon | steeper learning curve, but great benefits, I'd say Haskell. |
| 06:28 | tdammers | algernon: ;) |
| 06:28 | tdammers | shourya: Pascal |
| 06:29 | tdammers | shourya: would not recommend as a first language these days, but it wasn't too bad |
| 06:33 | shourya | Ah thanks guys! |
| 06:51 | shterrett | I need to generate a list of Timezones. I was trying to `(import ‘[org.joda.example.time TimeZoneTable])`, but I get a ClassNotFoundException org.joda.example.time.TimeZoneTable error. |
| 06:51 | shterrett | http://www.joda.org/joda-time/timezones.html |
| 07:08 | Kneiva | shterrett: and you have joda time in your dependencies? |
| 07:08 | shterrett | I’m able to import org.joda.time DateTimeZone without a problem |
| 07:09 | shterrett | But I haven’t explicitly specified it |
| 07:11 | shterrett | Adding org.joda.time or org.joda.example.time gives me a “Could not find artifact in clojars” error |
| 07:14 | oddcully | shterrett: maybe one of your already established deps brings in joda-time and maybe with some incredible old version |
| 07:15 | oddcully | shterrett: i'd check the deps in the project first to see what's up |
| 07:15 | shterrett | oddcully: joda isn’t in the existing deps; is there a way to check the version from the repl? |
| 07:16 | oddcully | start with a `lein deps :tree` first |
| 07:17 | shterrett | oddcully: joda-time is a dependency of selmer; version 2.7 |
| 07:18 | oddcully | oh wait... example |
| 07:18 | oddcully | i doubt, that this is part of the jar or gets packaged in any jar |
| 07:19 | shterrett | the docs say “This table can be rebuilt by running org.joda.example.time.TimeZoneTable” |
| 07:19 | shterrett | But I can only do that if I have the source? |
| 07:20 | shterrett | Is there another way to list timezones? I’m trying to give users a way to select their timezone in a web form |
| 07:20 | oddcully | why not look at the examples source and adopt it yo your needs? https://github.com/JodaOrg/joda-time/blob/master/src/example/org/joda/example/time/TimeZoneTable.java |
| 07:22 | shterrett | I can do that; I can also copy the generated table and save it as an array. I was just hoping to reuse existing code. |
| 07:24 | oddcully | well i think the example is what it is: an example. gathering the zones and turning it into html should be separated in your code. but ymmv |
| 07:27 | shterrett | ah - I see. I thought the class call referenced in the documentation was just a list of the zones. I didn’t realize it was building the html |
| 07:27 | shterrett | I was planning on doing that part; I just wanted a canonical list of the timezone names |
| 08:03 | kungi | What can go wrong in the wiring if goog.require("some_cljs_file.clj") cannot find the namespace? |
| 08:09 | kungi | AAAARGH! |
| 08:09 | oddcully | (inc rubberduck) |
| 08:13 | kungi | oddcully: It took me ~40 Minutes to recognize I needed an ^:export on a function. |
| 08:14 | kungi | Sometimes I would prefer doing something with wood instead computers. |
| 09:06 | kungi | Which header do I have to set in a GET request to request edn output from my api instead of json? |
| 09:08 | oddcully | kungi: have you tried Accept: application/edn |
| 09:08 | kungi | oddcully: no i haven't :-) |
| 09:09 | jonathanj | is liberator a popular library? |
| 09:09 | jonathanj | (i like it but i don't see many people talking about it) |
| 09:09 | kungi | oddcully: \o/ |
| 09:09 | kungi | oddcully: that was easy |
| 09:10 | jonathanj | swagger has some really appealing properties but there doesn't seem to be much discussion about using swagger and liberator together |
| 09:11 | kungi | jonathanj: I had a look at liberator, but the lack of swagger support turned me off. Currently I am using compojure-api |
| 09:11 | jonathanj | i just found yada, it seems interesting after a 60 second glance |
| 09:12 | jonathanj | kungi: how are you finding compojure-api? |
| 09:14 | ikitommi_ | jonathanj: many people have been asking about Liberator + Swagger, and I know some guys who have poked with it. |
| 09:16 | ikitommi_ | ring-swagger provides a clean model for describing the endpoints with schema. used also by compojure-api & yada. |
| 09:16 | kungi | jonathanj: It works most of the time. I don't like the compojure routing style very much since I've seen bidi which looks way cleaner. |
| 09:17 | ikitommi_ | and there is also pedestal-swagger (https://github.com/frankiesardo/pedestal-swagger) and we are working on a CQRS+lib with Swagger. |
| 09:21 | kungi | ikitommi_: When I define a schema where some keys are schem/Int they don't show in the swagger-ui in the "Model Schema" section as required parameters. Is this a known problem? |
| 09:40 | ikitommi_ | kungi: not sure what's the case, could you write an issue (with details) of it? |
| 09:42 | ordnungswidrig | maintainer of liberator here. I'm not a big fan of swagger although I'm absolutely not against it. Unfortunately I'm pretty much the only maintainer of liberator and I'm spending my time more on fundamental issues. I'd welcome any patch or additional library to marry liberator and swagger! |
| 09:42 | kungi | ikitommi_: sure |
| 09:45 | ikitommi_ | ordnungswidrig: but, what do you think if i collect the guys who have been poking with that and we could have google hangout to discuss if how (and by whom) it could be done? (co-author of ring-swagger here) |
| 09:47 | ordnungswidrig | ikitommi_: that sounds like a good idea. I'd love to have people be able to build something like a swagger integration with it. What should be possible today is to declar "swagger model" and convert that to a liberator resource declaration e.g. |
| 09:57 | jonathanj | ikitommi_: sorry if this is a stupid question, but it's not particularly clear how ring-swagger and liberator interact |
| 09:58 | ordnungswidrig | they don't |
| 09:59 | jonathanj | ordnungswidrig: why aren't you a fan of swagger? |
| 10:00 | ikitommi_ | yes, they don't. best way would be to make Liberator resource publish it's swagger-endpoint info out in the schema defined by the ring-swagger, for the routing-swagger integration to use. |
| 10:01 | ordnungswidrig | To me swagger looks very much procedural, focusing on "api calls". I'm more into the "resource model" like HTTP promotes it. I.e. resources which are represented by media types and are manipulated in an uniform way by methods. Swagger is a case of out-of-band documentation while a RESTful architecture promotes hyperlinking and discovery. |
| 10:02 | ordnungswidrig | So I'm not against swagger, which might be useful for "published, versioned" APIs. But that's not my usecase :) |
| 10:02 | jonathanj | isn't that totally orthogonal to Swagger itself and more of a user-chosen usage? |
| 10:03 | jonathanj | (promoting hyperlinking and discovery) |
| 10:05 | ordnungswidrig | jonathanj: yes and no. Swagger published typically a "single view" on and application. Whereas in a RESTful architecture you have individual and independent resources which happen to link to each other. In the latter architecture you could crawl the web and gather the same information. I think that swagger lead developers of skip the discover part and hardcode urls, media |
| 10:05 | ordnungswidrig | types and relations. |
| 10:06 | jonathanj | yada and liberator seem to have very similar ideals |
| 10:07 | ordnungswidrig | jonathanj: the have very similar developers: Malcolm Sparks who is the main dev of yada helped a lot with liberator :) |
| 10:08 | jonathanj | https://github.com/juxt/yada/blob/master/dev/resources/user-manual.md#liberator |
| 10:08 | ordnungswidrig | I yada would not have the dependency on manifold for async, you could implement it on top of liberator. |
| 10:10 | jonathanj | having used liberator a few times, i think the biggest draw yada (well actually swagger has) is the documentation |
| 10:10 | jonathanj | i have no desire to sync separate markdown files with the code and host them somewhere |
| 10:11 | ordnungswidrig | It should be possible to extract docs of the liberator resource declarations, or make it available for OPTIONS requests. |
| 10:12 | jonathanj | well, it is just code so "possible" is not in question, it's more about convenience |
| 10:12 | ordnungswidrig | One problem with liberator is that the callbacks are functions which tend not to serve well as documentation. But many of the decisions actually use "static" declarations like :available-media-types which could be used for docs. |
| 10:13 | jonathanj | documenting :available-media-types is of relatively little value though |
| 10:15 | ordnungswidrig | just an example. but in my opinion the available media types (and the documentation of them) are the single most important information about a hypermedia resource |
| 10:15 | jonathanj | that's the tail end of the problem though |
| 10:16 | jonathanj | first you have to know what the resource's purpose is and how it fits together with the rest of the service |
| 10:16 | jonathanj | once you have an abstract understanding of that then you can start worrying about how they're represented |
| 10:16 | jonathanj | imo |
| 10:17 | jonathanj | ordnungswidrig: anyway, this is mostly wishful thinking because there isn't anything to take the documentation generation and hosting problem off my hands for liberator (that i know of) |
| 10:18 | ordnungswidrig | For the architecture that I described and which is the one HTTP was built for, the resource should self describe". I guess you're more interested in serving APIs over HTTP which a fine but not what HTTP was initially designed for. |
| 10:20 | dnolen | I just cut 1.7.145 https://github.com/clojure/clojurescript/releases/tag/r1.7.145 |
| 10:21 | dnolen | before putting together a proper announce it’d be great if people could take a second to test it |
| 10:22 | jonathanj | ordnungswidrig: what do you mean self describe? |
| 10:32 | noncom | i'm now trying to compile a project that uses cljx conditional compilation and the project code cannot be evaled since no reader function is found for tag +clj - how do i fix this? |
| 10:32 | ordnungswidrig | jonoathanj: example: when you look at http://api.m.ox.ac.uk/browser/#/ (a HAL browser for some the oxford university's services you'll find that you can discover the available resources and media by following the hyperlinks. |
| 10:33 | bja | dnolen, I'm not using UUIDs in my cljs project, but there were no regressions using the tarball for r1.7.145 |
| 10:34 | ordnungswidrig | jonathanj: given that the application understands the HAL media type you and the relations (which are documented at http://moxie.readthedocs.org/en/latest/apps/{rel}.html) |
| 10:35 | dnolen | bja: great thanks for the feedback |
| 10:35 | ordnungswidrig | jonathanj: the link template seems to be broken (or I'm doing something wrong), but the docs are on http://moxie.readthedocs.org/en/latest/apps/contacts.html |
| 10:38 | jonathanj | ordnungswidrig: the structure of the data for HAL looks pretty similar to the last Swagger-backed service i had to write a client for |
| 10:38 | jonathanj | reading http://stateless.co/hal_specification.html |
| 10:39 | ordnungswidrig | oh, swagger doesn't prevent hypermedia, it only doesn't promote it :-) |
| 10:39 | jonathanj | well, neither does liberator |
| 10:39 | ordnungswidrig | sure. |
| 10:39 | ordnungswidrig | good point. but if you combine liberator with bidi then you can have it easily :) |
| 10:40 | jonathanj | yes, i was going to mention bidi earlier talking about yada |
| 10:40 | jonathanj | bidirectional resources are a pretty rare quality in routing software |
| 10:41 | ordnungswidrig | Given http://petstore.swagger.io/ where do I learn the URL of the root resource, the entry to the world of petstore? |
| 10:41 | jonathanj | i could easily use bidi and liberator together, right/ |
| 10:41 | jonathanj | since bidi just produces a ring handler? |
| 10:42 | ordnungswidrig | jonathanj: yes. and using the tagged-match feature you can use (path-for ::my-other-resource some-id) to generate a URL pointing the the resource with the tag ::my-other-resource! |
| 10:43 | ordnungswidrig | jonathanj: you'd match in bidi like this [["/user" :id] (tag users ::users)] and can like with (path-for ::users "some-id"). |
| 10:43 | jonathanj | ordnungswidrig: that petstore thing is an interesting example, how would you make the starting point more obvious given a HAL-like structure? |
| 10:44 | ordnungswidrig | jonathanj: I need to know two things: how to read HAL and a starting URL, e.g. petstore.swagger.io. I'd then expect links (or link templates) to the available resources, pets, owners, etc. |
| 10:45 | jonathanj | okay, but how is a link useful? |
| 10:45 | jonathanj | you still have to understand the goal of the service |
| 10:46 | jonathanj | (i still don't understand what that petstore service does) |
| 10:46 | ordnungswidrig | jonathanj: now hard coding. the server implementation can change it's mind about the location of the owners resource, the media type and like that. Given that the client does not hard code the location of the "owners" resource. |
| 10:46 | jonathanj | does it sell pets or pet accesories? |
| 10:46 | ordnungswidrig | jonathanj: good point! This should be actually discoverable from the resources or the media-types used. |
| 10:47 | jonathanj | ordnungswidrig: do you have an example liberator app that takes this approach that i could study? |
| 10:47 | ordnungswidrig | jonathanj: the hal browser (see the oxford example) is maybe as close as you can get to "automatically" understand hal. You need to put a layer of domain specifiy semantic on top of it. |
| 10:47 | ordnungswidrig | jonathanj: which approach? HAL, bidi-links? |
| 10:48 | jonathanj | the media-types discoverability |
| 10:48 | ordnungswidrig | one key part of understanding a HAL resource is the use of relations. |
| 10:48 | jonathanj | which i guess is probably likely a HAL example? |
| 10:49 | ordnungswidrig | Try to explore http://api.m.ox.ac.uk/browser/#/, e.g you can see there is e.g. a rel "contacts" which has a documentation link describing what the relation means. |
| 10:51 | jonathanj | the documentation link opens in a tiny iframe in chrome |
| 10:51 | jonathanj | i guess i can open it in a new tab |
| 10:52 | ordnungswidrig | I just learned how to search for courses at oxford: follow the relation app:courses, and look for a relation of type "hl:search", the docs of that relation told me the "q" parameter is fro full text query. Using this information I could build the URL "/courses/search?q=hypermedia" and learned there are no courses on this topic in oxford. |
| 10:57 | jonathanj | too bad the the {rel} link template is broken |
| 10:58 | jonathanj | which kind of underscores a particular point about hyperlinks: there is no rule about putting a broken hyperlink into hypermedia |
| 10:58 | ordnungswidrig | jonathanj: the "docs" icon actually expands it. |
| 10:58 | ordnungswidrig | jonathanj: the fact the hyperlinks can break is a good thing. This allows decoupling of resources and made the web scale. There is no "link police". |
| 10:59 | ordnungswidrig | jonathanj: ok, maybe google is the link police, lowering your page rank. |
| 11:00 | jonathanj | an alternative point of view is that you're roaming the wild west of hypermedia |
| 11:02 | jonathanj | ordnungswidrig: hrm, well i'm looking at courses search resource and it has a "curies" link with an href to a template string |
| 11:02 | jonathanj | if i replace the {rel} in there with "curies" i end up at a 404 |
| 11:02 | ordnungswidrig | oh, I see |
| 11:02 | ordnungswidrig | https://en.wikipedia.org/wiki/CURIE |
| 11:03 | jonathanj | that hyperlink isn't in my resource :P |
| 11:03 | ordnungswidrig | It's a form of URL abbreviation syntax |
| 11:03 | ordnungswidrig | jonathanj: is part of HAL I guess :-) |
| 11:03 | jonathanj | well it's a relation, not so? |
| 11:03 | ordnungswidrig | jonathanj: and a typical case of "out of band documentation" |
| 11:03 | jonathanj | the href tells me i can go to {rel}.html |
| 11:03 | jonathanj | but actually that's not true |
| 11:03 | jonathanj | there's a certain list of relations that have documentation |
| 11:04 | jonathanj | which relations have documentation is totally undiscoverable |
| 11:04 | ordnungswidrig | the "curie" link registers the "app" curie and when you encounter a link relation named "app:xxx" then you replace the href by the "href" of the "app" curie replacing the {rel} with the "href" value of the original link |
| 11:06 | dnolen | ClojureScript 1.7.145 is out! big thanks to everyone who contributed |
| 11:06 | ordnungswidrig | i.g. in resource at /contact you see a link with relation "hl:search". It starts with "hl" which is a curie defined in the resource. It's href value is "http://moxie.readthedocs.org/en/latest/http_api/contact.html#{rel}", you need to replace the {rel} with the part of the rel name after "hl:" this giving http://moxie.readthedocs.org/en/latest/http_api/contact.html#search |
| 11:06 | jonathanj | ordnungswidrig: i actually have no idea what you just said |
| 11:07 | jonathanj | ordnungswidrig: okay, got it |
| 11:07 | ordnungswidrig | http://www.mikestowe.com/2015/01/what-the-heck-are-curies.php |
| 11:07 | ordnungswidrig | Oh, I see |
| 11:07 | ordnungswidrig | yes, curies can be confusing! |
| 11:07 | jonathanj | ordnungswidrig: so there's nothing to really help me to construct such resources, that i know of |
| 11:08 | jonathanj | it seems like it would be really complex to design and use a library to help with this |
| 11:09 | ordnungswidrig | jonathanj: there's hal-clj but it seams pretty basic. |
| 11:10 | ordnungswidrig | If I only had all the time to build these nice tools :) |
| 11:56 | triss | is it possible to do a `lein install` from within a REPL? |
| 12:10 | justin_smith | triss: only if your project deps include the leiningen libs |
| 12:10 | clgv | I am looking for the correct approach for reconnect attempts with aleph.tcp when the server application may be down for some time but recovers eventually |
| 12:12 | clgv | I tried to simply perform connection attempts after a given timeout but then it happens that more than one connection is established although I got a timeout exception for all attempts except the last attempt |
| 12:14 | triss | justin_smith: um... I want to work on a project that's a dependency for another one without having to restart 2 REPL's every time I make a change to the dependancy |
| 12:15 | justin_smith | triss: you can reload the source files without changing your dep version |
| 12:15 | justin_smith | even if the source file is in another project's directory |
| 12:15 | justin_smith | ,(doc load-file) |
| 12:16 | clojurebot | "([name]); Sequentially read and evaluate the set of forms contained in the file." |
| 12:16 | triss | ah brilliant thanks man |
| 12:18 | clgv | triss: with a good editor/ide you could just use a key combination to load the current file, which may be the one from the dependency, into the repl |
| 12:19 | triss | thanks clgv I'll give it a try.... vim'ing over here so I'm sure its possible |
| 12:22 | clgv | a lack of aleph.tcp users in here :( |
| 12:22 | justin_smith | ztellman used to hang out here, probably ditched IRC for slack |
| 12:26 | clgv | $seen ztellman |
| 12:26 | clgv | what happened to lazybot? |
| 12:27 | justin_smith | my karma was about to catch up with amalloy's so he stopped logging the bot in |
| 12:27 | justin_smith | just kidding |
| 12:27 | justin_smith | it's always been a bit unstable, and it may be changing hands |
| 12:28 | clgv | just noticed that it had been offline on my lately occasional visits |
| 12:30 | justin_smith | yeah, it's not just instability now, it's also less attentively restarted too |
| 13:06 | Raynes | Irclj doesn't know how to reconnect and nobody has ever cared enough to add it and I rarely pay attention to IRC. |
| 13:22 | justin_smith | Raynes: I want to care! I want to do the right thing! don't give up on humanity yet |
| 13:24 | m1dnight_ | my bot framework reconnects on timeouts! :o |
| 13:24 | m1dnight_ | it was a hassle to do, though. |
| 13:25 | pilne | lord, why didn't i discover clojure sooner? i might still have a luscious thick head of hair that isn't greying..... |
| 13:26 | justin_smith | haha |
| 13:27 | pilne | ... i'm reading a blog post from harvard about clojure, and someone in the first comment seemed to imply that lisps are harder to read and maintain than most languages >.< where's my mirc-fish! |
| 13:28 | pilne | err, the most recent comment |
| 13:28 | pilne | no lie, java and c++ attempted to murder something inside of me >.< |
| 13:30 | rhg135 | Doing java too often made me hate computers. |
| 13:31 | pilne | if i learned one thing from programming.... all end-users that have to put data in, need to have things fed to them in drop-down menus whenever possible >.< |
| 13:31 | ARM9 | preach it |
| 13:32 | schmudde | After being introduced to Common LISP as an undergrad in ~1999, I decided to stop programming rather than go back to a world of Ada & Java. I've returned to see a more "functional" world. |
| 13:32 | pilne | i wish my highschool and undergrad had *anything* that wasn't java or c++ |
| 13:33 | schmudde | pilne: I was really lucky. We had one professor that had one foot in AI research. |
| 13:33 | justin_smith | I was lucky, I didn't learn to use a computer until I was an adult and outside acedemia, so I wasn't forced to learn crap just for a curriculum |
| 13:34 | pilne | my programming rebirth happend as my midlife crisis |
| 13:34 | pilne | cheaper, but probably not as satisfying as a legal teen affair >.< |
| 13:34 | schmudde | pilne: Nice! Good outcome. |
| 13:35 | pilne | yeah, i found "drracket" almost by accident, and was like "all in one ide, not *java* or c++, why the fuck not i'm bored" |
| 13:35 | pilne | and now i'm looking to make java desktop and webapps for shits and giggles |
| 13:35 | pilne | well |
| 13:35 | pilne | clojure |
| 13:35 | pilne | but jvm |
| 13:45 | justin_smith | pilne: getting figwheel working for cljs, with a react based lib for rendering, was a revelation after doing webapps "the normal way" |
| 13:46 | pilne | heh, i'm actually really interested in reactive stuff for a game engine |
| 13:46 | pilne | my girlfriend has some incredible ideas, and is a blender whiz |
| 13:47 | justin_smith | cool - is react reactive? I mean the name makes it sound like it might be... |
| 13:47 | justin_smith | to be clear I was talking about react.js, a lib from facebook that makes it easy to do single page js apps |
| 13:47 | pilne | it is broadly a "style" that is designed to react to inputs, it's a relatively new persuit amongst functional style languages |
| 13:48 | pilne | it's probably more of a "big dieal" with a language like haskell which is so very immutable |
| 13:48 | justin_smith | pilne: but in terms of game design with a functional language, I am a big fan of the Component Entity System data paradigm (as an alternative to OO encapsulation) |
| 13:48 | pilne | (which is where i heard of it first, a haskell version of DOOM2 (or quake??)) |
| 13:48 | justin_smith | pilne: right, I wasn't talking about reactive programming (which I am familiar with), I was talking about facebooks react lib |
| 13:49 | pilne | oh |
| 13:49 | pilne | fuck facebook |
| 13:49 | pilne | :p |
| 13:49 | pilne | i sign on when the gf needs me to like a post from her work |
| 13:49 | pilne | lol |
| 13:49 | justin_smith | you don't need to use facebook to use react, and it's good tech for web page rendering |
| 13:49 | pilne | cool |
| 13:50 | pilne | i will keep it in mind if we choose to deploy to the web on a game, i think that the hardware today can run the jvm fast enough to do some pretty decent 3d stuff. |
| 13:51 | oddcully | il2 was done in java |
| 13:52 | pilne | yeah, so i'm gonna be fine, we're not trying to one-up the cryengine >.< lol |
| 13:53 | pilne | i love the borderlands style, and when it came out, the id5 engine blew my mind |
| 14:02 | audaxion | anyone use the duct lein template? |
| 14:15 | Seylerius | Hmm... I wonder if using jdk7 instead of jdk8 could fix the problem. |
| 14:41 | boxed | I have a macro which spits out macros, and I have another macro where I need to figure out if a symbol is one of those generated macros… my first idea was to put meta data on the macro but it seems I can’t do that… how would I do this otherwise? |
| 14:49 | engblom | boxed: To me it sounds like you do something uneccessary complicated. You should probably take a short break and then appoach the problem from another angle. |
| 14:50 | boxed | mm.. I actually figured out I can work around the problem… still.. would be nice if one could do this |
| 14:51 | tdammers | quick question: I call a macro from clojurescript, and that macro calls a function that throws an exception. What will happen? |
| 14:51 | boxed | actually… hmm.. how do I even put meta data on a function? |
| 14:52 | boxed | tdammers: you mean the macro calls the function, or the macro expands to a call of the function that throws? |
| 14:52 | tdammers | the macro calls the function |
| 14:52 | tdammers | (defmacro foo [x] (throw (Exception. "OINK"))) |
| 14:52 | tdammers | like this |
| 14:53 | boxed | tdammers: that’s weird.. but yea ok, so that will throw at compile time |
| 14:54 | tdammers | 'cause it seems that in my case it doesn't throw at all, or at least nothing throws when I do that |
| 14:54 | tdammers | but probably means something between the macro definition and the throw somehow doesn't go through |
| 14:55 | Seylerius | boxed, tdammers: It almost sounds like you're trying to make a reader macro. Clojure doesn't really allow those. |
| 14:55 | rhg135 | justin_smith: as to your queston about react, by itself it isn't reactive, but it can be used so |
| 14:55 | Seylerius | Run what you're trying to do by me again? |
| 14:56 | boxed | Seylerius: now I’m confused… do you want ME to explain what I’m trying to do? |
| 14:56 | Seylerius | justin_smith: So, I've verified that switching from JDK8 to JDK7 doesn't fix the problem with the barbecue library. |
| 14:56 | Seylerius | boxed: Yep. |
| 14:56 | tdammers | Seylerius: no, I don't need a reader macro |
| 14:57 | tdammers | Seylerius: what I'm doing is I have a macro that takes an extra parameter that is a function; the macro parses stuff from a file, and then calls that function on the parse tree before returning it to clojurescript |
| 14:57 | boxed | Seylerius: so I’ve got this lib: https://github.com/boxed/defk and I want to make a (partial) to match it.. and in order to do that I need to figure out if a symbol is a) a macro generated by defk, or b) something else |
| 14:58 | tdammers | and that macro does, in fact, work flawlessly |
| 14:58 | tdammers | at least in a lab situation |
| 14:58 | tdammers | but in my real application, it doesn't do any transforming |
| 14:58 | boxed | hmm.. actually, maybe I can just check if the symbol is a macro and that’ll be good enough now that I think of it… partial doesn’t work on normal macros anyway |
| 14:59 | tdammers | so I made that function throw to see if it runs at all, which it doesn't seem to do |
| 15:01 | boxed | heh, ok, so how do I check if a symbol is a macro? |
| 15:03 | hiredman_ | I am at a loss as to how a 1.8 beta can be cut given how broken the new direct linking code in the compiler is |
| 15:03 | justin_smith | ,(-> #'or :meta :macro?) |
| 15:03 | clojurebot | nil |
| 15:03 | justin_smith | ,(-> #'or :meta keys) |
| 15:03 | clojurebot | nil |
| 15:03 | justin_smith | ,(-> #'or meta keys) |
| 15:03 | clojurebot | (:arglists :doc :added :line :column ...) |
| 15:03 | justin_smith | ,(-> #'or meta :macro) |
| 15:03 | clojurebot | true |
| 15:03 | justin_smith | ,(-> #'+ meta :macro) |
| 15:03 | clojurebot | nil |
| 15:03 | Bronsa | hiredman_: I would have expected dl to be at least disabled in the new build |
| 15:04 | justin_smith | boxed: see above, you can use the metadata and check for the :macro keyword - this is what the compiler looks for to decide if something is a macro, so it's accurate |
| 15:04 | Bronsa | there's really no point in cutting a beta release if people can't try it out in real code because of a known bug |
| 15:04 | boxed | justin_smith: great! thanks |
| 15:05 | justin_smith | boxed: in fact you can make some really weird behaviors happen if you arbitrarily add / remove the :macro key from var metadata :) |
| 15:07 | Bronsa | hiredman_: puredanger wrote a comment about that in the clojure-dev slack: " re the beta1 release, CLJ-1809 (and CLJ-1805) are known important things but Rich hasn't had time to look at them so we decided to release this beta without them. that stuff will probably be resolved in the next beta. " |
| 15:08 | boxed | justin_smith: hmm, another followup.. if I only have the name of that macro I should do: (:macro (meta (ns-resolve *ns* (symbol "foo")))) right? |
| 15:09 | justin_smith | boxed: or just (resolve (symbol "foo")) |
| 15:09 | boxed | justin_smith: ah, cool |
| 15:09 | justin_smith | ,(resolve (symbol "+")) |
| 15:09 | clojurebot | #'clojure.core/+ |
| 15:10 | justin_smith | boxed: resolve is effectively (partial ns-resolve *ns* ...) if you ignore the env stuff |
| 15:10 | justin_smith | or wait, never mind, it's effectively that partial regardless :) |
| 15:12 | boxed | heh, check |
| 15:12 | Seylerius | justin_smith: Trying OpenJDK8, then OpenJDK7. Let's see if anything actually fixes this... |
| 15:12 | justin_smith | Seylerius: fixes which again? |
| 15:14 | justin_smith | Seylerius: ahh, the barbecue issue |
| 15:39 | Seylerius | justin_smith: Weird. It claims to have produced a coredump, but I can't find it. |
| 15:39 | justin_smith | that's odd |
| 15:40 | Seylerius | Yeah, it really is. |
| 15:56 | celwell | Hello, would you format this differently, or is this standard clojure style? https://gist.github.com/celwell/d3658d1a1383c4e488a5 |
| 15:58 | Seylerius | celwell: There's a tool called cljfmt, or something like that. |
| 15:58 | Seylerius | Lemme look it up. |
| 15:58 | Seylerius | celwell: https://github.com/weavejester/cljfmt |
| 15:59 | celwell | Seylerius: interesting, thanks |
| 15:59 | Seylerius | Now, I'll take a look at your code. |
| 16:00 | nanuko | what does it mean to have the following: #”some string” |
| 16:00 | celwell | regex |
| 16:00 | Seylerius | celwell: Nice. Well-formatted, imo. |
| 16:00 | Seylerius | Regular Expression/regex/regexp |
| 16:01 | nanuko | oh, sweet! thanks |
| 16:01 | TEttinger | nanuko: except in that exact case, where you have smart quotes |
| 16:01 | TEttinger | ,(re-find #"the" "hey, there's a regex here!") |
| 16:01 | clojurebot | "the" |
| 16:01 | TEttinger | ,(re-find #"the" "hey, no regex here!") |
| 16:01 | clojurebot | nil |
| 16:02 | Seylerius | Yeah, smart quotes are dangerous. |
| 16:02 | TEttinger | ,(re-find #”some string” "will not find some string because of smart quotes") |
| 16:02 | clojurebot | #<ArrayIndexOutOfBoundsException java.lang.ArrayIndexOutOfBoundsException: 8221> |
| 16:02 | Seylerius | Ph34r the smart quotes. |
| 16:03 | TEttinger | ,(re-find #"some string" "will find some string because no smart quotes") |
| 16:03 | clojurebot | "some string" |
| 16:04 | {blake} | Why, when I use Swing, do I not need to note that in my project.clj? Is that because Swing is part of the JDK? |
| 16:05 | Seylerius | {blake}: Yep. |
| 16:06 | Seylerius | Also, if you're doing Swing shit, you might want to consider playing with Seesaw. |
| 16:07 | {blake} | Seylerius: Oh, I will. It makes a nice contrast after straight Swing. |
| 16:08 | Seylerius | It's quite handy, imo. |
| 16:08 | Seylerius | I'm thinking of doing a PR to add printer support to it. |
| 16:09 | {blake} | I'm teaching my students how to use Java in their Clojure code, so Swing was a great way to get fast results. When I clean up the project with Seesaw, I think they're going to like it even more. |
| 16:09 | Seylerius | Nice. |
| 16:09 | Seylerius | They'll get a kick out of that, I bet. |
| 16:09 | aghiuru | {blake}: students? where are you teaching clojure? |
| 16:10 | Seylerius | Ahh, why the fsck does Apache Barbecue crash every time I save a barcode to a file, and why did it fail to leave a coredump? |
| 16:13 | {blake} | aghiuru: At my place of employment. |
| 16:14 | pilne | the more time i spend in lisp/scheme land, the more i wonder why in the hell c and c++ ever caught on (and java by extension, although i'm guilty of seeking out clojure to get at java's tasty libraries) |
| 16:19 | Seylerius | justin_smith: I officially have lost all respect for Oracle in this moment. |
| 16:19 | Seylerius | I'd tried OracleJDK7&8. Both crashed. I just swapped in OpenJDK7. |
| 16:20 | Seylerius | My JVM is /still/ running. |
| 16:20 | Seylerius | It's been at least 10 minutes. |
| 16:22 | Seylerius | justin_smith: Yep. The problem is Oracle. |
| 16:22 | Seylerius | The problem is always Oracle. |
| 16:26 | justin_smith | celwell: unless I had a strong reason to do otherwise, I would turn that merge call into an assoc |
| 16:27 | justin_smith | Seylerius: that may be a good rule of thumb |
| 16:28 | Seylerius | I'd switched to fscking Oracle's crap to make Minecraft, of all things, work properly. |
| 16:28 | justin_smith | haha |
| 16:31 | {blake} | lein pulls from maven and clojars...anywhere else? |
| 16:33 | justin_smith | {blake}: defaults are maven central, clojure.org/releases and clojars |
| 16:34 | {blake} | justin_smith: Groovy. |
| 16:35 | snowell | Groovy also pulls from maven central by default |
| 16:35 | snowell | hahahaha I'm so funny |
| 16:35 | {blake} | snowell: All part of my scheme. |
| 16:36 | pilne | i see what you did there |
| 16:36 | pilne | are you a standards compliant scheme? |
| 16:39 | {blake} | O |
| 16:39 | {blake} | No, I've got all kinds of crazy macros. |
| 16:39 | pilne | post-compile assembly injection to rape the processor huh? |
| 16:40 | {blake} | Whatever it takes. I'm "practical". |
| 17:25 | sobel | pilne: OO seems like a shortcut to programming in a grown-up way but OO loses faster than anyone can even admit |
| 17:25 | sobel | faster and harder |
| 17:26 | pilne | i'm not a fan of the OO paradigm, but on occasion it is the most elegant solution |
| 17:26 | sobel | it's a useful construct where it makes sense. it's just not very applicable, in general. |
| 17:27 | sobel | for example, it's one venue for polymorphism, and i'm pretty sure that's useful sometimes. maybe. |
| 17:33 | pilne | methinks there would be a lot less ugly code out there if OO was an option and not the foundation (for java/c++ especially) |
| 17:34 | emauton | While I enjoy my counterfactuals as much as the next programmer, I think that's excessively optimistic. ;o) |
| 17:35 | pilne | hey, i have to be a massive pessimist at work, let me be optimistic in my funzies :p |
| 17:52 | pilne | am i correct in thinking that reduce is very similar to fold (from the left) in haskell? |
| 18:02 | postpunkjustin | pilne: yup |
| 18:02 | pilne | is there a fold-r that i'll be introduced to? |
| 18:02 | sobel | i work with tacit pessimists. i profit by understanding this but not trying to rock their boat. |
| 18:03 | sobel | in other news, i just stumbled on https://github.com/cemerick/clojure-type-selection-flowchart at the right time |
| 18:03 | postpunkjustin | pilne: not really. I think there might be something like that in the reducers library, but hardly anyone uses it |
| 18:04 | pilne | i work for a smaller ups dispatch/delivery hub, 2/5 of my bosses make peter griffin from family guy look like einstein >.< (i'm on the corporate, not union side... sadly) |
| 18:04 | sobel | is fold-r like sql's right join; there for completeness? |
| 18:05 | pilne | in haskell, foldr is significantly lower memory use than foldl due to how the "thunks" are accumulated |
| 18:05 | pilne | not sure if clojure's lisp suffers that fate |
| 18:08 | {blake} | I want to claim a resource through a function, but I'd like to not burden the client with locking and freeing it, and I'm not sure how that's possible. |
| 18:11 | postpunkjustin | pilne: I'm reading up on foldr now, I'd never really thought about it |
| 18:11 | {blake} | Component, maybe? |
| 18:11 | pilne | if clojure doesn't make huge thunks due to lazy evaluation when using reduce, then it is probably a non-issue |
| 18:12 | postpunkjustin | I don't think reduce is lazy in Clojure |
| 18:12 | {blake} | with-open? |
| 18:17 | xemdetia | {blake}, what sort of lifetime is the client owning this resource? |
| 18:18 | {blake} | Short functions. |
| 18:19 | {blake} | I've basically got these Java objects I'm messing with, but since it's a web app, I need to be able to lock them, create new ones, cache as needed, etc. |
| 18:19 | {blake} | But I'd like to avoid putting that in the client. |
| 18:25 | {blake} | xemdetia: So, yeah: Short. |
| 18:31 | pilne | this little blurb in this tutorial about when-let and if-let have left me with more questions than answers >.< |
| 18:32 | xemdetia | {blake}, would locking work? |
| 18:32 | xemdetia | like literal clojure.core locking |
| 18:33 | justin_smith | pilne: the only difference between if* and when* (including -let or -not variants) is that when accepts N forms that all trigger or none trigger, and if accepts 1 or more, and either one of them triggers, or none |
| 18:33 | justin_smith | (none being an option in the 1 form case) |
| 18:33 | justin_smith | ,(if false :wat) |
| 18:33 | pilne | i haven't really gotten to the * forms yet >.< |
| 18:34 | clojurebot | nil |
| 18:34 | justin_smith | pilne: I was using * as a shorthand |
| 18:34 | pilne | ahhh |
| 18:34 | pilne | k |
| 18:34 | justin_smith | ,(if-let [foo false] :wat) |
| 18:34 | clojurebot | nil |
| 18:34 | justin_smith | ,(when-let [foo false] :a :b :c :wat) |
| 18:34 | clojurebot | nil |
| 18:34 | pilne | i guess it is more like the tacking the -let on is what has me head scratching |
| 18:35 | {blake} | xemdetia: Maybe. If I say "(locking o..." and multiple threads are calling that? |
| 18:35 | justin_smith | ,(when-let [foo :OK] :a :b :OK) |
| 18:35 | clojurebot | :OK |
| 18:35 | justin_smith | here we can pretend :a and :b were important side-effecting function calls |
| 18:35 | {blake} | xemdetia: That could work until I figure out a caching system, I guess. |
| 18:35 | xemdetia | {blake}, maybe. It's a monitor lock. I don't know what sort of java objects you are trying to lock or how the library considers them locked |
| 18:36 | pilne | so, when it is truthy, it will call foo on a and b? |
| 18:36 | {blake} | xemdetia: POJOs, in the parlance of our time. |
| 18:36 | justin_smith | pilne: no, it will do a, then b, then wat |
| 18:36 | justin_smith | and since I did not use foo, it gets ignored altogether :P |
| 18:36 | pilne | ahh |
| 18:36 | {blake} | xemdetia: Though that still forces the client to lock. :-/ |
| 18:36 | pilne | i think my time with other languages often has me over-thinking lisp/functional stuff |
| 18:37 | justin_smith | pilne: so it's just a sequence of arbitrary impure actions, which each have the opportunity but not the requirement to use your binding |
| 18:37 | pilne | it took me hours to realise that "switch:" in haskell... literally just switched the order of the arguments being fed to a function..... |
| 18:37 | xemdetia | {blake}, yeah I can't think of anything else offhand if you aren't going to use a helper that could do the locking for the consumer |
| 18:37 | justin_smith | pilne: and of course when implies side effects, otherwise if would suffice with its single form |
| 18:37 | {blake} | xemdetia: Helper, how? Like a macro? |
| 18:37 | xemdetia | or some macro shenanigans |
| 18:37 | xemdetia | well an api |
| 18:38 | xemdetia | well that wouldn't work either |
| 18:38 | xemdetia | scope is wrong which is your initial problem |
| 18:38 | {blake} | right |
| 18:39 | {blake} | I have to enclose all uses of the object somehow. |
| 18:39 | justin_smith | {blake}: one paradigm to consider is instead of giving the object to a process, give a request to a process that owns the object. The locking is not needed because it is only used in one context, and you send requests via a queue. This is basically what core.async does too. |
| 18:39 | xemdetia | that's true, if you have the clients just push things to some sort of processor it would then be much easier to serialize |
| 18:41 | justin_smith | for N isolatable objects, just have N threads serving a single concurrent queue, and let the first one to grab a request serve it, and just make sure they don't grab new requests until they are done with the last one and cleaned up after it |
| 18:41 | {blake} | justin_smith: OK, I can see how that could work. That might be the "best" solution. |
| 18:41 | justin_smith | {blake}: it has a tradeoff - less performance in some cases due to the overhead of using a queue instead of a call stack |
| 18:41 | justin_smith | but it definitely avoids a lot of complexity and pitfalls that come with locking |
| 18:42 | {blake} | justin_smith: It could be more performant in my case. I was trying to use a "Use it if you can, or make a new one if the other's in use." |
| 18:43 | {blake} | justin_smith: And making a new one consumes massive time & RAM. |
| 18:43 | justin_smith | oh yeah, and with the parallel managing threads and queue version allows easy re-use |
| 18:43 | xemdetia | yeah I was thinking of more hard interop case where some java process would be touching your pojo |
| 18:44 | {blake} | Nah. It's a web app. I've got Java objects on the back end which are disturbingly impure. =P |
| 18:45 | xemdetia | then yeah creating some sort of queue/message passing interface seems to be the way to go |
| 18:45 | justin_smith | yeah, so for each request from a client, forward a request onto the object managers queue, and let the first available one give you your result (and then work out a more complex logic if it's not something you can handle in a single back and forth...) |
| 18:48 | {blake} | It's pretty simple. |
| 18:48 | {blake} | Or perhaps a better word is it's very localized. Get in, get out. |
| 18:49 | justin_smith | yeah, that is very compatible with the process+queue option |
| 18:50 | {blake} | All right, I'll do it that way. I don't like the whole caching/locking thing. |
| 19:03 | pilne | alright, cool points for calling @ the wormhole operator LoL |
| 19:06 | justin_smith | pilne: wait, where did that come up? I have not heard of that name before |
| 19:06 | pilne | https://aphyr.com/posts/306-clojure-from-the-ground-up-state |
| 19:18 | justin_smith | heh, cool |
| 19:23 | neoncontrails | pilne: That's awesome. Haha I love it |
| 19:24 | pilne | i've been working through that as my intro to clojure, it is doing pretty ok, not sure if it would work for a complete and utter programming noob, but... that's hard to learn without someone to at least get a basic environment setup for ya (although lein is easier than my ex girlfriend >.<) |
| 20:08 | neoncontrails | pilne: I think your hunch is probably correct that it would be hard to learn Clojure as a first programming |
| 20:08 | neoncontrails | *programming language |
| 20:11 | neoncontrails | The article you linked to is a good example of Lispy things that seemed really difficult to me years ago (state as a function? Wuut?) and only started to make sense when I saw the difficulty of maintaining my object-oriented code |
| 20:12 | neoncontrails | That difficulty was bearable though, because I didn't have the added complexity of data types to worry about. I was learning Scheme |
| 20:12 | pilne | i like to point people to ruby or racket just due to the documentation being superb (especially "how to design programs" for racket). |
| 20:12 | pilne | working through "how to design programs" was literally the most enjoyable learning experience i've had in ages |
| 20:14 | neoncontrails | What was the design philosophy in a nutshell? |
| 20:15 | neoncontrails | Oh this book! |
| 20:15 | neoncontrails | I remember seeing this recently when I was trying to find other things Matthias Felleisen had written |
| 20:16 | neoncontrails | His book, The Little Schemer, is one of my favorites |
| 20:16 | pilne | that is a good book too |
| 20:17 | NaN | neoncontrails: I have that one but still dont immerse on it, do you recommend it to a new commer? |
| 20:18 | pilne | its just super nice that you can "tell" DrRacket to work in a compatibility mode with the book, and DrRacket is completely and wonderfully self-contained, but it is still a scheme and not a lisp in the end (not that being a scheme is inherently bad, just different) |
| 20:18 | neoncontrails | NaN: Hmm. I think it's a great book for a certain type of person who enjoys thinking about programming at a theoretical, abstract level. Do you? |
| 20:20 | NaN | neoncontrails: I don't know, but I think if you can think in that way, the (programming) language isn't a restriction |
| 20:20 | NaN | neoncontrails: so let's say the book it's about learn to "think the lisp way"? |
| 20:24 | neoncontrails | NaN: maybe I should clarify what I mean by "abstract." By abstract I mean, if you've ever wondered about how while loops work at the level of primitive logical operations, or how you'd make a database from a composition of names closures, it's the perfect book for you |
| 20:25 | domokato | hi guys. i'm trying to use amalloy's ordered library but I'm getting "Compiling flatland.useful.cli...Exception in thread "main" java.lang.IllegalAccessError: update does not exist, compiling:(cli.clj:1:1)" |
| 20:25 | neoncontrails | It's not a level of abstraction that will particularly help you write programs, but it may help you appreciate them as works of art |
| 20:25 | NaN | neoncontrails: seems interesting... will check it out |
| 20:26 | neoncontrails | The 'Lambda the Ultimate' chapter is probably one of the most thrilling experiences of my young programming career |
| 20:28 | domokato | I'm using update in my code (which was previously compiling), so it should be there |
| 20:37 | pilne | domo, i'd try and help, but i'm too damn new to clojure, so I'm not gonna try, my apologies |
| 20:49 | domokato | pilne: no worries man :) |
| 20:51 | justin_smith | domokato: the function update was introduced in clojure 1.7, what clojure version are you using? |
| 20:52 | domokato | 1.7.0-alpha4 |
| 20:53 | justin_smith | domokato: can you try updating to 1.7.0 ? |
| 20:53 | justin_smith | not every pre-release of 1.7 had update |
| 20:55 | domokato | justin_smith: it worked! kind of strange since i'm using update in my code already |
| 20:56 | domokato | justin_smith: thx |
| 21:06 | pilne | liking lisps has way too many distractions >.< |
| 21:06 | pilne | especially now that i have a common lisp repl on my phone >.< |
| 21:36 | pilne | it's funny... when i solve my rubik's cubes, i feel like it is a very imperative/procedural process, but trying to program that way feels so constrained and akward to me >.< |
| 21:37 | justin_smith | pilne: isn't solving a cube a series of operations taking a state of a cube and returning a new state of the cube? |
| 21:40 | pilne | very true, but it is inherently mutable |
| 21:40 | justin_smith | at the end it is still a cube :) |
| 21:40 | justin_smith | and every step has an opposite and can be undone |
| 21:41 | justin_smith | pilne: which is similar to many functional paradigms for modeling state over time |
| 21:41 | pilne | very true, and the algorithms all (can be, maybe not most optimally) be boiled down to simple conjugations |
| 21:41 | pilne | sorry, algorithms is cube-speak for taking one specific pattern to the next |
| 21:42 | pilne | moves are the more generalized forms in the jargon |
| 21:42 | pilne | "algorithms" are like optimized assembly-written loops, sometimes they really don't "relate" easily to what you are doing, but they are really fast at doing it |
| 21:43 | justin_smith | right, and this is all 100% compatible with fp - and a procedural language easily lets you break those constraints |
| 21:43 | pilne | hrm... "cubing and coding - the bloggings of a madman" |
| 21:44 | pilne | hrm... is there a way to break out of the jvm and run straight assembly code when needed? if so, the level of abstraction that clojure provides would be astounding |
| 21:44 | pilne | s/level/levels |
| 21:44 | justin_smith | pilne: there's clojure wrappers to jni stuff out there somewhere... |
| 21:45 | justin_smith | though clojure's idioms are difficult to use without gc present |
| 21:45 | pilne | this is true of most the lisps, but a small segment of code with a bit of manual gc is an option, and either that, or the wonderful craft octoberfest i'm drinking, are giving me a warm fuzzy feeling (: |
| 21:45 | justin_smith | but if using clojure to generate very procedural mutating code suffices - sure, there's ways to do that |
| 21:46 | justin_smith | haha |
| 21:47 | pilne | yeah, i'm quite enamored with clojure, and the general "attitude/vibe" of the community i've found so far |
| 21:48 | pilne | people who code in a language that doesn't frustrate you probably just don't have much reason to not be jovial (: |
| 21:50 | justin_smith | pilne: unlike other languages, we are with clojure because it's the language we prefer, not because it is a default we are stuck with, and that does make a difference I think |
| 21:50 | justin_smith | the flip side is this community would disappear fast if it got unpleasant, because very few people out there are forced to use clojure without other options available |
| 21:51 | pilne | eh, i hopped around for a while, haskell, ocaml, scala, python, and ruby when i decided to start coding again (i didn't want to touch c++ or java itself if i didn't have to), haskell has a great community, but the language just... "cabal hell" lol |
| 21:51 | pilne | racket has a wonderful community too |
| 21:52 | justin_smith | maybe there is a correlation between unityped languages and affable attitudes |
| 21:52 | pilne | i even tried perl (but just the tip) |
| 21:53 | pilne | perl is nutty, i respect the shit out of it, but it is just nutty |
| 21:53 | pilne | i kinda lump perl and emacs into a same "thought" category |
| 21:57 | pilne | although i have an immense fondness for vi, and vi mode in atom (: lol |
| 22:00 | pilne | like i said the other day, after looking at ceylon, and trying scala, the fact that clojure doesn't shove eclipse or netbeans down my throat made me smile. |
| 22:19 | bja | I'm probably guilty of wanting too much of my lunch to be free, but I've experienced way more classpath hell involving maven/leiningen (particularly when doing things with AOT compilation) than I have with haskell/cabal |
| 22:20 | adu | bja: free lunch is so much fun |
| 22:21 | bja | heh. I have a project that just barely works, but manages to remix about 40 java libraries in my :dependencies. I only had to write a little glue code (and fork/path several of the libraries to agree on versions of things) |
| 22:22 | bja | I have an outstanding item on my todo list of trying to use tools.reader/tools.analyzer/tools.emitter to implement something similar to the maven shade plugin but for clojure libraries |
| 22:24 | adu | Maven is a tragedy. Java should have had a package manager from the start. But if we knew that a "compiler" required 150 things, like websides, compiler docs, language docs, library docs, FreeNode channel, mailing list, syntax highlighing for GitHub, syntax highlighting for Emacs, syntax highlighing for Vim, syntax formatter for Eclipse, token parser for ctags, comment parser for doxygen, then we probably would have written fewer languages w |
| 22:24 | adu | more design from the start. |
| 22:27 | bja | my only other experiences with package managers are pip/easy_install/setuputils/distutils from python, gems from ruby, and cabal from haskell. comparatively, leiningen/maven is awesome |
| 22:27 | adu | cabal is pretty cool |
| 22:28 | bja | the classpath hell only really seems to affect me if I'm using a lot of libraries |
| 22:28 | bja | most projects I'm between 5 and 20 and it's fine |
| 22:30 | pilne | i love haskell, it is beautiful and elegant, but i can't see myself digging that deep to make programs in a timely manner, monads just make my brain go "lol wut m8" |
| 22:32 | TEttinger | bja: what you mentioned about shade for lein... |
| 22:32 | TEttinger | could it be done with an uberjar and no :main ? |
| 22:33 | bja | I don't think so? consider the case where I want to use, say, clj-time 0.11.0 but one of my libraries is from like 2012 and uses clj-time 0.4.0 |
| 22:34 | TEttinger | right, right |
| 22:34 | bja | fwiw (this was my reality last year with storm...) |
| 22:34 | TEttinger | it may be possible to do it now with some arcane setting or even just lein pom and adding shade |
| 22:34 | bja | err, I don't know why I parens there |
| 22:34 | bja | but maven shade won't rewrite the .clj files will it? |
| 22:35 | bja | will maven shade rewrite the class files if I AOT? |
| 22:35 | bja | i.e. I have some library foo-from-2012 that uses clj-time 0.4.0. If I AOT that library, can I then have maven shade rewrite its class files? |
| 22:35 | bja | or does maven shade require the .java files? |
| 22:35 | bja | I didn't research maven shade too much |
| 22:36 | TEttinger | I don't think anything rewrites clj files, and I don't know how shade works (it may only use .class files, which both clojure and java spit out) |
| 22:36 | TEttinger | I think shade groups any dependencies into the current library distributable jar |
| 22:36 | TEttinger | like uberjar does for executable jars |
| 22:37 | bja | I want an option to do something like this |
| 22:37 | TEttinger | so you would have clj-time 0.4.0 inside the shaded jar, and I think it may do classpath stuff to make that shaded jar prefer its own version |
| 22:37 | bja | {:dependencies [[foo-from-2012 :isolate [clj-time]]]} |
| 22:38 | TEttinger | right |
| 22:38 | adu | pilne: Monads are simple |
| 22:38 | adu | I don't know why ppl have so much trouble with them |
| 22:38 | TEttinger | this is a definite request people have had before |
| 22:38 | bja | https://maven.apache.org/plugins/maven-shade-plugin/examples/class-relocation.html |
| 22:39 | bja | it seems like the shade plugin works on bytecode |
| 22:39 | bja | will have to play with the pom and see if I can get it working like I want |
| 22:39 | bja | if I can, it should be trivial to add a leiningen plugin to generate the right xml |
| 22:42 | TEttinger | adu: do I have it right that a monad is a sort of wrapper around another type, and you can use it to get values of the associated type (which depend on the wrapper and could be, for example, random) while ensuring that the wrapper is itself not treated as an element of the wrapped type for type checking purposes? |
| 22:42 | TEttinger | adu: which is similar to the factory pattern in java or other OOP languages? |
| 22:42 | TEttinger | bja: woohoo! |
| 22:43 | TEttinger | bja: there may be a maven plugin API that you can call from a lein plugin |
| 22:43 | bja | TEttinger: upon closer inspection, it looks like the maven shade plugin won't do what I want out of the box. the maven shade plugin could be used on clojure code I control to make sure that it doesn't export my dependencies to some common global name |
| 22:43 | adu | TEttinger: Yes and no |
| 22:44 | adu | TEttinger: there are 2 models that work really well for Monads: Containers (which is your description) and Computations (which is one of the best Monad tutorials out there) |
| 22:44 | bja | so if I had foo-from-2012 that wanted to use clj-time 0.4.0, I could do that and then maven shade plugin could make sure that when people depend on foo-from-2012, they don't get clj-time conflicts |
| 22:44 | adu | TEttinger: the great thing about Monads tho is that they abstract both models with a common interface |
| 22:44 | bja | but it falls short of letting me say something like "this thing that I depend on, isolate all of its dependencies (or the ones I specify) relative to it" |
| 22:45 | bja | although, given that it works on bytecode, it's probably possible to modify the maven shade plugin to do this |
| 22:45 | TEttinger | bja: I'd prefer to check if there's an API for calling shade |
| 22:46 | TEttinger | bja: it also may be a good idea to go in #leiningen and see if any experts are awake |
| 22:47 | pilne | adu, i'll have to look into it more, but, alas, i must call it a night, see ya'll around |