dbmikus__ has quit [Ping timeout: 276 seconds]
Arcaelyx has joined #racket
pera has quit [Ping timeout: 245 seconds]
davidl has quit [Ping timeout: 260 seconds]
ziyourenxiang has joined #racket
jao has quit [Remote host closed the connection]
iyzsong has joined #racket
Sgeo__ has joined #racket
Sgeo_ has quit [Ping timeout: 245 seconds]
jao has joined #racket
johnjay has joined #racket
<johnjay> out of all the schemes does racket have the largest library of stuff?
<johnjay> e.g. mit-scheme or tinyscheme?
iyzsong has quit [Ping timeout: 245 seconds]
ZombieChicken has quit [Remote host closed the connection]
ZombieChicken has joined #racket
johnjay has quit [Ping timeout: 256 seconds]
orivej has quit [Ping timeout: 244 seconds]
zv has joined #racket
g00s has joined #racket
johnjay_ has joined #racket
<johnjay_> does racket have a bigger set of libraries than mit-scheme?
<nisstyre> johnjay_: MIT/GNU Scheme doesn't have much in the way of useful tooling
<nisstyre> johnjay_: Racket has lots of libraries and code, but maybe not more than GNU Guile or other schemes
<nisstyre> just different stuff
<aeth> Guile and Chicken and Racket have lots of libraries.
pierpa has quit [Quit: Page closed]
<aeth> The rest? You'd probably have to rely on SRFIs and libraries that attempt to write portable Scheme mostly using those SRFIs
<johnjay_> nisstyre: why is it that SICP was intended to be used with mit-scheme then?
<nisstyre> johnjay_: because that's all that existed when it was written
<johnjay_> is there some connection between the two?
<nisstyre> johnjay_: the authors invented Scheme (along with Guy Steele)
<johnjay_> right
<johnjay_> Guy Steele and that other guy
<nisstyre> Gerald Sussman
<johnjay_> so which scheme is the "biggest" then
<johnjay_> guile, racket, or which?
<nisstyre> they have different niches
<johnjay_> and why was plt-scheme created instead of just adding to mit-scheme?
<nisstyre> because it makes more sense to start from the bottom up?
<nisstyre> I don't know
<nisstyre> you'd have to ask them
<aeth> Guile or Racket is the biggest Scheme. I'm not sure you'd be able to determine which.
<aeth> Language popularity is hard to measure.
<johnjay_> yeah
<johnjay_> i just wanted your intuitive sense of it
<johnjay_> unless you can just measure users or installs or something
<johnjay_> what would you say are the differences between guile and racket?
<johnjay_> aside from racket having the better logo (cf Grateful dead!)
<nisstyre> johnjay_: Guile is used a lot for embedded scripting, as it's the "official" scripting language of the GNU project
<nisstyre> for example weechat supports it, GIMP, etc
<nisstyre> probably emacs too
<johnjay_> didn't know weechat supported it
<nisstyre> yeah it does
<johnjay_> jus to be clear i'm not trying to determine which one is "better"
<nisstyre> and probably lots of other stuff I don't know right now
<johnjay_> just looking for information
<nisstyre> johnjay_: my point is that you can't easily measure "installs"
<nisstyre> since it's embedded in so many things
<aeth> Guile has had a bit of a Renaissance in recent years.
<johnjay_> would racket be "cleaner" since it is intended for educational stuff?
<johnjay_> ah ok
<nisstyre> not sure what cleaner is supposed to mean
<nisstyre> I find the library naming conventions make more sense in Racket though
<aeth> johnjay_: Racket is academic. It has the two goals that higher education in general has: teaching and research.
<aeth> At least, that's my impression of Racket.
<johnjay_> well gnu code doesn't have the reputation of being the most concise and uncluttered
<aeth> Probably because GNU has a lot of the oldest projects
<johnjay_> right
<johnjay_> anyway that's cool if that's all ya go
<johnjay_> t
<johnjay_> i've used racket a little but didn't know guile was active
<aeth> People didn't know how to write readable code back in the old days, or wrote code intentionally unreadable so it would run very slightly faster.
<aeth> Not saying that Guile or things written in Guile are like that, but lots of stuff from the 1980s are.
<aeth> (Guile's from 1993)
<johnjay_> ok
<johnjay_> is racket dev mainly on the github or on a mailing list?
<nisstyre> johnjay_: if you want to contribute then github is the place
<nisstyre> at least in my experience
<johnjay_> ok. some projects just use github as a mirror
<nisstyre> I think the mailing list is for more in-depth discussion
g00s has quit [Quit: Textual IRC Client: www.textualapp.com]
mzan has left #racket [#racket]
Arcaelyx has quit [Quit: Textual IRC Client: www.textualapp.com]
xuanrui has joined #racket
erwanou has quit [Ping timeout: 244 seconds]
dddddd has quit [Remote host closed the connection]
_whitelogger has joined #racket
pera has joined #racket
xuanrui has quit [Remote host closed the connection]
tcsc has quit [Ping timeout: 250 seconds]
err0ne has quit [Ping timeout: 246 seconds]
ZombieChicken has quit [Quit: Have a nice day]
tcsc has joined #racket
pera has quit [Quit: leaving]
jao has quit [Ping timeout: 272 seconds]
tcsc has quit [Ping timeout: 252 seconds]
tcsc has joined #racket
YuGiOhJCJ has joined #racket
kefin has quit [Ping timeout: 252 seconds]
g00s has joined #racket
tcsc has quit [Ping timeout: 252 seconds]
tcsc has joined #racket
xuanrui has joined #racket
aeth has quit [Read error: Connection reset by peer]
aeth has joined #racket
reverse_light has quit [Remote host closed the connection]
iyzsong has joined #racket
Lowl3v3l has quit [Quit: Leaving.]
orivej has joined #racket
g00s has quit [Quit: Textual IRC Client: www.textualapp.com]
libertyprime has joined #racket
kefin has joined #racket
kefin has quit [Read error: Connection reset by peer]
iyzsong has quit [Remote host closed the connection]
iyzsong has joined #racket
dan_f has quit [Quit: dan_f]
YuGiOhJCJ has quit [Quit: YuGiOhJCJ]
mzan has joined #racket
soegaard has joined #racket
libertyprime has quit [Remote host closed the connection]
evdubs_ has joined #racket
evdubs_ has quit [Remote host closed the connection]
dbmikus__ has joined #racket
dbmikus__ has quit [Ping timeout: 252 seconds]
iyzsong has quit [Ping timeout: 252 seconds]
dddddd has joined #racket
iyzsong has joined #racket
zv has quit [Ping timeout: 260 seconds]
zv has joined #racket
jao has joined #racket
hjek has joined #racket
<hjek> Hi, does anyone know if there is a good Racket package for anaphoric macros?
<hjek> Or other cool "convenience" macros?
<hjek> Great. Thanks!
<soegaard> Anaphoric macros is the road that leads to Perl...
<hjek> I've been using Racket a bit more recently, and it's flippin GREAT
<soegaard> ;-)
<hjek> just a bit verbose
<hjek> ha! is that meant as a good or a bad thing?
<soegaard> Well...
<hjek> @soegaard: btw, do you happen to know other macro libraries, or similar clever notation tricks?
<soegaard> First note that cond has an => clause
<soegaard> Second match (and associated forms) covers most needs.
<hjek> "second match", as in pattern matching?
<soegaard> yes
<hjek> Thanks. I've been using PG's Arc lisp for a while, and I've become addicted to the anaphoric macros, but Arc is soooo damn slow.
<hjek> I've made this basic http upload form in Racket, https://notabug.org/hjek/share , and it's so much faster.
<hjek> is => the same as else?
<hjek> ah ok I see!
<hjek> => is like anaphoric macros!: "The proc-expr is evaluated, and it must produce a procedure that accepts one argument, otherwise the exn:fail:contract exception is raised. The procedure is applied to the result of test-expr in tail position with respect to the cond expression."
<hjek> what a great idea. thanks for that soegaard
<soegaard> Apropos match:
<soegaard> (match 42
<soegaard> [(and (? even?) x) (~a x " is even")]
<soegaard> [x (~a x " is not even")])
<hjek> ~a ???
<hjek> is that "format"?
<soegaard> Yes, a convenient short form of format.
<soegaard> If you want to explore options:
<hjek> looks great. what is the '?' function?
<soegaard> (? even?) is a pattern, that matches an input v if (even? v) is true
<hjek> wow! _ for args, that is like the bracket notation for anonymous fns from Arc!
<soegaard> (for example afl)
<hjek> Yes, because sometimes it just *is* less verbose to use Common Lisp-style control structures. Looks good. You made that library?
<soegaard> Yeah - but I don't use it.
<soegaard> Great way to learn about macros though.
<hjek> Thanks for all that. Racket has really good libraries, but I just find that writing pure Scheme-style Racket code is a bit draining, and I have some web app stuff I just need to get done for a customer. That pattern matching stuff and cond's => look really interesting.
iyzsong has quit [Ping timeout: 260 seconds]
<soegaard> match is definitely worth investigating
<soegaard> note that you as an user can extend match with your patterns
<hjek> ?
<soegaard> your patterns -> your own patters
<soegaard> The pattern (list a b) is builtin and matches a list with two elements.
<soegaard> If you define your own data structure, say a table and representes in some way,
<soegaard> then you can define a pattern (table a b) that matches tables consisting of two elements.
<soegaard> what do you mean?
<hjek> they do match on a struct, like this: [(struct binding:file (field filename headers content))
<hjek> basically to check if there's a file being uploaded, i think
<hjek> the match from line 25 onwards
<soegaard> The pattern (struct binding:form (field value)) can also be written (binding:form field value)
<soegaard> I think the old match implementation used an explicit (struct ...) and the new implementation allows both types of patterns.
<hjek> nice
<hjek> looks somewhat similar to what Java is doing with overloading, except just more powerful/flexible/well though out. thanks for pointing me to those things. Also, those Alexander Knauth libraries look interesting (although I'll probably be staying mostly with built-in language features for what I'm working on now)
soegaard has quit [Quit: soegaard]
hjek has quit [Ping timeout: 252 seconds]
mzan has left #racket [#racket]
zv has quit [Ping timeout: 276 seconds]
zv has joined #racket
ziyourenxiang has quit [Ping timeout: 268 seconds]
johnjay_ has quit [Ping timeout: 256 seconds]
dan_f has joined #racket
dan_f has quit [Quit: dan_f]
soegaard has joined #racket
phf_f334 has joined #racket
<phf_f334> Hello!
<phf_f334> Why would this work but not that?
<phf_f334> where: this = `(require (file "/home/phf/tools/websites/blog/content/generated/compiler/src/config.rkt"))`
<phf_f334> that = `(require (file (some-system-path->string (build-path "/home/phf/tools/websites/blog/content/generated/compiler/src/config.rkt"))))`
<phf_f334> Thanks!
<soegaard> because the here in (require here) is not an expressions (and require is not a function)
<soegaard> here must be an require-spec
<soegaard> see http://docs.racket-lang.org/reference/require.html?q=require#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._require%29%29
<phf_f334> Ok, will check that. Thank you very much!
<phf_f334> ROFL: "source_to_org: broke its own contract" :-)
pera has joined #racket
soegaard has quit [Quit: soegaard]
odanoburu has joined #racket
Lowl3v3l has joined #racket
mejja has joined #racket
soegaard has joined #racket
YuGiOhJCJ has joined #racket
sleepnap has joined #racket
soegaard has quit [Quit: soegaard]
mejja has left #racket [#racket]
soegaard has joined #racket
soegaard has quit [Quit: soegaard]
soegaard has joined #racket
soegaard has quit [Client Quit]
dmiles has quit [Ping timeout: 252 seconds]
logicmoo has joined #racket
sagax has quit [Ping timeout: 252 seconds]
soegaard has joined #racket
dyl has joined #racket
<dyl> Perhaps a silly question, but what's the 'idiomatic' way to write a function or macro that takes a function f, and generates n successive applications of it?
<dyl> i.e. (iterate f 3) ⇒ (lambda (x) (f (f (f x))))
<dyl> (preferably as a macro)
<soegaard> I have a feeling there is a function somewhere ...
<soegaard> But for/fold can be used.
<dyl> As do I, but I'm not sure what it's called here.
<soegaard> (define (double x) (* 2 x))
<soegaard> (for/fold ([x 1]) ([i 3]) (double x))
<dyl> Well, one issue here is that for/fold is not a function I have access to :). I'm in a restricted subset the language.
<dyl> So, I really want a macro and not a HOF.
<dyl> The use case here, more or less, is that I'm generating program sketches for Rosette, and I want to be able to generate n-depth ASTs.
<soegaard> Then it might be simpler to implement it your self.
<dyl> So, in the above what I actually want is the suspended form '(lambda (x) (f (f (f x)))
<dyl> Yeah, I'm just not sure how to do that.
<dyl> The names in racket are all different than those I'm used to in the Ocaml/Haskell worlds.
<soegaard> The simple case: (iterate f 0) => (lambda (x) x)
<soegaard> How can (iterate f n) be written in terms of (iterate f (- n 1)) ?
<dyl> Yes, I get how to write it inductively in the general case, just not with macros.
<dyl> Or well, with racket's macros anyhow.
<soegaard> There is no advantage of using macros here.
<dyl> Sure, but I'd like to know how to do it.
<soegaard> How would you do it in Haskell?
<dyl> Haskell doesn't have macros.
<soegaard> How would you do it in Haskell with functions?
<dyl> That's not directly applicable here, as the standard formulation using `iterate` is non-strict and generates a stream.
<dyl> I know how I would implement a simple function here.
<dyl> Btu that's not my question.
<soegaard> How about:
<soegaard> (define (iterate f n)
<soegaard> (λ (x)
<soegaard> (let loop ([i n] [x x])
<soegaard> (if (= i 0)
<soegaard> x
<soegaard> (loop (- i 1) (f x))))))
<soegaard> Or perhaps:
<soegaard> (define (iterate f n)
<soegaard> (if (= n 0)
<soegaard> (λ (x) x)
<soegaard> (let ([g (iterate f (- n 1))])
<soegaard> (λ (x)
<soegaard> (g (f x))))))
<dyl> Those are both way more complex than necessary?
<dyl> (define (iterate f n)
<dyl> [else (f (iterate f (- n 1)))]))
<dyl> (cond [(= n 1) (f x)]
<rain2> whats your question?
<dyl> I was wondering how one would write a macro that expands to n successive nestings of a function.
<rain2> i would have to use syntax-case I think. syntax-rules wouldn't be able to deal with a number
<dyl> I'm completely unfamiliar with the racket macro system.
<dyl> :p
<rain2> let me paste you something related, so you can adapt it
<dyl> Great!
<soegaard> You did write "function or macro" in your original question... which explains why I wanted to show you a function solution.
<dyl> I just wanted to see an example of how such a recursive macro w/ numbers would work.
pharpend_ has joined #racket
<rain2> so here's a macro that expands (make-list 3 'e) into (list 'e 'e 'e)
<pharpend_> Hi everyone. I'm going through one of the beautiful-racket tutorials (specifically https://beautifulracket.com/bf/a-functional-expander.html), and running the tests on the bf code produce an error (I will bpaste one second)
<pharpend_> I'll also put my code on a public git repository one sec
<pharpend_> The tutorial is writing a compiler for brainfuck. I'm at the end of the portion about writing the expander
<pharpend_> The most important piece of information: I've diffed my local files against the listings in the book, and they're identical
<pharpend_> So that leads me to believe there's either a version-specific issue, or the code in the tutorial is wrong.
<rain2> btw the second version by soegaard is good
<pharpend_> I'm new to racket, I don't know how to make sense of the error. Here's the code https://github.com/pharpend/br/tree/master/bf
<pharpend_> Is there some other class of errors I'm unaware of?
<soegaard> Try replacing
<soegaard> (begin
<soegaard> with
<soegaard> (let ()
<soegaard> The error "define: not allowed in an expression context" says that you are using define in an expression context.
<soegaard> Wrapping in (let () ...) moves the define into a definitio context.
<soegaard> Remove the (void ...) in line 16.
<pharpend_> another error. For record, this is what I've done https://bpaste.net/show/afcb11c968dd
<soegaard> (void (fold-funcs first-apl (list OP-OR-LOOP-ARG ...))))) should probably be (fold-funcs first-apl (list OP-OR-LOOP-ARG ...))))
<soegaard> At least if the error you referred to is to be belived (it said a void was received).
soegaard has quit [Quit: soegaard]
<pharpend_> https://bpaste.net/show/075e6b5127c0 changes I've made
sleepnap has quit [Quit: Leaving.]
SenasOzys has joined #racket
SenasOzys has quit [Remote host closed the connection]