Re: [racket] examples of hooking a #lang into DrRacket?

2014-07-20 Thread Matthew Flatt
At Mon, 21 Jul 2014 01:32:21 -0500, Robby Findler wrote: > On Mon, Jul 21, 2014 at 12:53 AM, Matthew Flatt wrote: > > Currently, `read-language` does return #f when `get-info` is not > > available. I'm not sure anymore whether that was intended, but since it > > has worked that way for a while, an

Re: [racket] examples of hooking a #lang into DrRacket?

2014-07-20 Thread Robby Findler
On Mon, Jul 21, 2014 at 12:53 AM, Matthew Flatt wrote: > Currently, `read-language` does return #f when `get-info` is not > available. I'm not sure anymore whether that was intended, but since it > has worked that way for a while, and since the intent of > `read-language` is to report the `get-inf

Re: [racket] examples of hooking a #lang into DrRacket?

2014-07-20 Thread Matthew Flatt
Currently, `read-language` does return #f when `get-info` is not available. I'm not sure anymore whether that was intended, but since it has worked that way for a while, and since the intent of `read-language` is to report the `get-info` function, then I think the way forward here is to fix the doc

Re: [racket] Pass by value/name/reference

2014-07-20 Thread קוראל אלימלך
Thank U very much, Our project is about "programming language principle". during the semester we have been programming a compiler for Jack language in racket, and now we need to make a presentation on Racket language that includes all information about the principle that we learned. 2014-07-21 5:

Re: [racket] Pass by value/name/reference

2014-07-20 Thread Matthias Felleisen
On Jul 20, 2014, at 9:25 PM, Jon Zeppieri wrote: > On Sun, Jul 20, 2014 at 6:27 PM, Matthias Felleisen > wrote: >> >> The phrase "call-by-value is a reduction strategy" has no meaning per se but >> is a left over from the time when people hadn't figured out the above (pre >> 1070). >> > > I

Re: [racket] Pass by value/name/reference

2014-07-20 Thread Jon Zeppieri
On Sun, Jul 20, 2014 at 6:27 PM, Matthias Felleisen wrote: > > The phrase "call-by-value is a reduction strategy" has no meaning per se but > is a left over from the time when people hadn't figured out the above (pre > 1070). > I apologize for spreading this nonsense. Is it the phrase "reductio

Re: [racket] examples of hooking a #lang into DrRacket?

2014-07-20 Thread Robby Findler
Yeah: I think that it is safe to say at this point that pollen doesn't need to change. Either read-language's docs (and various places in DrRacket and libraries) need to change or read-language needs to change and either way pollen will work afterwards. My guess is that your language is the only o

Re: [racket] sharing an expensive computation required in procedure and its contract?

2014-07-20 Thread Jon Zeppieri
On Sun, Jul 20, 2014 at 8:18 PM, Robby Findler wrote: > FWIW, I think raise-argument-error is a fine way to go here to avoid > that expense (I assuming you're thinking of not checking this aspect > of the contract using the racket/contract library but instead > computing 'expensive-result' once in

[racket] Is it possible to write uuids to postgres with the racket db?

2014-07-20 Thread joshua
Hey all, Anyone know how to get Racket's db to write to a uuid column in Postgres? I keep getting "unsupported type". The documentation suggests casting as a workaround, but the example is a select - I doubt that will work as well for an insert...? Thanks, joshua Rac

Re: [racket] examples of hooking a #lang into DrRacket?

2014-07-20 Thread Matthew Butterick
> It appears that read-language can return #f and what DrRacket does in > that case appears to be what you're seeing. Is that what you're > getting? Your theory seems correct. Yes, Pollen is the only #lang returning #f for read-language, e.g.: #lang racket/base (map (λ(lang) (read-language (op

Re: [racket] sharing an expensive computation required in procedure and its contract?

2014-07-20 Thread Robby Findler
FWIW, I think raise-argument-error is a fine way to go here to avoid that expense (I assuming you're thinking of not checking this aspect of the contract using the racket/contract library but instead computing 'expensive-result' once in the body and then checking it?). And one day perhaps the resea

Re: [racket] examples of hooking a #lang into DrRacket?

2014-07-20 Thread Robby Findler
It appears that read-language can return #f and what DrRacket does in that case appears to be what you're seeing. Is that what you're getting? The docs say that read-language never returns #f (presumably it is allowed to return #f when fail-thunk returns #f, but the relevant fail-thunk here doesn'

Re: [racket] Pass by value/name/reference

2014-07-20 Thread Matthias Felleisen
call-by is a notion of time, pass-by refers to entity that is used (location if you so will). You can create a 2-dimension table of these options and you'll be able to find some language for almost any cell in this table. The common meaning of call-by-value is call-by-value/pass-by-reference.

Re: [racket] examples of hooking a #lang into DrRacket?

2014-07-20 Thread Robby Findler
Oh, sorry I meant: (read-language (open-input-string "#lang pollen")) Robby On Sun, Jul 20, 2014 at 6:23 PM, Robby Findler wrote: > DrRacket doesn't do anything with packages during startup that's > related to this. It doesn't do anything with the language at startup > either, but it does cac

Re: [racket] examples of hooking a #lang into DrRacket?

2014-07-20 Thread Robby Findler
DrRacket doesn't do anything with packages during startup that's related to this. It doesn't do anything with the language at startup either, but it does cache information about the language to avoid querying the language while you are editing the file. Editing the "#lang" line invalidates this cac

Re: [racket] Is there anything like a "~seq-no-order" pattern for syntax/parse ?

2014-07-20 Thread Alexander D. Knauth
Thanks And actually I wrote an experimental syntax-parse branch that has support for pattern-expanders. It’s not completely working yet though. On Jul 20, 2014, at 6:22 PM, J. Ian Johnson wrote: > If you don't want to allow ellipses, this will work: > (~seq-no-order _pats ...) == (~seq (~or

[racket] Managing communication between two macro invocations at the top-level

2014-07-20 Thread Asumu Takikawa
Hi all, I'm stuck on a macro issue with the top-level and was wondering if anyone had any thoughts. Certain macros (I'm thinking of parts of Typed Racket) manage communication between different parts of a program (different macros or different instantiations of the same macro) by storing a syntax

Re: [racket] Is there anything like a "~seq-no-order" pattern for syntax/parse ?

2014-07-20 Thread J. Ian Johnson
If you don't want to allow ellipses, this will work: (~seq-no-order _pats ...) == (~seq (~or (~once _pats) ...)) Here _pats and ... are meta, not part of the syntax-parse syntax. If you do want ellipses, then you'll have to do some parsing yourself to determine which patterns shouldn't be wrappe

Re: [racket] define-match-expander and the second proc-expr for when it's not a match pattern

2014-07-20 Thread Alexander D. Knauth
Thanks I didn’t know about prop:match-expander. Now the rename transformer seems to work but it’s not working as a match-expander: (define-match-expander+rename-transformer my-list #:match-expander (lambda (stx) (syntax-parse stx [(my-list expr:expr ...) ; doesn't work #'(l

Re: [racket] Troubles building whalesong on OS X with Racket 6.0.1

2014-07-20 Thread Jens Axel Søgaard
Hi Michael, Did the error from git master say something like "x undefined" ? If so I have a fix. /Jens Axel 2014-07-20 22:18 GMT+02:00 Michael McCracken : > Hi, I'm trying to build whalesong and am hitting errors both when using the > planet version in DrRacket, and when using the makefile fr

[racket] Is there anything like a "~seq-no-order" pattern for syntax/parse ?

2014-07-20 Thread Alexander D. Knauth
Is there anything like a "~seq-no-order" pattern for syntax/parse ? Racket Users list: http://lists.racket-lang.org/users

Re: [racket] define-match-expander and the second proc-expr for when it's not a match pattern

2014-07-20 Thread J. Ian Johnson
You want to use the prop:match-expander and prop:procedure properties for a struct you bind for syntax. That way the match-expander has its piece and the procedure provides the syntax transformer. -Ian - Original Message - From: Alexander D. Knauth To: racket users list Sent: Sun, 20 Ju

Re: [racket] Troubles building whalesong on OS X with Racket 6.0.1

2014-07-20 Thread Michael McCracken
On Sun, Jul 20, 2014 at 1:18 PM, Michael McCracken < michael.mccrac...@gmail.com> wrote: > Hi, I'm trying to build whalesong and am hitting errors both when using > the planet version in DrRacket, and when using the makefile from the > current git master. > > Unfortunately I'm a real newcomer to R

[racket] Troubles building whalesong on OS X with Racket 6.0.1

2014-07-20 Thread Michael McCracken
Hi, I'm trying to build whalesong and am hitting errors both when using the planet version in DrRacket, and when using the makefile from the current git master. Unfortunately I'm a real newcomer to Racket, so I'm not sure how to make this a smarter question. Does anyone know what's going on here,

Re: [racket] sharing an expensive computation required in procedure and its contract?

2014-07-20 Thread Jon Zeppieri
On Sun, Jul 20, 2014 at 2:47 PM, Alexander D. Knauth wrote: > > On Jul 20, 2014, at 1:56 PM, Jon Zeppieri wrote: > >> I feel like this has come up before, but I can't seem to find the >> discussion in the archive. > > Was this what you were thinking of? > http://lists.racket-lang.org/users/archiv

Re: [racket] sharing an expensive computation required in procedure and its contract?

2014-07-20 Thread Matthew Butterick
Though it is an off-label use of contracts, it can be done. I made something I call "coercion contracts" that mutate & validate the input (or output) argument as part of the contract: (define/contract (function-that-wants-something-stringlike x) (coerce/string? . -> . coerce/boolean?) (d

Re: [racket] sharing an expensive computation required in procedure and its contract?

2014-07-20 Thread Alexander D. Knauth
On Jul 20, 2014, at 1:56 PM, Jon Zeppieri wrote: > I feel like this has come up before, but I can't seem to find the > discussion in the archive. Was this what you were thinking of? http://lists.racket-lang.org/users/archive/2013-November/060427.html http://lists.racket-lang.org/users/archive/2

Re: [racket] Pass by value/name/reference

2014-07-20 Thread Jon Zeppieri
On Sun, Jul 20, 2014 at 5:02 AM, קוראל אלימלך wrote: > Hey :) > How the arguments are passed in racket? > by value/ reference/name? > > If u can add an example it will b good :) > Thank U ! > I suspect two different things are being conflated here: 1. the reduction semantics of the language 2. t

Re: [racket] sharing an expensive computation required in procedure and its contract?

2014-07-20 Thread Matthias Felleisen
On Jul 20, 2014, at 1:56 PM, Jon Zeppieri wrote: > I feel like this has come up before, but I can't seem to find the > discussion in the archive. I have a procedure that needs to perform a > fairly expensive computation which is needed both for checking the > inputs and for producing output. I'd

Re: [racket] examples of hooking a #lang into DrRacket?

2014-07-20 Thread Matthew Butterick
That's a helpful clue, but DrRacket still seems to be making some kind of mysterious & negative judgment about the package when it starts up: 1) I created a branch in my github repo called pollen/scratchy that only consists of the file shown below, and switched to that branch. 2) Consistent wi

[racket] typed racket and unions of vector types

2014-07-20 Thread Alexander D. Knauth
I ran into this when trying to do vector-ref on a value of type In-Indexes from math/array. If I do something like this: #lang typed/racket (: v : (U (Vectorof Index) (Vectorof Integer))) (define v #(0)) (ann (vector-ref v 0) Integer) Then it doesn't type check. I understand that (

[racket] sharing an expensive computation required in procedure and its contract?

2014-07-20 Thread Jon Zeppieri
I feel like this has come up before, but I can't seem to find the discussion in the archive. I have a procedure that needs to perform a fairly expensive computation which is needed both for checking the inputs and for producing output. I'd like to avoid computing it twice, and I'd also like to use

[racket] define-match-expander and the second proc-expr for when it's not a match pattern

2014-07-20 Thread Alexander D. Knauth
Is there a way to supply a rename transformer instead of a procedure for it to use when it’s not used as a match pattern? If I do something like this: #lang racket (require (for-syntax syntax/parse)) (define-match-expander my-list (lambda (stx) ; to use when it’s a match pattern, works (

Re: [racket] function parameters in racket

2014-07-20 Thread Alexander D. Knauth
I think probably a clearer way is to say this: (define plus (lambda xs (displayln “received: “) (displayln xs) (apply + xs))) http://docs.racket-lang.org/guide/lambda.html#%28part._rest-args%29 On Jul 20, 2014, at 11:33 AM, קוראל אלימלך wrote: > thank u very much:) > > > 2014-07

Re: [racket] function parameters in racket

2014-07-20 Thread קוראל אלימלך
thank u very much:) 2014-07-20 18:29 GMT+03:00 Jens Axel Søgaard : > (define (plus . xs) ; notice the . xs . The arguments are passed as a > list in xs. > (displayln "received: ") > (displayln xs) > (apply + xs)) > > 2014-07-20 16:07 GMT+02:00 קוראל אלימלך : > > how can i define a functio

Re: [racket] function parameters in racket

2014-07-20 Thread Jens Axel Søgaard
(define (plus . xs) ; notice the . xs . The arguments are passed as a list in xs. (displayln "received: ") (displayln xs) (apply + xs)) 2014-07-20 16:07 GMT+02:00 קוראל אלימלך : > how can i define a function that gets a not known number of parameters > (like the + function: > that i can se

Re: [racket] function parameters in racket

2014-07-20 Thread David Van Horn
On 7/20/14, 10:07 AM, קוראל אלימלך wrote: > how can i define a function that gets a not known number of parameters > (like the + function: > that i can send (+1 2 ) or (+ 1 2 3 ) (+1 2 3 4 )) http://docs.racket-lang.org/guide/lambda.html I think many of the questions you have will be answere

[racket] function parameters in racket

2014-07-20 Thread קוראל אלימלך
how can i define a function that gets a not known number of parameters (like the + function: that i can send (+1 2 ) or (+ 1 2 3 ) (+1 2 3 4 )) thank u :) Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Type of argument in a function

2014-07-20 Thread קוראל אלימלך
thank u all!! :) 2014-07-20 16:09 GMT+03:00 קוראל אלימלך : > תודה רבה לכולם :) > עזרתם לי מאוד! > > > 2014-07-20 15:59 GMT+03:00 David Van Horn : > >> On 7/20/14, 7:04 AM, קוראל אלימלך wrote: >> > How can i define that a function will get an integer argument? >> > >> > is its possible? >> > >> >

Re: [racket] Type of argument in a function

2014-07-20 Thread קוראל אלימלך
תודה רבה לכולם :) עזרתם לי מאוד! 2014-07-20 15:59 GMT+03:00 David Van Horn : > On 7/20/14, 7:04 AM, קוראל אלימלך wrote: > > How can i define that a function will get an integer argument? > > > > is its possible? > > > > for example: > > (define (func (x::Number))) /// its not working that way >

Re: [racket] Type of argument in a function

2014-07-20 Thread David Van Horn
On 7/20/14, 7:04 AM, קוראל אלימלך wrote: > How can i define that a function will get an integer argument? > > is its possible? > > for example: > (define (func (x::Number))) /// its not working that way > > and if ill call the function with string there will be an error.. In addition to the sug

Re: [racket] Type of argument in a function

2014-07-20 Thread Jens Axel Søgaard
#lang typed/racket (: plus : Number Number -> Number) (define (plus x y) (+ x y)) (plus 1 2) (plus "x" 3) 2014-07-20 13:53 GMT+02:00 Jens Axel Søgaard : > #lang racket > > (define (plus x y) > (unless (and (number? x) (number? y)) > (error 'plus (~a "expected two numbers, got: " x " " y

Re: [racket] Type of argument in a function

2014-07-20 Thread Jens Axel Søgaard
#lang racket (define (plus x y) (unless (and (number? x) (number? y)) (error 'plus (~a "expected two numbers, got: " x " " y))) (+ x y)) (plus 1 2) (plus "x" 3) 2014-07-20 13:04 GMT+02:00 קוראל אלימלך : > How can i define that a function will get an integer argument? > > is its possible?

Re: [racket] Type of argument in a function

2014-07-20 Thread dfeltey
Have you looked into Typed Racket? http://docs.racket-lang.org/ts-guide/index.html You can write things similar to the following: (define (f [x : Number]) : Number x) - Original Message - From: "קוראל אלימלך" To: users@racket-lang.org Sent: Sunday, July 20, 2014 7:04:39 AM GMT -05:0

[racket] Type of argument in a function

2014-07-20 Thread קוראל אלימלך
How can i define that a function will get an integer argument? is its possible? for example: (define (func (x::Number))) /// its not working that way and if ill call the function with string there will be an error.. Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Pass by value/name/reference

2014-07-20 Thread Jos Koot
Be aware there is also a lazy racket (#lang lazy) #lang racket ; call by value (define (show x) (display x) (newline) x) (define (plus x y z) (display "now we are in the procedure\n") (+ x y z)) "the procedure has been defined" (plus (show 1) (show 2) (show 3) ) "the proceedure has been calle

Re: [racket] Pass by value/name/reference

2014-07-20 Thread קוראל אלימלך
thank u :) but we didn't understand if the arguments are passed by value or reference? we think that it passed by value, and if we use with pointers it can pass by refernce. another question, if we use let function, the argument is passed by name? thank u very much! 2014-07-20 13:09 GMT+03:00

Re: [racket] Pass by value/name/reference

2014-07-20 Thread Jos Koot
See section 4.3.1 of the Racket guide. Jos _ From: users [mailto:users-boun...@racket-lang.org] On Behalf Of ? ?? Sent: domingo, 20 de julio de 2014 11:03 To: users@racket-lang.org Subject: [racket] Pass by value/name/reference Hey :) How the arguments are passed in racket? by

[racket] Pass by value/name/reference

2014-07-20 Thread קוראל אלימלך
Hey :) How the arguments are passed in racket? by value/ reference/name? If u can add an example it will b good :) Thank U ! Racket Users list: http://lists.racket-lang.org/users