Re: [racket-users] generalised set! in Racket

2015-07-01 Thread Alexey Cherkaev
Hi all, Thanks to all replies, at the moment I would tend to agree that generalised `set!` might not be such a great idea after all: - The notion of 'place' is essentially a pointer to a memory location, but it is not the first-class citizen: the following expressions are not

Re: [racket-users] generalised set! in Racket

2015-07-01 Thread Alexander D. Knauth
On Jul 1, 2015, at 4:27 AM, Alexey Cherkaev alexey.cherk...@gmail.com wrote: Hi all, Thanks to all replies, at the moment I would tend to agree that generalised `set!` might not be such a great idea after all: The notion of 'place' is essentially a pointer to a memory location, but it

Re: [racket-users] generalised set! in Racket

2015-06-30 Thread Matthias Felleisen
On Jun 30, 2015, at 6:43 PM, George Neuner wrote: On 6/30/2015 5:34 PM, 'John Clements' via Racket Users wrote: On Jun 30, 2015, at 8:10 AM, Alexey Cherkaev alexey.cherk...@gmail.com wrote: ... wouldn't it be beneficial to have such a generalised 'set!' system-wide? I understand

Re: [racket-users] generalised set! in Racket

2015-06-30 Thread Alexander D. Knauth
On Jun 30, 2015, at 5:34 PM, 'John Clements' via Racket Users racket-users@googlegroups.com wrote: Specifically, one of the basic ideas of algebraic languages is that programs are compositional. Specifically, if I write (a (b x) c), then the meaning of this term depends on the meanings of

Re: [racket-users] generalised set! in Racket

2015-06-30 Thread David Vanderson
Racket does have 'make-set!-transformer' that allows you to define syntax that cooperates with 'set!'. I think that might work if you are defining your own datatype. Have you seen that? Thanks, Dave On 06/30/2015 11:10 AM, Alexey Cherkaev wrote: Hi Alexander, Thanks for your reply: I had

Re: [racket-users] generalised set! in Racket

2015-06-30 Thread Neil Van Dyke
I have implemented generalized `set!` in Racket before, as a cute exploratory exercise, but I haven't found a sufficiently compelling benefit of generalized `set!`. The closest I've imagined to benefit of generalized `set!`: let's say you had really terse but nice referencing syntax for

Re: [racket-users] generalised set! in Racket

2015-06-30 Thread Alexey Cherkaev
Hi Alexander, Thanks for your reply: I had something similar in mind (maybe I should check out math/array). I was just wondering if there was something more Racket-like (it still feels that SRFI is somewhat 'foreign' hack). And my last question remains: wouldn't it be beneficial to have such a

Re: [racket-users] generalised set! in Racket

2015-06-30 Thread Michael Titke
As the mentioned SRFI states it: This is a proposal to allow procedure calls that evaluate to the value of a location to be used to /set/ the value of the location, when used as the first operand of |set!|. The term location is only used in the introductory part but for those who know the

Re: [racket-users] generalised set! in Racket

2015-06-30 Thread 'John Clements' via Racket Users
On Jun 30, 2015, at 8:10 AM, Alexey Cherkaev alexey.cherk...@gmail.com wrote: Hi Alexander, Thanks for your reply: I had something similar in mind (maybe I should check out math/array). I was just wondering if there was something more Racket-like (it still feels that SRFI is somewhat

Re: [racket-users] generalised set! in Racket

2015-06-30 Thread George Neuner
On 6/30/2015 5:34 PM, 'John Clements' via Racket Users wrote: On Jun 30, 2015, at 8:10 AM, Alexey Cherkaev alexey.cherk...@gmail.com wrote: ... wouldn't it be beneficial to have such a generalised 'set!' system-wide? I understand that Racket focusses more on immutable structures, but there

Re: [racket-users] generalised set! in Racket

2015-06-30 Thread 'John Clements' via Racket Users
On Jun 30, 2015, at 3:43 PM, George Neuner gneun...@comcast.net wrote: that's just semantics. XD -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to

Re: [racket-users] generalised set! in Racket

2015-06-30 Thread Neil Toronto
On 06/30/2015 07:27 PM, 'John Clements' via Racket Users wrote: On Jun 30, 2015, at 3:43 PM, George Neuner gneun...@comcast.net wrote: that's just semantics. XD Let me expound a bit on John's pure-functional snooty-poo reply. Semantics - what programs mean - is everything. Exactly how

[racket-users] generalised set! in Racket

2015-06-29 Thread Alexey Cherkaev
Hi all, Common Lisp has a very useful idiom of SETF that can set values to arbitrary places. For example, one can set (1 2)-th item of an array A as: (SETF (AREF A 1 2) 20.0d0) Scheme preferred way is to use `*-set!` procedures. However, sometimes it is inconvenient. For example, if I want to

Re: [racket-users] generalised set! in Racket

2015-06-29 Thread Alexander D . Knauth
On Jun 29, 2015, at 5:56 AM, Alexey Cherkaev alexey.cherk...@gmail.com wrote: For example, I was thinking of defining syntax to access my implementation of multidimensional arrays as (define-syntax aref (syntax-rules (set!) [(set! (aref ?a ?i ...) ?v) (array-set! ?a ?i ... ?v)]