Re: [racket-users] Re: is this a bug?

2015-07-29 Thread Michael Titke
In the forgotten theory /fold/ should reduce its arguments like in the following examples: (define (apply-or well-formed-list) (foldl {lambda (a b) (or a b)} #f well-formed-list)) (define (apply-and well-formed-list) (foldl {lambda (a b) (and a b)} #t

[racket-users] upcoming v6.2.1

2015-07-29 Thread Matthew Flatt
We're preparing a v6.2.1 release, which will go out before August 10. The v6.2.1 build will be a small set of patches to v6.2, i.e., not derived from the current development branch. The patches are for the HtDP teaching languages. The main patch for v6.2.1 is to add an option to restore the old

Re: [racket-users] Macro that does substitution

2015-07-29 Thread Matthias Felleisen
On Jul 29, 2015, at 7:50 AM, Klaus Ostermann wrote: Thanks, Matthew and Matthias. The service on this mailing list is incredible! I know it is not cbn because it is local, but a better name didn't come to my mind and it is what I need to solve my problem. It's not about locality, the

Re: [racket-users] Full (fifth RacketCon) Program is up!

2015-07-29 Thread Matthias Felleisen
Everyone, please feel free to re-broadcast this message to mailing lists whose members may not necessarily be on this list but who might wish to know about RacketCon anyways. -- Matthias On Jul 29, 2015, at 10:46 AM, Vincent St-Amour wrote: The full program of (fifth RacketCon) is

Re: [racket-users] Feel confused with some concepts

2015-07-29 Thread Yanpeng Li
在 2015年7月29日星期三 UTC+8下午10:11:07,Vincent St-Amour写道: On Wed, 29 Jul 2015 05:51:33 -0500, Yanpeng Li wrote: I don't know if a new Racket user can ask some `fool questions' here. I am learning sicp using Dr. Racket, it is interesting(the book and the Racket language). I encounter some

Re: [racket-users] A couple of questions about Neil's html reader/writer

2015-07-29 Thread Thomas Lynch
.. the conversion for neil's xexpr .. at this point the two converters can be abstracted by passing in two lambdas, is-at-list predicate, and extract-at-list. Neil can you comment on what other differences I might expect to find? (define (neil-xexpr-tok-tree an-xexpr) (define (is-at-list

Re: [racket-users] A couple of questions about Neil's html reader/writer

2015-07-29 Thread Thomas Lynch
Alexander, you will notice I pulled a couple lambdas to the top, and added a test routine at the bottom take those out ... then the code you sent isn't shorter. I am also expecting to have to add more code to the intermediate points. I like seeing those named. I think it is easy to read. ...

Re: [racket-users] A couple of questions about Neil's html reader/writer

2015-07-29 Thread Neil Van Dyke
Thomas Lynch wrote on 07/29/2015 11:22 PM: The most obvious difference between racket's xexpr and yours is the '@' as the head of the attributes list. Any idea where else I will see divergences? You might not be able to implement a tool that works correctly with all conforming SXML, until

Re: [racket-users] A couple of questions about Neil's html reader/writer

2015-07-29 Thread Thomas Lynch
Great! thanks Neil! On Thu, Jul 30, 2015 at 11:02 AM, Neil Van Dyke n...@neilvandyke.org wrote: Thomas Lynch wrote on 07/29/2015 10:25 PM: Neil can you comment on what other differences I might expect to find? Are the below 2 messages to the list helpful? * Historical background on SXML

Re: [racket-users] A couple of questions about Neil's html reader/writer

2015-07-29 Thread Thomas Lynch
On Thu, Jul 30, 2015 at 11:09 AM, Thomas Lynch thomas.ly...@reasoningtechnology.com wrote: Great! thanks Neil! Ah spoke too soon! Those links just point back into this very same thread! The most obvious difference between racket's xexpr and yours is the '@' as the head of the attributes

Re: [racket-users] A couple of questions about Neil's html reader/writer

2015-07-29 Thread Thomas Lynch
I wrote primitive conversion routines to bring the xexpr or Neil's xexpr into ... oh gosh, my parser token format, which by coincidence is very close. Just playing with this now .. In my target format token children are always other tokens. All values given as attributes in value tokens. I use

[racket-users] Macro that does substitution

2015-07-29 Thread Klaus Ostermann
I'd like to have a macro let-cbn which does this: (let-cbn ((x1 e1) ...) body) is transformed to (let ((x1 (thunk e1)) ...) newbody) where newbody is the result of replacing every occurence of x1... by (x1)... . What is the best way to do that in Racket? -- You received this message because

Re: [racket-users] Macro that does substitution

2015-07-29 Thread Matthew Flatt
At Wed, 29 Jul 2015 06:28:48 -0700 (PDT), Klaus Ostermann wrote: I'd like to have a macro let-cbn which does this: (let-cbn ((x1 e1) ...) body) is transformed to (let ((x1 (thunk e1)) ...) newbody) where newbody is the result of replacing every occurence of x1... by (x1)... . What

Re: [racket-users] Macro that does substitution

2015-07-29 Thread Matthias Felleisen
(I was 2/3 there when I noticed Matthew's response.) Klaus, fwiw this is NOT cbn. A cbn let will run the thunks only when they show up in strict positions. Not every identifier shows up in strict positions. On Jul 29, 2015, at 7:37 AM, Matthew Flatt wrote: At Wed, 29 Jul 2015 06:28:48

[racket-users] is this a bug?

2015-07-29 Thread sagyo12341234
Dear racket maintainers, Maybe, I found a bug. (foldr (lambda (x y) (list x y)) '() '(a1 a2 a3 a4 a5)) '(a1 (a2 (a3 (a4 (a5 ()) (foldl (lambda (x y) (list x y)) '() '(a1 a2 a3 a4 a5)) '(a5 (a4 (a3 (a2 (a1 ()) Thanks, I hope racket language is more popular. Taro -- You received this

Re: [racket-users] A couple of questions about Neil's html reader/writer

2015-07-29 Thread Alexander D. Knauth
Would it be easier using match? (define (xexpr-tok-tree an-xexpr) (match as-xexpr ['() '()] [(not (cons _ _)) (tok-make ...)] [(list tag) (list tag)] [(list-rest tag (? is-at-list at-list) r2) ] )) On Jul 29, 2015, at 7:56 AM, Thomas Lynch

Re: [racket-users] Units and macros

2015-07-29 Thread Klaus Ostermann
Oh, right. I tried to declare the macros in the wrong part of the signature, and then I got an error message that this wasn't allowed. Sorry for not RTFM. -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop

Re: [racket-users] Re: is this a bug?

2015-07-29 Thread Stephen Chang
For any f, acc, and lst, (foldl f acc lst), from left-to-right, applies to f to each element of lst and the current accumulated value. The initial accumulator is acc so the second intermediate accumulated value is (f (first lst) acc). Replacing f, acc, and lst with your arguments, the second

[racket-users] Re: is this a bug?

2015-07-29 Thread sagyo12341234
You are right. ; proc, init and lst are from the racket reference. (define (my-foldl proc init lst) (define (rec res rest1) (if (null? rest1) res (rec (proc res (first rest1)) (rest rest1 (rec init lst)) (my-foldl (lambda (x y) (list x y)) '() '(a1 a2 a3 a4 a5))

Re: [racket-users] is this a bug?

2015-07-29 Thread Stephen Chang
What's the output you expected? Does this post help you? http://stackoverflow.com/questions/8778492/why-is-foldl-defined-in-a-strange-way-in-racket On Wed, Jul 29, 2015 at 9:45 AM, sagyo12341...@gmail.com wrote: Dear racket maintainers, Maybe, I found a bug. (foldr (lambda (x y) (list x

[racket-users] Re: is this a bug?

2015-07-29 Thread sagyo12341234
Sorry Stephen, I expected, (foldl (lambda (x y) (list x y)) () '(list a1 a2 a3 a4 a5)) (list (list (list (list (list a1 a2) a3) a4) a5). it may be a problem in non-commutative operations. Taro -- You received this message because you are subscribed to the Google Groups Racket Users group.

Re: [racket-users] Feel confused with some concepts

2015-07-29 Thread Vincent St-Amour
On Wed, 29 Jul 2015 05:51:33 -0500, Yanpeng Li wrote: I don't know if a new Racket user can ask some `fool questions' here. I am learning sicp using Dr. Racket, it is interesting(the book and the Racket language). I encounter some concepts, such as module, library, collection, package which

Re: [racket-users] Units and macros

2015-07-29 Thread Matthew Flatt
At Wed, 29 Jul 2015 07:00:54 -0700 (PDT), Klaus Ostermann wrote: Units are not allowed to export macros, presumably because the unit wiring takes place after the macro expansion. I have a unit and would like to define a few macros based on the interface of that unit. Right now I

Re: [racket-users] Macro that does substitution

2015-07-29 Thread Jens Axel Søgaard
Something like this: #lang racket (require (for-syntax syntax/parse racket/syntax)) (define-syntax (let-cbn stx) (syntax-parse stx [(_let-cbn ([x:id e:expr] ...) body) ;; For each identifier x we need a new identifier bound to (λ () e) (define/with-syntax (x* ...)

[racket-users] Units and macros

2015-07-29 Thread Klaus Ostermann
Units are not allowed to export macros, presumably because the unit wiring takes place after the macro expansion. I have a unit and would like to define a few macros based on the interface of that unit. Right now I copypaste my macros into every file where I wire the unit, such as in ...

[racket-users] Re: is this a bug?

2015-07-29 Thread sagyo12341234
http://stackoverflow.com/questions/8778492/why-is-foldl-defined-in-a-strange-way-in-racket Oh, I see. Racket's holdl is non-regular type for calculation efficiency. Thank you, Stephen. -- You received this message because you are subscribed to the Google Groups Racket Users group. To

Re: [racket-users] Units and macros

2015-07-29 Thread Jay McCarthy
You can put the macros in the signature. http://docs.racket-lang.org/reference/creatingunits.html?q=signature#%28form._%28%28lib._racket%2Funit..rkt%29._define-signature%29%29 On Wed, Jul 29, 2015 at 8:00 AM, Klaus Ostermann klaus...@gmail.com wrote: Units are not allowed to export macros,