logs archiveBotHelp.net / Freenode / #ada / 2015 / July / 27 / 1
oliver117
sometimes prose just sucks http://slexy.org/view/s20DTEvfop
saison
hello, is this the right place to ask beginner ada programming questions?
OCTAGRAM
saison: sometimes
jk4
:)
saison
is now a good time? :)
jk4
sure
saison
i'm just writing my first ada programs and I'd like to turn a string that looks like "1 2 3" into an array of integers. Integer'Image() works on simple strings like "32" but not on the string with multiple spaces (understandably). Is there something like scanf() or a way to split on whitespace or something?
Shark8
saison: Not directly -- You'll want to use Ada.Integer_Text_IO.
OCTAGRAM
Matreshka strings have split, some GNAT.* packages might also have it
Shark8
And a loop.
Or you could use the stream attributes...
saison
Integer_Text_IO::Get looks like what Id need.. I know the number of inputs before hand, input looks like "3 \n 1 2 3 \n"
jk4
easy peasy
saison
this seems to work. It's a little strange though. http://pastebin.com/yL2wA9tU
need to add one to Index every time otherwise it points to an integer
jk4
this is quite long
get_line is over kill
just use get
text_io will handle the whitespace
however your style looks decent
right. so you're going the round about way by reading the whole line in first
saison
jk4: The function prototype I looked up for get() seemed to take a string so I tried that.. Could you post how you'd do it?
jk4
so there's this
procedure Get(Item : out Num;
Width : in Field := 0);
in integer_text_io
for Item in A'Range loop Ada.Integer_Text_IO.Get(A(Item)); end loop;
in text_io if a file_type is not specified then standard_input is assumed
is the default
saison
hmm yea thats much nicer :) thanks
jk4
where are you learning Ada?
saison
just getting started.. I've read some stuff from adacore and some pdf 'ada for c++ programmers'
jk4
but what brings you to the language?
saison
ah right. I'm a firmware engineer and write c/c++ in embedded systems. I've heard Ada is supposed to be very good for that sort of thing so i'm having a look on the weekends. Also plan on having a play around with mozillas Rust
jk4
cool
saison
jk4: do you work with Ada?
jk4
i have written Ada proffessionally for several years
saison
jk4: thanks for your help, I've got a solution to https://code.google.com/codejam/contest/351101/dashboard#s=p0 in ada :) http://pastebin.com/n0F5mFMr
sparre
saison: Why don't you use different types for case numbers, item positions and credits?
saison
sparre: because I'm not very good at Ada heh.. I suppose that's the point of the type system? You can tell the compiler the valid range of a type?
sparre
Yes.
And you can create subtypes (subsets) of a type if it is relevant.
saison: It is my opinion that you should start by learning about the type system, when you learn/study Ada programming.
saison
sparre: I'll have to do some more reading about it. I tried to add a few types but have made the compiler pretty angry.
jk4
pesky compiler
saison
jk4: it's just trying to be helpful I'm sure
jk4
i think it's actively malicious
darkestkhan
sparre: I'm at both ends of starting with type system when learning Ada - on one hand understanding type system in Ada makes a whole lot more productive, on the other hand it doesn't help with learning - first you want to get basic stuff going and only then you may look at type system
sparre
If you're impatient and want to start producing software, it will of course be difficult to start with the type system, but I think it is worth the wait.
darkestkhan
seems like best approach is just showcasing it on examples using integers and enumerations - basic things don't go too far from there, and one will at least get the difference between "type T is range [...]", "[...] new Integer" and "subtype S is Integer"
[simply just cut type system into small pieces that are easy to get]
sparre
Maybe.
But I think I would keep the focus on types until the whole type system had been introduced.
darkestkhan
fu*king as****es....
licensing of ghostscript changed to AGPL
specing
thats nice
sparre
darkestkhan: How can that be done? Only a single contributor?
darkestkhan
sparre: seems like copyright of gs is owned by one entity
I have no problem with license change to more permissive one, the other way - it is problematic
and AGPL has certain ... problems
specing
problems?
that you cannot use it in proprietary projects?
darkestkhan
specing: proprietary?
specing
closed sauce
darkestkhan
there is more than that
specing
tell us
darkestkhan
using it over pipe can cause licensing problems
specing
really?
is that "can couse" like all the articles where they say X "may be" happening?
like a diplomatic I think this is how it is but I have no proof?
Natacha
IIUC licensing is wildly open to interpretation as long as a judge hasn't fixed it
some interpretations of GPL makes it even incompatible with itself...
darkestkhan
specing: consider website that uses (in source code somewhere) ghostscript over pipe... that is dark gray area now - is entire website under AGPL now? or only pipe part of it?
Natacha: how so?
Natacha
"with itself but a different version"
specing
darkestkhan: I'm not sure how a license can propagate through a pipe
as far as I know it only affects linking
Natacha
e.g. "GPL v2.0+" is not compatible with "GPL v3.0", because the forme include more freedom of choice
former*
darkestkhan
Natacha: actually, GPLv2+ is compatible with gplv3, under gplv3 terms
Natacha
well "can be" rather than "is" until a judge says so, of course
darkestkhan
specing: how does pipe differ from network socket?
Natacha
darkestkhan, the reasoning is that turning GPLv2+ into GPLv3 is actually a restriction, which is not allowed by any version of GPL
darkestkhan
not exactly
GPLv2+ means "GNU General Public License version 2 or later"
specing
darkestkhan: how does using AGPL over a network socket make the using program AGPL as well?
darkestkhan
that 'or later' is important
Natacha
darkestkhan, "3" is quite more restrictive than "2 or later"
so the point is really wether the "or" is inside the licence or not
I'm aware that this is not a main stream interpretation of the stuff, but it is nevertheless a possible interpretation that might be bless by some courts
darkestkhan
Natacha: gpl3 restrictions are mostly about tivoization
specing: If your end applicationĀ dependsĀ on the external process, such that it wouldn't function properly without it, then it would be considered a derived work of the AGPL software.
specing
interesting
darkestkhan
pipes, sockets, whatever communication means - if your code depends on agpl code to function properly it is also under agpl
key point here is how wide is definition of "depend" for purposes of agpl
specing
I should read these licenses one day
but I have more important stuff to do
darkestkhan
with gpl things are relatively clear and simple, even more with lgpl, and e.g. bsd/mit/isc are trivial to understand
agpl is complex and murky :(
you bored are something?
« prev 1 2 3 next »