remove head/tail
This commit is contained in:
parent
96cb54a70a
commit
427f5ccd29
5
irc.lamb
5
irc.lamb
|
@ -1,5 +1,7 @@
|
||||||
-- First we'll define some helper functions
|
-- First we'll define some helper functions
|
||||||
|
|
||||||
|
-- irc stuff
|
||||||
|
|
||||||
-- Splits a string by spaces, or until it encounters a :, whereby the following is considered one element.
|
-- Splits a string by spaces, or until it encounters a :, whereby the following is considered one element.
|
||||||
splitirc'("", stracc, acc) -> acc + [stracc].
|
splitirc'("", stracc, acc) -> acc + [stracc].
|
||||||
splitirc'(" "::xs, stracc, acc) -> do
|
splitirc'(" "::xs, stracc, acc) -> do
|
||||||
|
@ -13,9 +15,6 @@ splitirc'(x::xs, stracc, acc) -> splitirc'(xs, stracc + x, acc).
|
||||||
-- helper function
|
-- helper function
|
||||||
splitirc(str) -> splitirc'(str, "", []).
|
splitirc(str) -> splitirc'(str, "", []).
|
||||||
|
|
||||||
head(x::_) -> x.
|
|
||||||
tail(_::xs) -> xs.
|
|
||||||
|
|
||||||
-- (result, rest)
|
-- (result, rest)
|
||||||
takeUntilSpace'(" "::xs, acc) -> (acc, xs).
|
takeUntilSpace'(" "::xs, acc) -> (acc, xs).
|
||||||
takeUntilSpace'(x::xs, acc) -> takeUntilSpace'(xs, acc + x).
|
takeUntilSpace'(x::xs, acc) -> takeUntilSpace'(xs, acc + x).
|
||||||
|
|
Loading…
Reference in New Issue