* Functional programming in Ada
@ 2008-07-03 19:36 Harald Korneliussen
2008-07-04 4:42 ` george.priv
0 siblings, 1 reply; 2+ messages in thread
From: Harald Korneliussen @ 2008-07-03 19:36 UTC (permalink / raw)
FP guru Chris Okasaki wrote an interesting post on doing functional
programming in Ada. Perhaps mostly a curiosity, but interesting that
it can be done.
http://okasaki.blogspot.com/2008/07/functional-programming-inada.html
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Functional programming in Ada
2008-07-03 19:36 Functional programming in Ada Harald Korneliussen
@ 2008-07-04 4:42 ` george.priv
0 siblings, 0 replies; 2+ messages in thread
From: george.priv @ 2008-07-04 4:42 UTC (permalink / raw)
On Jul 3, 3:36 pm, Harald Korneliussen <vinterm...@gmail.com> wrote:
> FP guru Chris Okasaki wrote an interesting post on doing functional
> programming in Ada. Perhaps mostly a curiosity, but interesting that
> it can be done.
>
> http://okasaki.blogspot.com/2008/07/functional-programming-inada.html
More fun with splitting/concatenating arrays:
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Strings.Fixed;
type Tokens is array (Integer range <>) of Unbounded_String;
function Tokenize (Src : String) return Tokens is
Idx : Integer := Ada.Strings.Fixed.Index (Src, " ");
begin
if Idx >= Src'First then
return To_Unbounded_String (Src(Src'First..Idx)) & Tokenize
(Src(Idx+1..Src'Last));
else
return X : Tokens (1..1) do
X(1) := To_Unbounded_String (Src);
end return;
end if;
end Tokenize;
Reminds me old days fulling around with Prolog..
George
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-07-04 4:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-03 19:36 Functional programming in Ada Harald Korneliussen
2008-07-04 4:42 ` george.priv
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox