On Thursday, 26 May 2016 at 02:17:20 UTC, Observer wrote:
On Wednesday, 25 May 2016 at 17:08:02 UTC, Martin Tschierschke
wrote:
A newbee question about language design:
When I looked first time at Ruby I liked the simple a,b = b,a
syntax,
so swap. Would it be theoretically possible to allow th
On Wednesday, 25 May 2016 at 17:08:02 UTC, Martin Tschierschke
wrote:
A newbee question about language design:
When I looked first time at Ruby I liked the simple a,b = b,a
syntax,
so swap. Would it be theoretically possible to allow this?
And if not, where does it breaks the general language
On 05/25/2016 01:08 PM, Martin Tschierschke wrote:
On Monday, 23 May 2016 at 20:01:08 UTC, Andrei Alexandrescu wrote:
So swap(a, b) swaps the contents of a and b. This could be easily
generalized to multiple arguments such that swap(a1, a2, ..., an)
arranges things such that a1 gets an, a2 gets
On Wednesday, 25 May 2016 at 17:08:02 UTC, Martin Tschierschke
wrote:
And if not, where does it breaks the general language design?
Here: https://en.wikipedia.org/wiki/Comma_operator
On Monday, 23 May 2016 at 20:01:08 UTC, Andrei Alexandrescu wrote:
So swap(a, b) swaps the contents of a and b. This could be
easily generalized to multiple arguments such that swap(a1, a2,
..., an) arranges things such that a1 gets an, a2 gets a1, a3
gets a2, etc. I do know applications for th
On Monday, 23 May 2016 at 21:47:31 UTC, Ali Çehreli wrote:
Yes, rotate(), but then I would never remember what direction
it rotates.
Ali
I agree. So we need
rotate{Forward,Backward}
or
rotate{Left,Right}
then.
I vote for the former case.
On Tuesday, 24 May 2016 at 12:22:01 UTC, H. S. Teoh wrote:
And why would you assume that it would rotate right? The
default assumption, unless stated clearly and widely followed
everywhere, is unclear and leads to misunderstandings.
hmmm rotate left would be a lot easier (and cleaner) to
imp
On Tuesday, 24 May 2016 at 08:56:31 UTC, Jonathan M Davis wrote:
On Tuesday, May 24, 2016 02:40:24 Observer via Digitalmars-d
wrote:
If you don't see value in it, you've neglected to learn
PostScript.
I wasn't aware that postscript was a programming language. All
I know about it is that it's
On Tuesday, 24 May 2016 at 18:51:32 UTC, Andrei Alexandrescu
wrote:
On 05/24/2016 02:48 PM, Xinok wrote:
BTW, Phobos already has a function called bringToFront which
can
rotate/roll ranges but the interface is a bit different
compared to
other languages.
https://dlang.org/phobos/std_algorithm
On 05/24/2016 02:48 PM, Xinok wrote:
BTW, Phobos already has a function called bringToFront which can
rotate/roll ranges but the interface is a bit different compared to
other languages.
https://dlang.org/phobos/std_algorithm_mutation.html#.bringToFront
This may be a misunderstanding. The orig
On 05/24/2016 02:48 PM, Xinok wrote:
One point I've never seen mentioned though is that these ideas would
probably have limited usage in the real world.
I agree. I'd be hard pressed to find a use for swap/rotate with more
than three arguments. It's just that generalization that seems natural
On Monday, 23 May 2016 at 20:01:08 UTC, Andrei Alexandrescu wrote:
...
I wish to make a different point which is more general regarding
ideas like these. I see a lot of proposals to add this or that to
the standard library and a lot of debate pursues. One point I've
never seen mentioned thou
On Tuesday, 24 May 2016 at 14:49:20 UTC, Wyatt wrote:
In the APL family, we have dyadic ⌽ and ⊖:
3⌽⍳9 ⍝ left
4 5 6 7 8 9 1 2 3
¯3⌽⍳9 ⍝ right
7 8 9 1 2 3 4 5 6
[...]
-Wyatt
Wow: I didn't see any APL code for years ! ;)
That's fine but maybe not a very good example of what should be
On Tuesday, 24 May 2016 at 12:22:01 UTC, H. S. Teoh wrote:
And why would you assume that it would rotate right? The
default assumption, unless stated clearly and widely followed
everywhere, is unclear and leads to misunderstandings. I'd
rather unambiguously name them rotateRight and rotateLef
On Tue, May 24, 2016 at 09:21:07AM +, ixid via Digitalmars-d wrote:
> On Tuesday, 24 May 2016 at 01:18:05 UTC, Jonathan M Davis wrote:
> > Hmmm. And I would have assumed that it rotated in the other
> > direction. This is really going to need a very specific name like
> > rotateLeft or rotateR
On Tuesday, 24 May 2016 at 02:40:24 UTC, Observer wrote:
As for utility, if you're a PostScript programmer, where keeping
track of data is done via a stack-oriented model, this
capability
gets used all the time, to bring relevant arguments to the top
of the stack to be operated upon, or to shov
On 2016-05-24 02:16, H. S. Teoh via Digitalmars-d wrote:
On Mon, May 23, 2016 at 04:01:08PM -0400, Andrei Alexandrescu via Digitalmars-d
wrote:
So swap(a, b) swaps the contents of a and b. This could be easily
generalized to multiple arguments such that swap(a1, a2, ..., an)
arranges things suc
On Tuesday, 24 May 2016 at 01:18:05 UTC, Jonathan M Davis wrote:
Hmmm. And I would have assumed that it rotated in the other
direction. This is really going to need a very specific name
like rotateLeft or rotateRight in order for it not to be
error-prone.
- Jonathan M Davis
Why would you as
On Tuesday, May 24, 2016 02:40:24 Observer via Digitalmars-d wrote:
> If you don't see value in it, you've neglected to learn
> PostScript.
I wasn't aware that postscript was a programming language. All I know about
it is that it's what printers talk (sometimes), and I assumed that it was a
protoc
On Monday, 23 May 2016 at 21:38:54 UTC, Jonathan M Davis wrote:
One thing that screams out to me: this should be called
rotate, not swap.
That would probably be better. My immediate thought on reading
Andrei's suggestion for swap was that it would be way too easy
to forget what's actually bei
On Monday, May 23, 2016 18:10:02 Steven Schveighoffer via Digitalmars-d wrote:
> On 5/23/16 5:47 PM, Ali Çehreli wrote:
> > On 05/23/2016 01:27 PM, Steven Schveighoffer wrote:
> >> On 5/23/16 4:01 PM, Andrei Alexandrescu wrote:
> >>> So swap(a, b) swaps the contents of a and b. This could be easily
On Mon, May 23, 2016 at 04:01:08PM -0400, Andrei Alexandrescu via Digitalmars-d
wrote:
> So swap(a, b) swaps the contents of a and b. This could be easily
> generalized to multiple arguments such that swap(a1, a2, ..., an)
> arranges things such that a1 gets an, a2 gets a1, a3 gets a2, etc. I
> do
On 5/23/16 6:22 PM, Andrei Alexandrescu wrote:
On 05/23/2016 04:27 PM, Steven Schveighoffer wrote:
On 5/23/16 4:01 PM, Andrei Alexandrescu wrote:
So swap(a, b) swaps the contents of a and b. This could be easily
generalized to multiple arguments such that swap(a1, a2, ..., an)
arranges things s
On Monday, 23 May 2016 at 21:47:31 UTC, Ali Çehreli wrote:
Yes, rotate(), but then I would never remember what direction
it rotates.
If we take a cue from assembly instructions, there's rol and ror
(rotate left/right). These are other instructions are normally
unreachable in languages; Altho
On 05/23/2016 04:27 PM, Steven Schveighoffer wrote:
On 5/23/16 4:01 PM, Andrei Alexandrescu wrote:
So swap(a, b) swaps the contents of a and b. This could be easily
generalized to multiple arguments such that swap(a1, a2, ..., an)
arranges things such that a1 gets an, a2 gets a1, a3 gets a2, etc
On 5/23/16 5:47 PM, Ali Çehreli wrote:
On 05/23/2016 01:27 PM, Steven Schveighoffer wrote:
On 5/23/16 4:01 PM, Andrei Alexandrescu wrote:
So swap(a, b) swaps the contents of a and b. This could be easily
generalized to multiple arguments such that swap(a1, a2, ..., an)
arranges things such that
On Monday, 23 May 2016 at 20:01:08 UTC, Andrei Alexandrescu wrote:
So swap(a, b) swaps the contents of a and b. This could be
easily generalized to multiple arguments such that swap(a1, a2,
..., an) arranges things such that a1 gets an, a2 gets a1, a3
gets a2, etc. I do know applications for th
On 05/23/2016 01:27 PM, Steven Schveighoffer wrote:
On 5/23/16 4:01 PM, Andrei Alexandrescu wrote:
So swap(a, b) swaps the contents of a and b. This could be easily
generalized to multiple arguments such that swap(a1, a2, ..., an)
arranges things such that a1 gets an, a2 gets a1, a3 gets a2, etc
On Monday, May 23, 2016 16:27:43 Steven Schveighoffer via Digitalmars-d wrote:
> On 5/23/16 4:01 PM, Andrei Alexandrescu wrote:
> > So swap(a, b) swaps the contents of a and b. This could be easily
> > generalized to multiple arguments such that swap(a1, a2, ..., an)
> > arranges things such that a
On Monday, 23 May 2016 at 20:27:43 UTC, Steven Schveighoffer
wrote:
On 5/23/16 4:01 PM, Andrei Alexandrescu wrote:
So swap(a, b) swaps the contents of a and b. This could be
easily generalized to multiple arguments such that swap(a1,
a2, ..., an) arranges things such that a1 gets an, a2 gets a1
On Monday, 23 May 2016 at 20:27:43 UTC, Steven Schveighoffer
wrote:
On 5/23/16 4:01 PM, Andrei Alexandrescu wrote:
So swap(a, b) swaps the contents of a and b. This could be
easily
generalized to multiple arguments such that swap(a1, a2, ...,
an)
arranges things such that a1 gets an, a2 gets a1
On 5/23/16 4:01 PM, Andrei Alexandrescu wrote:
So swap(a, b) swaps the contents of a and b. This could be easily
generalized to multiple arguments such that swap(a1, a2, ..., an)
arranges things such that a1 gets an, a2 gets a1, a3 gets a2, etc. I do
know applications for three arguments. Thought
So swap(a, b) swaps the contents of a and b. This could be easily
generalized to multiple arguments such that swap(a1, a2, ..., an)
arranges things such that a1 gets an, a2 gets a1, a3 gets a2, etc. I do
know applications for three arguments. Thoughts? -- Andrei
33 matches
Mail list logo