Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
42
Task/Amb/BaCon/amb.bacon
Normal file
42
Task/Amb/BaCon/amb.bacon
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
DECLARE (*ambassert)() TYPE NUMBER
|
||||
|
||||
FUNCTION amb_recurse$(text$[], nr, total, result$)
|
||||
|
||||
LOCAL ctr
|
||||
LOCAL str$, test$
|
||||
|
||||
FOR ctr = 1 TO AMOUNT(text$[nr])
|
||||
str$ = APPEND$(result$, 0, TOKEN$(text$[nr], ctr))
|
||||
IF nr = total-1 THEN
|
||||
IF ambassert(str$) THEN RETURN str$
|
||||
ELSE
|
||||
test$ = amb_recurse$(text$, nr+1, total, str$)
|
||||
IF AMOUNT(test$) = total THEN RETURN test$
|
||||
ENDIF
|
||||
NEXT
|
||||
|
||||
RETURN ""
|
||||
|
||||
ENDFUNC
|
||||
|
||||
FUNCTION ambsel$(VAR data$ SIZE dim)
|
||||
|
||||
RETURN IIF$(dim < 2, "ambsel$ needs more than 1 argument", amb_recurse$(data$, 0, dim, ""))
|
||||
|
||||
ENDFUNC
|
||||
|
||||
FUNCTION this_is_some_constraint(var$)
|
||||
|
||||
DOTIMES AMOUNT(var$)-1
|
||||
IF RIGHT$(TOKEN$(var$, _), 1) != LEFT$(TOKEN$(var$, _+1), 1) THEN RETURN FALSE
|
||||
DONE
|
||||
|
||||
RETURN TRUE
|
||||
|
||||
ENDFUNC
|
||||
|
||||
' AMBASSERT: pointing to a constraint function
|
||||
ambassert = this_is_some_constraint
|
||||
|
||||
' AMBSEL$: generate result from arguments in delimited string format
|
||||
PRINT ambsel$("the that a", "frog elephant thing", "walked treaded grows", "slowly quickly")
|
||||
Loading…
Add table
Add a link
Reference in a new issue