Skip to content

Instantly share code, notes, and snippets.

@dockimbel
Created March 22, 2017 07:31
Show Gist options
  • Save dockimbel/bffe92eb070b24f5573b677589a94591 to your computer and use it in GitHub Desktop.
Save dockimbel/bffe92eb070b24f5573b677589a94591 to your computer and use it in GitHub Desktop.
Experimental generic loader for non-Red input text.
Red []
load-any: function [input [string!]][
out: make block! 100
junk: none
until [
result: load/trap/next input 'pos
either error? result/3 [
append any [junk junk: make string! 20] result/2/1
input: next result/2
][
if junk [
append out #junk
append out junk
junk: none
]
input: result/2
]
append out result/1
empty? result/2
]
out
]
;; load-any "aaa 456z 3 abc"
;; == [aaa #junk "456" z 3 abc]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment